Skip to content

Commit ace5fce

Browse files
authored
Merge pull request #240 from Psychedelic/hotfix/stringify-indentity
Hotfix stringify identity
2 parents eadc90d + e2838d0 commit ace5fce

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"typescript": "^4.5"
5959
},
6060
"name": "@psychedelic/plug-controller",
61-
"version": "0.24.5",
61+
"version": "0.24.6",
6262
"description": "Internet Computer Plug wallet's controller",
6363
"main": "dist/index.js",
6464
"scripts": {

src/constants/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const PLUG_CONTROLLER_VERSION = "0.24.5";
1+
export const PLUG_CONTROLLER_VERSION = "0.24.6";

src/utils/storage/update_handlers/v0.20.0.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { createAccountFromMnemonic } from '../../../utils/account';
22
import { Types } from '../../../utils/account/constants';
3+
import Secp256k1KeyIdentity from '../../identity/secpk256k1/identity';
34

5+
const getKeyPair = (identity: Secp256k1KeyIdentity) => {
6+
const jsonIdentity = identity.toJSON();
7+
return typeof jsonIdentity === 'string'
8+
? jsonIdentity
9+
: JSON.stringify(jsonIdentity);
10+
}
411

512
export default (storage: any) => {
613
const mnemonic = storage.mnemonic;
@@ -14,7 +21,7 @@ export default (storage: any) => {
1421
return ({
1522
...wallet,
1623
type: Types.mnemonic,
17-
keyPair: identity.toJSON(),
24+
keyPair: getKeyPair(identity),
1825
})
1926
})
2027
}

0 commit comments

Comments
 (0)