diff --git a/library/src/utils/serialization.ts b/library/src/utils/serialization.ts index 5515655..2f03c41 100644 --- a/library/src/utils/serialization.ts +++ b/library/src/utils/serialization.ts @@ -11,11 +11,11 @@ export function isSerializedUint8Array(data: unknown): data is BytesMessage { } export function uint8ArrayToString(bytes: Uint8Array): string { - return new TextDecoder().decode(bytes) + return bytes.toString() } export function stringToUint8Array(serializedBytes: string): Uint8Array { - return new TextEncoder().encode(serializedBytes) + return Uint8Array.from(serializedBytes.split(',').map(num => Number(num))) } export function uint8ArrayToSerializedParameter(bytes: Uint8Array): BytesMessage { diff --git a/package-lock.json b/package-lock.json index 8680113..76ae2bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13392,9 +13392,9 @@ "dev": true }, "node_modules/webpack": { - "version": "5.74.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", - "integrity": "sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==", + "version": "5.78.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.78.0.tgz", + "integrity": "sha512-gT5DP72KInmE/3azEaQrISjTvLYlSM0j1Ezhht/KLVkrqtv10JoP/RXhwmX/frrutOPuSq3o5Vq0ehR/4Vmd1g==", "dependencies": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^0.0.51", @@ -23286,9 +23286,9 @@ "dev": true }, "webpack": { - "version": "5.74.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", - "integrity": "sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==", + "version": "5.78.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.78.0.tgz", + "integrity": "sha512-gT5DP72KInmE/3azEaQrISjTvLYlSM0j1Ezhht/KLVkrqtv10JoP/RXhwmX/frrutOPuSq3o5Vq0ehR/4Vmd1g==", "requires": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^0.0.51", diff --git a/src/services/storage/storage-migration.ts b/src/services/storage/storage-migration.ts index 0272058..87b2baf 100644 --- a/src/services/storage/storage-migration.ts +++ b/src/services/storage/storage-migration.ts @@ -38,5 +38,5 @@ export async function migrate(newVersionString: string): Promise { await updateObject(Storage.dappsKey, updatedAccountDapps) } - await this.setStorageVesion(newVersionString) + await storage.setStorageVesion(newVersionString) } diff --git a/src/utils/converters.ts b/src/utils/converters.ts index 2fdf27f..f0dc6d4 100644 --- a/src/utils/converters.ts +++ b/src/utils/converters.ts @@ -37,11 +37,11 @@ export function versionToString(version: Version): string { } export function uint8ArrayToString(bytes: Uint8Array): string { - return new TextDecoder().decode(bytes) + return bytes.toString() } export function stringToUint8Array(serializedBytes: string): Uint8Array { - return new TextEncoder().encode(serializedBytes) + return Uint8Array.from(serializedBytes.split(',').map((num) => Number(num))) } export function uint8ArrayToSerializedParameter(bytes: Uint8Array): BytesMessage {