@docknetwork/wallet-sdk-wasm 1.5.0 → 1.5.8
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/modules/account.js +1 -1
- package/lib/modules/account.mjs +1 -1
- package/lib/modules/accounts.js +1 -1
- package/lib/modules/accounts.mjs +1 -1
- package/lib/modules/network-manager.js +4 -4
- package/lib/modules/network-manager.mjs +4 -4
- package/lib/modules/wallet.js +1 -1
- package/lib/modules/wallet.mjs +1 -1
- package/lib/services/edv/hmac.js +1 -2
- package/lib/services/edv/hmac.mjs +1 -2
- package/lib/services/edv/index.js +1 -1
- package/lib/services/edv/index.mjs +1 -1
- package/lib/services/edv/service-rpc.js +4 -0
- package/lib/services/edv/service-rpc.mjs +4 -0
- package/lib/services/edv/service.js +9 -4
- package/lib/services/edv/service.mjs +9 -3
- package/lib/src/services/edv/hmac.d.ts +1 -1
- package/lib/src/services/edv/hmac.d.ts.map +1 -1
- package/lib/src/services/edv/service.d.ts +3 -1
- package/lib/src/services/edv/service.d.ts.map +1 -1
- package/lib/test/setup-test-state.js +1 -1
- package/lib/test/setup-test-state.mjs +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -6
- package/src/modules/network-manager.ts +4 -4
- package/src/services/edv/hmac.ts +2 -3
- package/src/services/edv/index.test.js +7 -2
- package/src/services/edv/service-rpc.js +4 -0
- package/src/services/edv/service.ts +9 -3
- /package/lib/{account-e48dc9b6.js → account-8fa95046.js} +0 -0
- /package/lib/{account-bf00e5c0.js → account-e7156c51.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docknetwork/wallet-sdk-wasm",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"license": "https://github.com/docknetwork/react-native-sdk/LICENSE",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"build": "rm -rf lib && rollup -c && node ../../scripts/fix-build-imports.js ./lib"
|
|
14
14
|
},
|
|
15
15
|
"resolutions": {
|
|
16
|
+
"p-limit": "2.3.0",
|
|
16
17
|
"@polkadot/wasm-crypto": "6.3.1",
|
|
17
18
|
"@polkadot/rpc-core": "9.7.1",
|
|
18
19
|
"@polkadot/api": "9.7.1",
|
|
@@ -26,7 +27,11 @@
|
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"@astronautlabs/jsonpath": "^1.1.2",
|
|
28
29
|
"@docknetwork/universal-wallet": "^2.0.1",
|
|
29
|
-
"@docknetwork/wallet-sdk-dids": "^1.5.
|
|
30
|
+
"@docknetwork/wallet-sdk-dids": "^1.5.8",
|
|
31
|
+
"@cosmjs/proto-signing": "^0.32.4",
|
|
32
|
+
"@docknetwork/cheqd-blockchain-api": "0.36.1",
|
|
33
|
+
"@docknetwork/dock-blockchain-api": "0.23.0",
|
|
34
|
+
"@docknetwork/cheqd-blockchain-modules": "0.33.0",
|
|
30
35
|
"@polkadot/api": "9.7.1",
|
|
31
36
|
"@polkadot/keyring": "10.1.11",
|
|
32
37
|
"@polkadot/rpc-core": "9.7.1",
|
|
@@ -37,8 +42,8 @@
|
|
|
37
42
|
"@polkadot/util": "10.1.11",
|
|
38
43
|
"@polkadot/util-crypto": "10.1.11",
|
|
39
44
|
"@polkadot/wasm-crypto": "6.3.1",
|
|
40
|
-
"@docknetwork/credential-sdk": "0.
|
|
41
|
-
"@docknetwork/dock-blockchain-modules": "0.
|
|
45
|
+
"@docknetwork/credential-sdk": "0.50.0",
|
|
46
|
+
"@docknetwork/dock-blockchain-modules": "0.30.0",
|
|
42
47
|
"@sphereon/oid4vci-client": "^0.16.0",
|
|
43
48
|
"@sphereon/oid4vci-common": "^0.16.0",
|
|
44
49
|
"axios": "^0.25.0",
|
|
@@ -50,8 +55,7 @@
|
|
|
50
55
|
"winston": "^3.3.3",
|
|
51
56
|
"cwait": "1.1.2",
|
|
52
57
|
"axios-retry": "^3.2.5",
|
|
53
|
-
"@sphereon/pex": "^1.1.4"
|
|
54
|
-
"@docknetwork/dock-blockchain-api": "0.6.1"
|
|
58
|
+
"@sphereon/pex": "^1.1.4"
|
|
55
59
|
},
|
|
56
60
|
"devDependencies": {
|
|
57
61
|
"@babel/node": "^7.16.0",
|
|
@@ -12,16 +12,16 @@ export type NetworkId = 'mainnet' | 'testnet' | 'local' | 'custom';
|
|
|
12
12
|
|
|
13
13
|
export const SUBSTRATE_NETWORKS : Record<NetworkId, NetworkInfo> = {
|
|
14
14
|
mainnet: {
|
|
15
|
-
name: '
|
|
15
|
+
name: 'Cheqd Mainnet',
|
|
16
16
|
substrateUrl: null,
|
|
17
17
|
addressPrefix: 22,
|
|
18
|
-
cheqdApiUrl: 'https://mainnet.cheqd.docknode.io
|
|
18
|
+
cheqdApiUrl: 'https://mainnet.cheqd.docknode.io',
|
|
19
19
|
},
|
|
20
20
|
testnet: {
|
|
21
|
-
name: '
|
|
21
|
+
name: 'Cheqd Testnet',
|
|
22
22
|
substrateUrl: null,
|
|
23
23
|
addressPrefix: 21,
|
|
24
|
-
cheqdApiUrl: 'https://testnet.cheqd.docknode.io
|
|
24
|
+
cheqdApiUrl: 'https://testnet.cheqd.docknode.io',
|
|
25
25
|
},
|
|
26
26
|
local: {
|
|
27
27
|
name: 'Local Node',
|
package/src/services/edv/hmac.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as base64url from 'base64url-universal';
|
|
2
2
|
import crypto from '@docknetwork/universal-wallet/crypto';
|
|
3
|
-
import {hexToU8a} from '@polkadot/util';
|
|
4
3
|
|
|
5
4
|
export default class HMAC {
|
|
6
5
|
key: CryptoKey;
|
|
@@ -38,10 +37,10 @@ export default class HMAC {
|
|
|
38
37
|
return key;
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
static async deriveKey(baseKey:
|
|
40
|
+
static async deriveKey(baseKey: Uint8Array) {
|
|
42
41
|
const key = await crypto.subtle.importKey(
|
|
43
42
|
'raw',
|
|
44
|
-
|
|
43
|
+
baseKey,
|
|
45
44
|
{name: 'HMAC', hash: {name: 'SHA-256'}},
|
|
46
45
|
true,
|
|
47
46
|
['sign', 'verify'],
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import base64url from 'base64url-universal';
|
|
2
|
+
|
|
1
3
|
import {assertRpcService} from '../test-utils';
|
|
2
4
|
import {validation} from './configs';
|
|
3
5
|
import {edvService as service} from './service';
|
|
@@ -23,10 +25,13 @@ describe('EDVService', () => {
|
|
|
23
25
|
|
|
24
26
|
describe('deriveKeys', () => {
|
|
25
27
|
it('should derive EDV keys', async () => {
|
|
26
|
-
const testMasterKey =
|
|
28
|
+
const testMasterKey = new Uint8Array(
|
|
29
|
+
base64url.decode('0O+9vxwb3Zo/9AVcQfVeQ59wvgcYUVH/mTye6islspM='),
|
|
30
|
+
);
|
|
27
31
|
const derivedTestAgreementKey =
|
|
28
32
|
'{"id":"did:key:z6Mkt1paLGw6VqRCTmqjpbiP9fxLVHJb8k97zERL6TcWr9Ru#z6LSojEubzYtAGCBE7Mwwks7J3Gttsrd1c9EXcDuNjthwVQj","controller":"did:key:z6Mkt1paLGw6VqRCTmqjpbiP9fxLVHJb8k97zERL6TcWr9Ru","type":"X25519KeyAgreementKey2020","publicKeyMultibase":"z6LSojEubzYtAGCBE7Mwwks7J3Gttsrd1c9EXcDuNjthwVQj","privateKeyMultibase":"z3weoV5H5DppQ7pjABoopaiDFN6zH3SokESte2Jte87YNXgg"}';
|
|
29
|
-
const derivedTestHmacKey =
|
|
33
|
+
const derivedTestHmacKey =
|
|
34
|
+
'0O-9vxwb3Zo_9AVcQfVeQ59wvgcYUVH_mTye6islspM';
|
|
30
35
|
const derivedTestVerificationKey =
|
|
31
36
|
'{"id":"did:key:z6Mkt1paLGw6VqRCTmqjpbiP9fxLVHJb8k97zERL6TcWr9Ru#z6Mkt1paLGw6VqRCTmqjpbiP9fxLVHJb8k97zERL6TcWr9Ru","controller":"did:key:z6Mkt1paLGw6VqRCTmqjpbiP9fxLVHJb8k97zERL6TcWr9Ru","type":"Ed25519VerificationKey2018","publicKeyBase58":"EZZXk2gfAHvjMH1392kYJaQLfi2jirtmJDWQGBeVvveX","privateKeyBase58":"5BHUEjDDbDzQKnveM9qXXXmRqwTtmBvumTY2xZXN61x8dvZHgzsDaTpkVqkE4LSoMLcV6yDRhxcv7mMTzdaJ21pX"}';
|
|
32
37
|
const {agreementKey, hmacKey, verificationKey} =
|
|
@@ -10,7 +10,6 @@ import {logger} from '@docknetwork/wallet-sdk-data-store/src/logger';
|
|
|
10
10
|
import {didService} from '@docknetwork/wallet-sdk-wasm/src/services/dids/service';
|
|
11
11
|
import {keyringService} from '@docknetwork/wallet-sdk-wasm/src/services/keyring';
|
|
12
12
|
import {ed25519PairFromSeed} from '@polkadot/util-crypto';
|
|
13
|
-
import base64url from 'base64url-universal';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* EDVService
|
|
@@ -19,10 +18,12 @@ export class EDVService {
|
|
|
19
18
|
storageInterface: EDVHTTPStorageInterface;
|
|
20
19
|
|
|
21
20
|
private insertQueue: Promise<any> = Promise.resolve();
|
|
21
|
+
public controller: string;
|
|
22
22
|
|
|
23
23
|
rpcMethods = [
|
|
24
24
|
EDVService.prototype.generateKeys,
|
|
25
25
|
EDVService.prototype.deriveKeys,
|
|
26
|
+
EDVService.prototype.getController,
|
|
26
27
|
EDVService.prototype.initialize,
|
|
27
28
|
EDVService.prototype.find,
|
|
28
29
|
EDVService.prototype.update,
|
|
@@ -51,6 +52,7 @@ export class EDVService {
|
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
const {controller} = verificationKey;
|
|
55
|
+
this.controller = controller;
|
|
54
56
|
const invocationSigner = getKeypairFromDoc(verificationKey);
|
|
55
57
|
invocationSigner.sign = invocationSigner.signer().sign;
|
|
56
58
|
|
|
@@ -113,11 +115,11 @@ export class EDVService {
|
|
|
113
115
|
return {verificationKey, agreementKey, hmacKey};
|
|
114
116
|
}
|
|
115
117
|
|
|
116
|
-
async deriveKeys(masterKey:
|
|
118
|
+
async deriveKeys(masterKey: Uint8Array) {
|
|
117
119
|
await keyringService.initialize({
|
|
118
120
|
ss58Format: 22,
|
|
119
121
|
});
|
|
120
|
-
const pair = ed25519PairFromSeed(
|
|
122
|
+
const pair = ed25519PairFromSeed(masterKey);
|
|
121
123
|
|
|
122
124
|
const keyPair = await didService.deriveKeyDoc({ pair });
|
|
123
125
|
|
|
@@ -131,6 +133,10 @@ export class EDVService {
|
|
|
131
133
|
return { verificationKey, agreementKey, hmacKey };
|
|
132
134
|
}
|
|
133
135
|
|
|
136
|
+
async getController() {
|
|
137
|
+
return this.controller;
|
|
138
|
+
}
|
|
139
|
+
|
|
134
140
|
find(params: any) {
|
|
135
141
|
return this.storageInterface.find(params);
|
|
136
142
|
}
|
|
File without changes
|
|
File without changes
|