@docknetwork/wallet-sdk-wasm 1.5.9 → 1.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/format-utils.js +0 -28
- package/lib/core/format-utils.mjs +1 -24
- package/lib/core/validation.js +1 -24
- package/lib/core/validation.mjs +2 -21
- package/lib/index.js +13 -23
- package/lib/index.mjs +13 -23
- package/lib/rpc-server.js +13 -23
- package/lib/rpc-server.mjs +13 -23
- package/lib/rpc-util.js +14 -0
- package/lib/rpc-util.mjs +14 -0
- package/lib/services/blockchain/index.js +3 -6
- package/lib/services/blockchain/index.mjs +3 -6
- package/lib/services/blockchain/service.js +5 -9
- package/lib/services/blockchain/service.mjs +5 -9
- package/lib/services/credential/bbs-revocation.js +4 -7
- package/lib/services/credential/bbs-revocation.mjs +3 -6
- package/lib/services/credential/bound-check.js +9 -4
- package/lib/services/credential/bound-check.mjs +9 -4
- package/lib/services/credential/index.js +11 -13
- package/lib/services/credential/index.mjs +11 -13
- package/lib/services/credential/service.js +18 -18
- package/lib/services/credential/service.mjs +15 -15
- package/lib/services/credential/utils.js +59 -28
- package/lib/services/credential/utils.mjs +62 -32
- package/lib/services/dids/index.js +7 -25
- package/lib/services/dids/index.mjs +7 -25
- package/lib/services/dids/keypair-utils.js +142 -0
- package/lib/services/dids/keypair-utils.mjs +113 -0
- package/lib/services/dids/service-rpc.js +0 -3
- package/lib/services/dids/service-rpc.mjs +0 -3
- package/lib/services/dids/service.js +13 -55
- package/lib/services/dids/service.mjs +13 -54
- package/lib/services/edv/index.js +4 -25
- package/lib/services/edv/index.mjs +4 -25
- package/lib/services/edv/service.js +6 -33
- package/lib/services/edv/service.mjs +6 -33
- package/lib/services/index.js +13 -25
- package/lib/services/index.mjs +13 -25
- package/lib/services/relay-service/configs.js +0 -1
- package/lib/services/relay-service/configs.mjs +0 -1
- package/lib/services/relay-service/index.android.js +0 -1
- package/lib/services/relay-service/index.android.mjs +0 -1
- package/lib/services/relay-service/index.ios.js +0 -1
- package/lib/services/relay-service/index.ios.mjs +0 -1
- package/lib/services/relay-service/index.js +0 -1
- package/lib/services/relay-service/index.mjs +0 -1
- package/lib/services/relay-service/service-rpc.js +0 -1
- package/lib/services/relay-service/service-rpc.mjs +0 -1
- package/lib/services/relay-service/service.js +0 -1
- package/lib/services/relay-service/service.mjs +0 -1
- package/lib/services/test-utils.js +0 -44
- package/lib/services/test-utils.mjs +1 -44
- package/lib/services/util-crypto/configs.js +0 -12
- package/lib/services/util-crypto/configs.mjs +0 -12
- package/lib/services/util-crypto/index.android.js +0 -3
- package/lib/services/util-crypto/index.android.mjs +0 -3
- package/lib/services/util-crypto/index.ios.js +0 -3
- package/lib/services/util-crypto/index.ios.mjs +0 -3
- package/lib/services/util-crypto/index.js +4 -7
- package/lib/services/util-crypto/index.mjs +4 -7
- package/lib/services/util-crypto/service-rpc.js +2 -30
- package/lib/services/util-crypto/service-rpc.mjs +2 -30
- package/lib/services/util-crypto/service.js +68 -61
- package/lib/services/util-crypto/service.mjs +50 -59
- package/lib/services/wallet/configs.js +0 -63
- package/lib/services/wallet/configs.mjs +1 -64
- package/lib/services/wallet/index.android.js +0 -1
- package/lib/services/wallet/index.android.mjs +0 -1
- package/lib/services/wallet/index.ios.js +0 -1
- package/lib/services/wallet/index.ios.mjs +0 -1
- package/lib/services/wallet/index.js +2 -12
- package/lib/services/wallet/index.mjs +2 -12
- package/lib/services/wallet/service-rpc.js +0 -77
- package/lib/services/wallet/service-rpc.mjs +0 -77
- package/lib/services/wallet/service.js +1 -215
- package/lib/services/wallet/service.mjs +1 -211
- package/lib/setup-nodejs.js +13 -23
- package/lib/setup-nodejs.mjs +13 -23
- package/lib/setup-tests.js +13 -23
- package/lib/setup-tests.mjs +13 -23
- package/lib/src/core/format-utils.d.ts +0 -5
- package/lib/src/core/format-utils.d.ts.map +1 -1
- package/lib/src/core/validation.d.ts +0 -3
- package/lib/src/core/validation.d.ts.map +1 -1
- package/lib/src/rpc-util.d.ts.map +1 -1
- package/lib/src/services/blockchain/service.d.ts.map +1 -1
- package/lib/src/services/credential/bbs-revocation.d.ts.map +1 -1
- package/lib/src/services/credential/bound-check.d.ts +1 -1
- package/lib/src/services/credential/bound-check.d.ts.map +1 -1
- package/lib/src/services/credential/service.d.ts.map +1 -1
- package/lib/src/services/credential/utils.d.ts +2 -1
- package/lib/src/services/credential/utils.d.ts.map +1 -1
- package/lib/src/services/dids/keypair-utils.d.ts +15 -0
- package/lib/src/services/dids/keypair-utils.d.ts.map +1 -0
- package/lib/src/services/dids/service-rpc.d.ts +0 -1
- package/lib/src/services/dids/service-rpc.d.ts.map +1 -1
- package/lib/src/services/dids/service.d.ts +11 -8
- package/lib/src/services/dids/service.d.ts.map +1 -1
- package/lib/src/services/edv/service.d.ts.map +1 -1
- package/lib/src/services/util-crypto/configs.d.ts +0 -3
- package/lib/src/services/util-crypto/configs.d.ts.map +1 -1
- package/lib/src/services/util-crypto/service.d.ts +3 -8
- package/lib/src/services/util-crypto/service.d.ts.map +1 -1
- package/lib/src/services/wallet/configs.d.ts +13 -0
- package/lib/src/services/wallet/configs.d.ts.map +1 -0
- package/lib/src/services/wallet/service.d.ts +1 -44
- package/lib/src/services/wallet/service.d.ts.map +1 -1
- package/lib/test-utils.js +0 -4
- package/lib/test-utils.mjs +1 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -25
- package/readme.md +0 -61
- package/src/core/format-utils.test.js +1 -28
- package/src/core/format-utils.ts +0 -33
- package/src/core/validation.test.js +1 -33
- package/src/core/validation.ts +1 -25
- package/src/rpc-server.test.js +2 -9
- package/src/rpc-util.js +14 -0
- package/src/services/blockchain/service.ts +2 -3
- package/src/services/credential/bbs-revocation.ts +2 -1
- package/src/services/credential/bound-check.test.ts +6 -6
- package/src/services/credential/bound-check.ts +4 -4
- package/src/services/credential/index.test.js +0 -2
- package/src/services/credential/service.ts +5 -2
- package/src/services/credential/utils.js +65 -23
- package/src/services/dids/index.test.js +45 -33
- package/src/services/dids/keypair-utils.js +111 -0
- package/src/services/dids/service-rpc.ts +0 -3
- package/src/services/dids/service.ts +7 -34
- package/src/services/edv/service.ts +2 -9
- package/src/services/index.js +0 -4
- package/src/services/test-utils.js +0 -29
- package/src/services/util-crypto/configs.ts +0 -12
- package/src/services/util-crypto/index.test.js +6 -83
- package/src/services/util-crypto/service-rpc.js +2 -27
- package/src/services/util-crypto/service.ts +62 -75
- package/src/services/wallet/configs.ts +1 -113
- package/src/services/wallet/index.test.js +0 -159
- package/src/services/wallet/service-rpc.js +1 -88
- package/src/services/wallet/service.ts +0 -258
- package/src/test-utils.js +0 -13
- package/lib/account-357ab05d.js +0 -742
- package/lib/account-399e6053.js +0 -752
- package/lib/core/polkadot-utils.js +0 -119
- package/lib/core/polkadot-utils.mjs +0 -94
- package/lib/core/realm-schemas.js +0 -50
- package/lib/core/realm-schemas.mjs +0 -44
- package/lib/core/subscan.js +0 -75
- package/lib/core/subscan.mjs +0 -64
- package/lib/fixtures.js +0 -56
- package/lib/fixtures.mjs +0 -52
- package/lib/modules/account.js +0 -48
- package/lib/modules/account.mjs +0 -40
- package/lib/modules/accounts.js +0 -49
- package/lib/modules/accounts.mjs +0 -40
- package/lib/modules/data-migration.js +0 -72
- package/lib/modules/data-migration.mjs +0 -68
- package/lib/modules/wallet-backup.js +0 -82
- package/lib/modules/wallet-backup.mjs +0 -71
- package/lib/modules/wallet.js +0 -49
- package/lib/modules/wallet.mjs +0 -40
- package/lib/services/example/configs.js +0 -21
- package/lib/services/example/configs.mjs +0 -13
- package/lib/services/example/index.js +0 -18
- package/lib/services/example/index.mjs +0 -14
- package/lib/services/example/service-rpc.js +0 -25
- package/lib/services/example/service-rpc.mjs +0 -21
- package/lib/services/example/service.js +0 -25
- package/lib/services/example/service.mjs +0 -20
- package/lib/services/keyring/configs.js +0 -70
- package/lib/services/keyring/configs.mjs +0 -61
- package/lib/services/keyring/index.android.js +0 -22
- package/lib/services/keyring/index.android.mjs +0 -18
- package/lib/services/keyring/index.ios.js +0 -22
- package/lib/services/keyring/index.ios.mjs +0 -18
- package/lib/services/keyring/index.js +0 -16
- package/lib/services/keyring/index.mjs +0 -8
- package/lib/services/keyring/service-rpc.js +0 -65
- package/lib/services/keyring/service-rpc.mjs +0 -61
- package/lib/services/keyring/service.js +0 -84
- package/lib/services/keyring/service.mjs +0 -74
- package/lib/services/polkadot/configs.js +0 -17
- package/lib/services/polkadot/configs.mjs +0 -13
- package/lib/services/polkadot/index.android.js +0 -22
- package/lib/services/polkadot/index.android.mjs +0 -18
- package/lib/services/polkadot/index.ios.js +0 -22
- package/lib/services/polkadot/index.ios.mjs +0 -18
- package/lib/services/polkadot/index.js +0 -15
- package/lib/services/polkadot/index.mjs +0 -7
- package/lib/services/polkadot/service-rpc.js +0 -30
- package/lib/services/polkadot/service-rpc.mjs +0 -26
- package/lib/services/polkadot/service.js +0 -28
- package/lib/services/polkadot/service.mjs +0 -23
- package/lib/src/core/polkadot-utils.d.ts +0 -11
- package/lib/src/core/polkadot-utils.d.ts.map +0 -1
- package/lib/src/modules/account.d.ts +0 -60
- package/lib/src/modules/account.d.ts.map +0 -1
- package/lib/src/modules/accounts.d.ts +0 -48
- package/lib/src/modules/accounts.d.ts.map +0 -1
- package/lib/src/modules/data-migration.d.ts +0 -7
- package/lib/src/modules/data-migration.d.ts.map +0 -1
- package/lib/src/modules/wallet-backup.d.ts +0 -12
- package/lib/src/modules/wallet-backup.d.ts.map +0 -1
- package/lib/src/modules/wallet.d.ts +0 -134
- package/lib/src/modules/wallet.d.ts.map +0 -1
- package/lib/src/services/blockchain/index.d.ts +0 -2
- package/lib/src/services/blockchain/index.d.ts.map +0 -1
- package/lib/src/services/example/configs.d.ts +0 -9
- package/lib/src/services/example/configs.d.ts.map +0 -1
- package/lib/src/services/example/service.d.ts +0 -8
- package/lib/src/services/example/service.d.ts.map +0 -1
- package/lib/src/services/keyring/configs.d.ts +0 -39
- package/lib/src/services/keyring/configs.d.ts.map +0 -1
- package/lib/src/services/keyring/index.d.ts +0 -2
- package/lib/src/services/keyring/index.d.ts.map +0 -1
- package/lib/src/services/polkadot/configs.d.ts +0 -8
- package/lib/src/services/polkadot/configs.d.ts.map +0 -1
- package/lib/src/services/polkadot/index.d.ts +0 -2
- package/lib/src/services/polkadot/index.d.ts.map +0 -1
- package/lib/src/services/polkadot/service.d.ts +0 -8
- package/lib/src/services/polkadot/service.d.ts.map +0 -1
- package/lib/src/services/wallet/index.d.ts +0 -2
- package/lib/src/services/wallet/index.d.ts.map +0 -1
- package/lib/test/axiosMocks.js +0 -431
- package/lib/test/axiosMocks.mjs +0 -420
- package/lib/test/setup-test-state.js +0 -81
- package/lib/test/setup-test-state.mjs +0 -73
- package/src/core/polkadot-utils.js +0 -99
- package/src/core/realm-schemas.js +0 -42
- package/src/core/subscan.js +0 -62
- package/src/core/subscan.test.js +0 -56
- package/src/fixtures.js +0 -43
- package/src/modules/account.test.js +0 -56
- package/src/modules/account.ts +0 -128
- package/src/modules/accounts.test.js +0 -63
- package/src/modules/accounts.ts +0 -231
- package/src/modules/data-migration.test.js +0 -61
- package/src/modules/data-migration.ts +0 -86
- package/src/modules/wallet-backup.test.js +0 -24
- package/src/modules/wallet-backup.ts +0 -68
- package/src/modules/wallet.test.js +0 -216
- package/src/modules/wallet.ts +0 -424
- package/src/services/example/configs.js +0 -14
- package/src/services/example/index.js +0 -3
- package/src/services/example/index.test.js +0 -28
- package/src/services/example/service-rpc.js +0 -11
- package/src/services/example/service.ts +0 -18
- package/src/services/keyring/configs.ts +0 -110
- package/src/services/keyring/index.android.js +0 -3
- package/src/services/keyring/index.ios.js +0 -3
- package/src/services/keyring/index.js +0 -1
- package/src/services/keyring/index.test.js +0 -48
- package/src/services/keyring/service-rpc.js +0 -56
- package/src/services/keyring/service.ts +0 -111
- package/src/services/polkadot/configs.ts +0 -13
- package/src/services/polkadot/index.android.js +0 -3
- package/src/services/polkadot/index.ios.js +0 -3
- package/src/services/polkadot/index.js +0 -1
- package/src/services/polkadot/index.test.js +0 -52
- package/src/services/polkadot/service-rpc.js +0 -13
- package/src/services/polkadot/service.ts +0 -21
- package/src/test/axiosMocks.js +0 -20
- package/src/test/fixtures/subscan-failure.json +0 -5
- package/src/test/fixtures/subscan-success.json +0 -370
- package/src/test/fixtures/subscan-too-many-requests.json +0 -9
- package/src/test/setup-test-state.js +0 -35
- package/src/test/test-wallet.test.js +0 -15
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import {Wallet} from './wallet';
|
|
2
|
-
import walletLegacyData from '../test/fixtures/legacy-wallet-schema.json';
|
|
3
|
-
|
|
4
|
-
describe('DataMigration', () => {
|
|
5
|
-
describe('migrate wallet from v0.1 to v0.2 (file1)', () => {
|
|
6
|
-
let wallet: Wallet;
|
|
7
|
-
|
|
8
|
-
beforeAll(async () => {
|
|
9
|
-
global.localStorage.setItem(
|
|
10
|
-
'import-test',
|
|
11
|
-
JSON.stringify(walletLegacyData),
|
|
12
|
-
);
|
|
13
|
-
wallet = await Wallet.create({walletId: 'import-test'});
|
|
14
|
-
await wallet.load();
|
|
15
|
-
await wallet.ensureNetwork();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// TODO: Check why test is failing
|
|
19
|
-
// it('expect to migrate accounts', async () => {
|
|
20
|
-
// const accounts = await wallet.accounts.getAccounts();
|
|
21
|
-
// expect(accounts.length).toBe(3);
|
|
22
|
-
// expect(wallet.migrated).toBeTruthy();
|
|
23
|
-
// });
|
|
24
|
-
|
|
25
|
-
it('expect wallet version to be the latest', async () => {
|
|
26
|
-
const version = await wallet.getVersion();
|
|
27
|
-
expect(version).toBe('0.2');
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('expect not to migrate v0.2 wallet', async () => {
|
|
32
|
-
global.localStorage.setItem('dock-wallet', null);
|
|
33
|
-
const wallet = await Wallet.create();
|
|
34
|
-
|
|
35
|
-
await wallet.load();
|
|
36
|
-
await wallet.ensureNetwork();
|
|
37
|
-
|
|
38
|
-
const accounts = await wallet.accounts.getAccounts();
|
|
39
|
-
|
|
40
|
-
expect(accounts.length).toBe(0);
|
|
41
|
-
expect(wallet.migrated).toBeFalsy();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('expect to recover wallet from missing @context on documents', async () => {
|
|
45
|
-
global.localStorage.setItem(
|
|
46
|
-
'bad-documents',
|
|
47
|
-
JSON.stringify({
|
|
48
|
-
'doc:d4bd8145-4a56-456e-9b78-71509184f6ed': {
|
|
49
|
-
// bad context data
|
|
50
|
-
'@context': null,
|
|
51
|
-
id: '6ee76a80-bdf2-4cf8-9647-4897ed6feadd',
|
|
52
|
-
name: 'Account 1',
|
|
53
|
-
type: 'Address',
|
|
54
|
-
value: 'some address',
|
|
55
|
-
},
|
|
56
|
-
}),
|
|
57
|
-
);
|
|
58
|
-
const wallet = await Wallet.create({walletId: 'bad-documents'});
|
|
59
|
-
await wallet.load();
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import {Logger} from '../core/logger';
|
|
3
|
-
import {getStorage} from '../core/storage';
|
|
4
|
-
import {Wallet} from './wallet';
|
|
5
|
-
|
|
6
|
-
type MigrateParams = {
|
|
7
|
-
wallet: Wallet,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const currentWalletVersion = '0.2';
|
|
11
|
-
|
|
12
|
-
export async function migrate({wallet}: MigrateParams) {
|
|
13
|
-
Logger.debug('Starting wallet migration');
|
|
14
|
-
|
|
15
|
-
const docs = await wallet.query({});
|
|
16
|
-
|
|
17
|
-
if (!docs.length) {
|
|
18
|
-
Logger.debug(
|
|
19
|
-
`Empty wallet, adding version ${currentWalletVersion} document`,
|
|
20
|
-
);
|
|
21
|
-
await wallet.add({
|
|
22
|
-
type: 'Metadata',
|
|
23
|
-
walletVersion: currentWalletVersion,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const version = await wallet.getVersion();
|
|
28
|
-
let migrated = false;
|
|
29
|
-
|
|
30
|
-
Logger.debug(`Wallet version ${version}`);
|
|
31
|
-
|
|
32
|
-
if (version !== currentWalletVersion) {
|
|
33
|
-
const snapshot = await getStorage().getItem(wallet.walletId);
|
|
34
|
-
await getStorage().setItem(`${wallet.walletId}-snapshot`, snapshot);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (version === '0.1') {
|
|
38
|
-
const targetVersion = '0.2';
|
|
39
|
-
Logger.debug(`Migrating wallet ${version} to ${targetVersion}`);
|
|
40
|
-
const legacyAccounts = docs.filter((doc: any) => doc.type === 'Account');
|
|
41
|
-
await Promise.all(
|
|
42
|
-
legacyAccounts.map(async (account: any) => {
|
|
43
|
-
const relatedDocs = docs.filter(doc =>
|
|
44
|
-
account.correlation.find(id => id === doc.id),
|
|
45
|
-
);
|
|
46
|
-
const mnemonicDoc = relatedDocs.find(doc => doc.type === 'Mnemonic');
|
|
47
|
-
const keyPairDoc = relatedDocs.find(doc => doc.type === 'KeyPair');
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
if (mnemonicDoc) {
|
|
51
|
-
await wallet.remove(mnemonicDoc.id);
|
|
52
|
-
await wallet.remove(account.id);
|
|
53
|
-
await wallet.accounts.create({
|
|
54
|
-
mnemonic: mnemonicDoc.value,
|
|
55
|
-
name: account.meta.name,
|
|
56
|
-
type: account.meta.keypairType,
|
|
57
|
-
derivationPath: account.meta.derivationPath,
|
|
58
|
-
});
|
|
59
|
-
} else if (keyPairDoc) {
|
|
60
|
-
console.log(keyPairDoc);
|
|
61
|
-
await wallet.remove(keyPairDoc.id);
|
|
62
|
-
await wallet.remove(account.id);
|
|
63
|
-
await wallet.accounts.create({
|
|
64
|
-
name: account.meta.name,
|
|
65
|
-
json: keyPairDoc.value,
|
|
66
|
-
password: '',
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
} catch (err) {
|
|
70
|
-
Logger.error(`failed to migrate account ${account.id}`);
|
|
71
|
-
Logger.error(err);
|
|
72
|
-
throw err;
|
|
73
|
-
}
|
|
74
|
-
}),
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
await wallet.add({
|
|
78
|
-
type: 'Metadata',
|
|
79
|
-
walletVersion: `${targetVersion}`,
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
migrated = true;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return migrated;
|
|
86
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {getPromiseError} from '../services/test-utils';
|
|
2
|
-
import {walletService} from '../services/wallet/service';
|
|
3
|
-
import emptyBackup from '../test/fixtures/backup-files/empty-wallet-backup.json';
|
|
4
|
-
import {WalletBackup} from './wallet-backup';
|
|
5
|
-
|
|
6
|
-
describe('WalletBackup', () => {
|
|
7
|
-
describe('validate', () => {
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await walletService.create({
|
|
10
|
-
walletId: 'wallet',
|
|
11
|
-
type: 'memory',
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
await walletService.removeAll();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('expect to handle empty file', async () => {
|
|
18
|
-
const result = await getPromiseError(() =>
|
|
19
|
-
WalletBackup.getInstance().validate(emptyBackup, 'test'),
|
|
20
|
-
);
|
|
21
|
-
expect(result.message).toBeDefined();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import assert from 'assert';
|
|
3
|
-
import {walletService} from '../services/wallet/service';
|
|
4
|
-
|
|
5
|
-
export const invalidFileMessage = 'Invalid backup file';
|
|
6
|
-
export const noDocumentsFound = 'No documents found';
|
|
7
|
-
export const noAccountsFound = 'No accounts found';
|
|
8
|
-
|
|
9
|
-
export class WalletBackup {
|
|
10
|
-
async validate(data, password) {
|
|
11
|
-
assert(!!data.credentialSubject, invalidFileMessage);
|
|
12
|
-
|
|
13
|
-
await walletService.importWallet({json: data, password});
|
|
14
|
-
|
|
15
|
-
const docs = await walletService.query({});
|
|
16
|
-
|
|
17
|
-
console.log(docs);
|
|
18
|
-
|
|
19
|
-
if (docs.length === 0) {
|
|
20
|
-
throw new Error(noDocumentsFound);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const accounts = docs.filter(doc => doc.type === 'Account');
|
|
24
|
-
|
|
25
|
-
if (accounts.length === 0) {
|
|
26
|
-
console.log('no accounts found');
|
|
27
|
-
console.log(docs);
|
|
28
|
-
throw new Error(noAccountsFound);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const warnings = [];
|
|
32
|
-
|
|
33
|
-
for (let account of accounts) {
|
|
34
|
-
const correlationDocs = account.correlation.map(docId =>
|
|
35
|
-
docs.find(doc => doc.id === docId),
|
|
36
|
-
);
|
|
37
|
-
const hasMnemonic = correlationDocs.find(doc => doc.type === 'Mnemonic');
|
|
38
|
-
const hasKeyPair = correlationDocs.find(doc => doc.type === 'KeyPair');
|
|
39
|
-
|
|
40
|
-
if (!hasMnemonic && !hasKeyPair) {
|
|
41
|
-
warnings.push(`keypair not found for account ${account.id}`);
|
|
42
|
-
|
|
43
|
-
await walletService.update({
|
|
44
|
-
...account,
|
|
45
|
-
meta: {
|
|
46
|
-
...account.meta,
|
|
47
|
-
readOnly: true,
|
|
48
|
-
keypairNotFoundWarning: true,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
accounts,
|
|
56
|
-
warnings,
|
|
57
|
-
docs,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
static getInstance(): WalletBackup {
|
|
62
|
-
if (!WalletBackup.instance) {
|
|
63
|
-
WalletBackup.instance = new WalletBackup();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return WalletBackup.instance;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import {Wallet, WalletEvents} from './wallet';
|
|
2
|
-
import walletJson from '../test/fixtures/wallet-backup.json';
|
|
3
|
-
import {getTestWallet} from '../test/setup-test-state';
|
|
4
|
-
|
|
5
|
-
describe('ApiModule', () => {
|
|
6
|
-
describe('new wallet', () => {
|
|
7
|
-
let wallet: Wallet;
|
|
8
|
-
|
|
9
|
-
beforeAll(async () => {
|
|
10
|
-
wallet = await getTestWallet();
|
|
11
|
-
await wallet.ensureNetwork();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('is correct default params set', () => {
|
|
15
|
-
expect(wallet.walletId).toBe('wallet');
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('query', async () => {
|
|
19
|
-
const accounts = await wallet.query({
|
|
20
|
-
type: 'account',
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
expect(accounts.length).toBe(0);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('Expect document to be added', async () => {
|
|
27
|
-
const accounts = await wallet.query({
|
|
28
|
-
type: 'KeyringPair',
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
expect(accounts.length).toBe(3);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('Expect to upsert document', async () => {
|
|
35
|
-
jest.spyOn(wallet, 'getDocumentById');
|
|
36
|
-
jest.spyOn(wallet, 'add');
|
|
37
|
-
jest.spyOn(wallet, 'update');
|
|
38
|
-
|
|
39
|
-
await wallet.upsert({
|
|
40
|
-
id: 'test',
|
|
41
|
-
type: 'KeyringPair',
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
expect(wallet.getDocumentById).toBeCalled();
|
|
45
|
-
expect(wallet.add).toBeCalled();
|
|
46
|
-
|
|
47
|
-
await wallet.upsert({
|
|
48
|
-
id: 'test',
|
|
49
|
-
type: 'KeyringPair',
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
expect(wallet.update).toBeCalled();
|
|
53
|
-
expect(wallet.add).toBeCalledTimes(1);
|
|
54
|
-
|
|
55
|
-
const updatedDocument = await wallet.getDocumentById('test');
|
|
56
|
-
|
|
57
|
-
expect(updatedDocument['@context']).toBeDefined();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('Expect document to be removed', async () => {
|
|
61
|
-
const document = await wallet.add({
|
|
62
|
-
type: 'Account',
|
|
63
|
-
name: 'cocomelon',
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
await wallet.remove(document.id);
|
|
67
|
-
|
|
68
|
-
const doc = await wallet.getDocumentById(document.id);
|
|
69
|
-
|
|
70
|
-
expect(doc).toBeUndefined();
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
afterAll(async () => {
|
|
74
|
-
await wallet.close();
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe('existing wallet', () => {
|
|
79
|
-
it('Expect to import wallet from backup file', async () => {
|
|
80
|
-
const password = 'test';
|
|
81
|
-
|
|
82
|
-
const wallet = await Wallet.create({
|
|
83
|
-
walletId: 'test',
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
wallet.eventManager.emit = jest.fn();
|
|
87
|
-
|
|
88
|
-
await wallet.importWallet({
|
|
89
|
-
json: walletJson,
|
|
90
|
-
password,
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
expect(wallet.eventManager.emit).toBeCalledWith(
|
|
94
|
-
WalletEvents.walletImported,
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
const docs = await wallet.query();
|
|
98
|
-
expect(docs.length).toBe(5);
|
|
99
|
-
|
|
100
|
-
const addressDoc = docs.find(doc => doc.type === 'Address');
|
|
101
|
-
|
|
102
|
-
expect(addressDoc.value).toBe(
|
|
103
|
-
'3AABk8Q165Cj4NpeCZdHH7JGYmDKUg7sZvSiiDD8SpBrABbg',
|
|
104
|
-
);
|
|
105
|
-
expect(addressDoc.name).toBe('test');
|
|
106
|
-
|
|
107
|
-
const keypairDoc = docs.find(doc => doc.type === 'KeyringPair');
|
|
108
|
-
expect(keypairDoc.value.encoded).toBe(
|
|
109
|
-
'MFMCAQEwBQYDK2VwBCIEIBA7v8oTxWqoUyV4dcXmxxcunhPWnEaw/W3CKcs2phBX8nxkJ21hUAySYJqVCiy/wcHwFjs7jPbop/vybbW9tM6hIwMhAKBqjm44EQyuODy9HTc61R3oylegEPPGaRyNMlGFO/Fi',
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
const mnemonicDoc = docs.find(doc => doc.type === 'Mnemonic');
|
|
113
|
-
expect(mnemonicDoc.value).toBe(
|
|
114
|
-
'tenant jaguar icon flock prosper leave island illegal topple pig axis cactus',
|
|
115
|
-
);
|
|
116
|
-
});
|
|
117
|
-
it('expect to get documents from encrypted wallets', async () => {
|
|
118
|
-
const wallet = await Wallet.create({
|
|
119
|
-
walletId: 'test',
|
|
120
|
-
});
|
|
121
|
-
const encryptedJSONWallet = {
|
|
122
|
-
'@context': [
|
|
123
|
-
'https://www.w3.org/2018/credentials/v1',
|
|
124
|
-
'https://w3id.org/wallet/v1',
|
|
125
|
-
],
|
|
126
|
-
id: 'did:key:z6LSjTbRETJjUCDiQopbeCgZKRisy7mdchwiMBPTQktcibGh#encrypted-wallet',
|
|
127
|
-
type: ['VerifiableCredential', 'EncryptedWallet'],
|
|
128
|
-
issuer: 'did:key:z6LSjTbRETJjUCDiQopbeCgZKRisy7mdchwiMBPTQktcibGh',
|
|
129
|
-
issuanceDate: '2022-07-19T20:59:44.798Z',
|
|
130
|
-
credentialSubject: {
|
|
131
|
-
id: 'did:key:z6LSjTbRETJjUCDiQopbeCgZKRisy7mdchwiMBPTQktcibGh',
|
|
132
|
-
encryptedWalletContents: {
|
|
133
|
-
protected: 'eyJlbmMiOiJYQzIwUCJ9',
|
|
134
|
-
recipients: [
|
|
135
|
-
{
|
|
136
|
-
header: {
|
|
137
|
-
kid: 'did:key:z6LSjTbRETJjUCDiQopbeCgZKRisy7mdchwiMBPTQktcibGh#z6LSjTbRETJjUCDiQopbeCgZKRisy7mdchwiMBPTQktcibGh',
|
|
138
|
-
alg: 'ECDH-ES+A256KW',
|
|
139
|
-
epk: {
|
|
140
|
-
kty: 'OKP',
|
|
141
|
-
crv: 'X25519',
|
|
142
|
-
x: '-ABoa59NY2qVI66NZ8EbqxCwp02sft5onyKhfa2yfUU',
|
|
143
|
-
},
|
|
144
|
-
apu: '-ABoa59NY2qVI66NZ8EbqxCwp02sft5onyKhfa2yfUU',
|
|
145
|
-
apv: 'ZGlkOmtleTp6NkxTalRiUkVUSmpVQ0RpUW9wYmVDZ1pLUmlzeTdtZGNod2lNQlBUUWt0Y2liR2gjejZMU2pUYlJFVEpqVUNEaVFvcGJlQ2daS1Jpc3k3bWRjaHdpTUJQVFFrdGNpYkdo',
|
|
146
|
-
},
|
|
147
|
-
encrypted_key:
|
|
148
|
-
'Mmf6YGug9bL-L4bi2UwS9R8nUk6bJmgVKJvP2_a0BwsjxtxBN0ly6w',
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
iv: '-u0i0V9ENM3rUwxj-Yv_7jd3veFLzVEO',
|
|
152
|
-
ciphertext:
|
|
153
|
-
'jahwvff1Afy19A9C4kP51nno-14Ea7m-omq39JGlG5_qmmEgrBcd0KsStpfDFKj4gMRR8izsALXqKz78vzhCRTd3RNa5rNOKbzfT3HALRkn1y7n6RlSRRZ0MKuBP9JVg49opLSqAIJ9j64Ebj2KhXALX6Wbv1h9FhAIhIxGkZJZDgKFQmpI54IGKS-J4_19gE2IcJrt7nYb_jXa9VwmmPbH-GDUFGVVbk3uoGCIcpxPSTiwEn7RSC2iSb_kARyOb7ft5546TKiODN-98QMV7lQTn4kZ59RqgC2w7rwDui85He_X21z0GcK9Ipkg5tRm5U7GNqzZtT3Ev952VOUW960istZ6s5gMpcngv0YMGBqnboYqHC3Uq22-ZRM7ya1ijJOi-UD0ozdGNrLs6kdAQWlvrGh7NAnpEdpBfxq_2CuxLZxTI8TGXfpXH39Nj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yU-3hdx1QJtTFcCT2EottF0XDx1nrmLM9t_ZpZRx06tOOhK-CQLYNouqaMkpIEuW-utycHuS6qW-dNX95b15r3z1wuLxBA7CxgjYHmswedWnvMNshEIcTLAAYHttSsUVRBVLNVllqKs9swEN2Klq1L0d8iW3KGkpiGfrPpVeobcwB9E2sPIZyjNPwxlQboVAU8evbuk6e4slGTJwnz0VvDpRDtqM9Kz0ndIcuaOoB9he57zi037Aup8C2G8_qATcBhka7SHfP8XJdlDjz7cU5ACl2Mt0FH1C6HPBJj_FKbWLxjPgM17vfeDqgI_R6Du05kTFpQuwyqtnXYk10bd-M50jIWfrlrX-pdSObjolCVEtuUt2lZvZahe0r2bg87Zbk3eFU9bI8eVtdosvSGtP9ZrKfe5BjrfMAC0XsKfWwoKT0JXznXD0Brw11PBQwsslusQOPI6HqskmmaE3NCkKB9a2Wnzs1eO1_Ompqbx_J7uoBphNMzlnrOQL74UVRifDqTFc_o0-rhp3EaXnlDnuOCbYwbOO7Ah3jX5OdU49Vnm-VHIB5_MAtYeEonVaMdSyXa1LXboy-LespvK9P7x1Zfnk5FW9SQCEa1cp7_dXD4h5ho7shKTzPLxbFShKQ_twsoP7JeMdZd1MNCtt_7B9Be-uRfGPwV2XQijME0xtq_8OMhbxFAJh-6MLVZqqKlDSw',
|
|
154
|
-
tag: 'kKoF2f10Da0kBqX2brBZug',
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
|
-
const docs = await wallet.getDocumentsFromEncryptedWallet({
|
|
159
|
-
encryptedJSONWallet,
|
|
160
|
-
password: 'test',
|
|
161
|
-
});
|
|
162
|
-
expect(docs.length).toBe(2);
|
|
163
|
-
});
|
|
164
|
-
it('expect to get documents from encrypted wallets with incorrect params', async () => {
|
|
165
|
-
const wallet = await Wallet.create({
|
|
166
|
-
walletId: 'test',
|
|
167
|
-
});
|
|
168
|
-
const encryptedJSONWallet = {
|
|
169
|
-
'@context': [
|
|
170
|
-
'https://www.w3.org/2018/credentials/v1',
|
|
171
|
-
'https://w3id.org/wallet/v1',
|
|
172
|
-
],
|
|
173
|
-
id: 'did:key:z6LSjTbRETJjUCDiQopbeCgZKRisy7mdchwiMBPTQktcibGh#encrypted-wallet',
|
|
174
|
-
type: ['VerifiableCredential', 'EncryptedWallet'],
|
|
175
|
-
issuer: 'did:key:z6LSjTbRETJjUCDiQopbeCgZKRisy7mdchwiMBPTQktcibGh',
|
|
176
|
-
issuanceDate: '2022-07-19T20:59:44.798Z',
|
|
177
|
-
credentialSubject: {
|
|
178
|
-
id: 'did:key:z6LSjTbRETJjUCDiQopbeCgZKRisy7mdchwiMBPTQktcibGh',
|
|
179
|
-
encryptedWalletContents: {
|
|
180
|
-
protected: 'eyJlbmMiOiJYQzIwUCJ9',
|
|
181
|
-
recipients: [
|
|
182
|
-
{
|
|
183
|
-
header: {
|
|
184
|
-
kid: 'did:key:z6LSjTbRETJjUCDiQopbeCgZKRisy7mdchwiMBPTQktcibGh#z6LSjTbRETJjUCDiQopbeCgZKRisy7mdchwiMBPTQktcibGh',
|
|
185
|
-
alg: 'ECDH-ES+A256KW',
|
|
186
|
-
epk: {
|
|
187
|
-
kty: 'OKP',
|
|
188
|
-
crv: 'X25519',
|
|
189
|
-
x: '-ABoa59NY2qVI66NZ8EbqxCwp02sft5onyKhfa2yfUU',
|
|
190
|
-
},
|
|
191
|
-
apu: '-ABoa59NY2qVI66NZ8EbqxCwp02sft5onyKhfa2yfUU',
|
|
192
|
-
apv: 'ZGlkOmtleTp6NkxTalRiUkVUSmpVQ0RpUW9wYmVDZ1pLUmlzeTdtZGNod2lNQlBUUWt0Y2liR2gjejZMU2pUYlJFVEpqVUNEaVFvcGJlQ2daS1Jpc3k3bWRjaHdpTUJQVFFrdGNpYkdo',
|
|
193
|
-
},
|
|
194
|
-
encrypted_key:
|
|
195
|
-
'Mmf6YGug9bL-L4bi2UwS9R8nUk6bJmgVKJvP2_a0BwsjxtxBN0ly6w',
|
|
196
|
-
},
|
|
197
|
-
],
|
|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VaMdSyXa1LXboy-LespvK9P7x1Zfnk5FW9SQCEa1cp7_dXD4h5ho7shKTzPLxbFShKQ_twsoP7JeMdZd1MNCtt_7B9Be-uRfGPwV2XQijME0xtq_8OMhbxFAJh-6MLVZqqKlDSw',
|
|
201
|
-
tag: 'kKoF2f10Da0kBqX2brBZug',
|
|
202
|
-
},
|
|
203
|
-
},
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
await expect(
|
|
207
|
-
wallet.getDocumentsFromEncryptedWallet({
|
|
208
|
-
encryptedJSONWallet,
|
|
209
|
-
password: '1test',
|
|
210
|
-
}),
|
|
211
|
-
).rejects.toThrowError(
|
|
212
|
-
'No matching recipient found for key agreement key.',
|
|
213
|
-
);
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
});
|