From e2838d021383985ee4e369ffa4785ad7c198038d Mon Sep 17 00:00:00 2001 From: Dante Date: Fri, 28 Oct 2022 15:12:02 -0300 Subject: [PATCH] Hotfix stringify identity --- package.json | 2 +- src/constants/version.ts | 2 +- src/utils/storage/update_handlers/v0.20.0.ts | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1142086b..fa5e2d9a 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "typescript": "^4.5" }, "name": "@psychedelic/plug-controller", - "version": "0.24.5", + "version": "0.24.6", "description": "Internet Computer Plug wallet's controller", "main": "dist/index.js", "scripts": { diff --git a/src/constants/version.ts b/src/constants/version.ts index 3c88dbf0..3bdea841 100644 --- a/src/constants/version.ts +++ b/src/constants/version.ts @@ -1 +1 @@ -export const PLUG_CONTROLLER_VERSION = "0.24.5"; +export const PLUG_CONTROLLER_VERSION = "0.24.6"; diff --git a/src/utils/storage/update_handlers/v0.20.0.ts b/src/utils/storage/update_handlers/v0.20.0.ts index 0984f9e2..36ef3594 100644 --- a/src/utils/storage/update_handlers/v0.20.0.ts +++ b/src/utils/storage/update_handlers/v0.20.0.ts @@ -1,6 +1,13 @@ import { createAccountFromMnemonic } from '../../../utils/account'; import { Types } from '../../../utils/account/constants'; +import Secp256k1KeyIdentity from '../../identity/secpk256k1/identity'; +const getKeyPair = (identity: Secp256k1KeyIdentity) => { + const jsonIdentity = identity.toJSON(); + return typeof jsonIdentity === 'string' + ? jsonIdentity + : JSON.stringify(jsonIdentity); +} export default (storage: any) => { const mnemonic = storage.mnemonic; @@ -14,7 +21,7 @@ export default (storage: any) => { return ({ ...wallet, type: Types.mnemonic, - keyPair: identity.toJSON(), + keyPair: getKeyPair(identity), }) }) }