mirror of
https://github.com/sussy-code/smov.git
synced 2026-01-11 20:10:16 +00:00
Merge pull request #115 from p-stream/update-packages
Update packages and fix errors in crypto.ts
This commit is contained in:
commit
0f33da79d1
3 changed files with 58 additions and 47 deletions
78
package.json
78
package.json
|
|
@ -27,7 +27,7 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.1.0",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^7.0.0",
|
||||
"@dnd-kit/sortable": "^8.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
|
|
@ -36,31 +36,31 @@
|
|||
"@ladjs/country-language": "^1.0.3",
|
||||
"@marsidev/react-turnstile": "^0.7.2",
|
||||
"@movie-web/providers": "github:sussy-code/providers",
|
||||
"@noble/hashes": "^1.5.0",
|
||||
"@noble/hashes": "^1.7.0",
|
||||
"@plasmohq/messaging": "^0.6.2",
|
||||
"@react-spring/web": "^9.7.4",
|
||||
"@scure/bip39": "^1.4.0",
|
||||
"@react-spring/web": "^9.7.5",
|
||||
"@scure/bip39": "^1.5.1",
|
||||
"@sozialhelden/ietf-language-tags": "^5.4.2",
|
||||
"@types/node-forge": "^1.3.11",
|
||||
"classnames": "^2.5.1",
|
||||
"core-js": "^3.38.1",
|
||||
"core-js": "^3.40.0",
|
||||
"detect-browser": "^5.3.0",
|
||||
"dompurify": "^3.1.6",
|
||||
"flag-icons": "^7.2.3",
|
||||
"focus-trap-react": "^10.3.0",
|
||||
"dompurify": "^3.2.3",
|
||||
"flag-icons": "^7.3.2",
|
||||
"focus-trap-react": "^10.3.1",
|
||||
"fscreen": "^1.2.0",
|
||||
"fuse.js": "^7.0.0",
|
||||
"hls.js": "^1.5.15",
|
||||
"i18next": "^23.15.1",
|
||||
"hls.js": "^1.5.19",
|
||||
"i18next": "^23.16.8",
|
||||
"immer": "^10.1.1",
|
||||
"iso-639-3": "^3.0.1",
|
||||
"jwt-decode": "^4.0.0",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"million": "^2.6.4",
|
||||
"nanoid": "^5.0.7",
|
||||
"nanoid": "^5.0.9",
|
||||
"node-forge": "^1.3.1",
|
||||
"ofetch": "^1.4.0",
|
||||
"ofetch": "^1.4.1",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-ga4": "^2.1.0",
|
||||
|
|
@ -68,72 +68,72 @@
|
|||
"react-helmet-async": "^2.0.5",
|
||||
"react-i18next": "^14.1.3",
|
||||
"react-lazy-with-preload": "^2.2.1",
|
||||
"react-router-dom": "^6.26.2",
|
||||
"react-router-dom": "^6.28.2",
|
||||
"react-sticky-el": "^2.1.1",
|
||||
"react-use": "^17.5.1",
|
||||
"react-use": "^17.6.0",
|
||||
"semver": "^7.6.3",
|
||||
"slugify": "^1.6.6",
|
||||
"subsrt-ts": "^2.1.2",
|
||||
"zustand": "^4.5.5"
|
||||
"zustand": "^4.5.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/preset-env": "^7.25.4",
|
||||
"@babel/preset-typescript": "^7.24.7",
|
||||
"@rollup/wasm-node": "^4.22.4",
|
||||
"@types/chromecast-caf-sender": "^1.0.10",
|
||||
"@babel/core": "^7.26.0",
|
||||
"@babel/preset-env": "^7.26.0",
|
||||
"@babel/preset-typescript": "^7.26.0",
|
||||
"@rollup/wasm-node": "^4.30.1",
|
||||
"@types/chromecast-caf-sender": "^1.0.11",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/dompurify": "^3.2.0",
|
||||
"@types/fscreen": "^1.0.4",
|
||||
"@types/lodash.isequal": "^4.5.8",
|
||||
"@types/lodash.merge": "^4.6.9",
|
||||
"@types/lodash.throttle": "^4.1.9",
|
||||
"@types/node": "^20.16.5",
|
||||
"@types/node": "^20.17.14",
|
||||
"@types/pako": "^2.0.3",
|
||||
"@types/react": "^18.3.8",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@types/react": "^18.3.18",
|
||||
"@types/react-dom": "^18.3.5",
|
||||
"@types/react-helmet": "^6.1.11",
|
||||
"@types/react-lazy-load-image-component": "^1.6.4",
|
||||
"@types/react-router": "^5.1.20",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"@types/react-stickynode": "^4.0.3",
|
||||
"@types/react-transition-group": "^4.4.11",
|
||||
"@types/react-transition-group": "^4.4.12",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||
"@typescript-eslint/parser": "^6.21.0",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-airbnb": "19.0.4",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-plugin-import": "^2.30.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.10.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-import-resolver-typescript": "^3.7.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||
"eslint-plugin-prettier": "^5.2.2",
|
||||
"eslint-plugin-react": "7.33.2",
|
||||
"eslint-plugin-react-hooks": "4.6.0",
|
||||
"glob": "^10.4.5",
|
||||
"handlebars": "^4.7.8",
|
||||
"jsdom": "^23.2.0",
|
||||
"postcss": "^8.4.47",
|
||||
"postcss": "^8.5.1",
|
||||
"postcss-rtl": "^2.0.0",
|
||||
"postcss-rtlcss": "^4.0.9",
|
||||
"prettier": "^3.3.3",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-tailwindcss": "^0.5.14",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"rollup-plugin-visualizer": "^5.14.0",
|
||||
"tailwind-scrollbar": "^3.1.0",
|
||||
"tailwindcss": "^3.4.12",
|
||||
"tailwindcss-themer": "^4.0.0",
|
||||
"type-fest": "^4.26.1",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.4.7",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"tailwindcss-themer": "^4.1.1",
|
||||
"type-fest": "^4.32.0",
|
||||
"typescript": "^5.7.3",
|
||||
"vite": "^5.4.11",
|
||||
"vite-plugin-checker": "^0.6.4",
|
||||
"vite-plugin-package-version": "^1.1.0",
|
||||
"vite-plugin-pwa": "^0.17.5",
|
||||
"vite-plugin-static-copy": "^1.0.6",
|
||||
"vitest": "^1.6.0",
|
||||
"workbox-window": "^7.1.0"
|
||||
"workbox-window": "^7.3.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
|
|
|
|||
|
|
@ -8664,4 +8664,4 @@ snapshots:
|
|||
optionalDependencies:
|
||||
'@types/react': 18.3.8
|
||||
immer: 10.1.1
|
||||
react: 18.3.1
|
||||
react: 18.3.1
|
||||
|
|
@ -10,6 +10,14 @@ type Keys = {
|
|||
seed: Uint8Array;
|
||||
};
|
||||
|
||||
function uint8ArrayToBuffer(array: Uint8Array): forge.util.ByteStringBuffer {
|
||||
return forge.util.createBuffer(
|
||||
Array.from(array)
|
||||
.map((byte) => String.fromCharCode(byte))
|
||||
.join(""),
|
||||
);
|
||||
}
|
||||
|
||||
async function seedFromMnemonic(mnemonic: string) {
|
||||
return pbkdf2Async(sha256, mnemonic, "mnemonic", {
|
||||
c: 2048,
|
||||
|
|
@ -29,8 +37,8 @@ export async function keysFromMnemonic(mnemonic: string): Promise<Keys> {
|
|||
});
|
||||
|
||||
return {
|
||||
privateKey,
|
||||
publicKey,
|
||||
privateKey: new Uint8Array(privateKey),
|
||||
publicKey: new Uint8Array(publicKey),
|
||||
seed,
|
||||
};
|
||||
}
|
||||
|
|
@ -43,11 +51,12 @@ export async function signCode(
|
|||
code: string,
|
||||
privateKey: Uint8Array,
|
||||
): Promise<Uint8Array> {
|
||||
return forge.pki.ed25519.sign({
|
||||
const signature = forge.pki.ed25519.sign({
|
||||
encoding: "utf8",
|
||||
message: code,
|
||||
privateKey,
|
||||
privateKey: uint8ArrayToBuffer(privateKey),
|
||||
});
|
||||
return new Uint8Array(signature);
|
||||
}
|
||||
|
||||
export function bytesToBase64(bytes: Uint8Array) {
|
||||
|
|
@ -71,7 +80,9 @@ export function base64ToBuffer(data: string) {
|
|||
}
|
||||
|
||||
export function base64ToStringBuffer(data: string) {
|
||||
return forge.util.createBuffer(base64ToBuffer(data));
|
||||
const decoded = base64ToBuffer(data);
|
||||
|
||||
return uint8ArrayToBuffer(decoded);
|
||||
}
|
||||
|
||||
export function stringBufferToBase64(buffer: forge.util.ByteStringBuffer) {
|
||||
|
|
@ -91,7 +102,7 @@ export async function encryptData(data: string, secret: Uint8Array) {
|
|||
|
||||
const cipher = forge.cipher.createCipher(
|
||||
"AES-GCM",
|
||||
forge.util.createBuffer(secret),
|
||||
uint8ArrayToBuffer(secret),
|
||||
);
|
||||
cipher.start({
|
||||
iv,
|
||||
|
|
@ -115,7 +126,7 @@ export function decryptData(data: string, secret: Uint8Array) {
|
|||
|
||||
const decipher = forge.cipher.createDecipher(
|
||||
"AES-GCM",
|
||||
forge.util.createBuffer(secret),
|
||||
uint8ArrayToBuffer(secret),
|
||||
);
|
||||
decipher.start({
|
||||
iv: base64ToStringBuffer(iv),
|
||||
|
|
|
|||
Loading…
Reference in a new issue