@interop/wallet-core 0.2.0 → 0.3.0
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/README.md +12 -4
- package/dist/identity/agents.d.ts +68 -0
- package/dist/identity/agents.d.ts.map +1 -0
- package/dist/identity/agents.js +95 -0
- package/dist/identity/agents.js.map +1 -0
- package/dist/identity/index.d.ts +20 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +19 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/keyResolver.d.ts +30 -0
- package/dist/identity/keyResolver.d.ts.map +1 -0
- package/dist/identity/keyResolver.js +25 -0
- package/dist/identity/keyResolver.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +11 -2
package/README.md
CHANGED
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
wallet apps (a React Native mobile wallet and a browser wallet) hold in common:
|
|
21
21
|
the cross-replica byte-compatibility surface both must agree on to converge on
|
|
22
22
|
identical bytes. It is isomorphic (browser, Node.js, React Native) and has no
|
|
23
|
-
UI
|
|
23
|
+
UI or storage dependencies -- side effects are injected, and the dep-heavier
|
|
24
|
+
protocol subpaths are import-directly-only.
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
Five subpaths:
|
|
26
27
|
|
|
27
28
|
- **`@interop/wallet-core/sync`** -- the Wallet Attached Storage (WAS)
|
|
28
29
|
replication engine core: the `SyncEngine` orchestration (single-flight,
|
|
@@ -39,6 +40,13 @@ Four subpaths:
|
|
|
39
40
|
derivation, and the `was-link` QR hand-off contract. Contacts collection specs
|
|
40
41
|
live in [`@interop/social-core`](https://npm.im/@interop/social-core).
|
|
41
42
|
|
|
43
|
+
- **`@interop/wallet-core/identity`** -- the WAS identity derivation both
|
|
44
|
+
wallet apps must perform byte-for-byte identically: `agentsFromSecret` /
|
|
45
|
+
`agentsFromSeed` (controller secret or 32-byte seed to the did:key
|
|
46
|
+
`CapabilityAgent`, `ZcapClient`, X25519 key agreement key, and single-key
|
|
47
|
+
resolver, under the fixed bootstrap handle / key name) and
|
|
48
|
+
`singleKeyResolver`.
|
|
49
|
+
|
|
42
50
|
- **`@interop/wallet-core/request`** -- wallet-request / exchange protocol
|
|
43
51
|
handling: request classification and parsing (CHAPI get/store events,
|
|
44
52
|
wallet-api messages and URLs), QueryByExample matching, cryptosuite
|
|
@@ -83,8 +91,8 @@ import {
|
|
|
83
91
|
```
|
|
84
92
|
|
|
85
93
|
The `sync` and `space` subpaths are re-exported from the package root as well.
|
|
86
|
-
`request
|
|
87
|
-
pull the signing / document-loader dependency graph.
|
|
94
|
+
`identity`, `request`, and `display` are import-directly-only, so consumers of
|
|
95
|
+
the root never pull the signing / KMS / document-loader dependency graph.
|
|
88
96
|
|
|
89
97
|
## Contribute
|
|
90
98
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* WAS identity derivation: controller secret / seed to the agent set a wallet
|
|
6
|
+
* profile operates with. Both wallet apps must derive byte-for-byte
|
|
7
|
+
* identically, so that supplying the same controller secret on any device
|
|
8
|
+
* joins the same WAS account/Space.
|
|
9
|
+
*
|
|
10
|
+
* The derivation: secret or 32-byte seed enters `CapabilityAgent` under the
|
|
11
|
+
* fixed `'bootstrap'` / `'boostrap-key'` names (the typo is load-bearing --
|
|
12
|
+
* every account's data identity derives through these exact strings, so they
|
|
13
|
+
* can never change without stranding existing wallets). The resulting Ed25519
|
|
14
|
+
* signing key backs a did:key DID, a `ZcapClient` for signing storage
|
|
15
|
+
* requests, and -- via did:key's encryption-key derivation (the Montgomery
|
|
16
|
+
* form of the signing key) -- the X25519 key agreement key (KAK) the EDV
|
|
17
|
+
* DocCipher encrypts and decrypts with. Everything is deterministic: a
|
|
18
|
+
* returning user, on any device, decrypts the same envelopes.
|
|
19
|
+
*/
|
|
20
|
+
import { CapabilityAgent } from '@interop/webkms-client';
|
|
21
|
+
import { ZcapClient } from '@interop/ezcap';
|
|
22
|
+
import type { IKeyAgreementKey, IKeyResolver } from '@interop/data-integrity-core';
|
|
23
|
+
/**
|
|
24
|
+
* The load-bearing `CapabilityAgent` derivation names (see the module doc:
|
|
25
|
+
* the typo in the key name can never be fixed without stranding wallets).
|
|
26
|
+
*/
|
|
27
|
+
export declare const BOOTSTRAP_HANDLE = "bootstrap";
|
|
28
|
+
export declare const BOOTSTRAP_KEY_NAME = "boostrap-key";
|
|
29
|
+
/**
|
|
30
|
+
* The agents derived from a controller secret or seed: the signing
|
|
31
|
+
* CapabilityAgent / did:key, a ZcapClient for signing storage requests, and
|
|
32
|
+
* the X25519 key agreement key (KAK) + resolver used by the EDV DocCipher.
|
|
33
|
+
*/
|
|
34
|
+
export interface ProfileAgents {
|
|
35
|
+
controllerDid: string;
|
|
36
|
+
keyAgent: CapabilityAgent;
|
|
37
|
+
zcapClient: ZcapClient;
|
|
38
|
+
keyAgreementKey: IKeyAgreementKey;
|
|
39
|
+
keyResolver: IKeyResolver;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Derives the WAS agents from an already-derived 32-byte seed, skipping the
|
|
43
|
+
* salted-hash step (`CapabilityAgent.fromSeed` semantics: a stored seed
|
|
44
|
+
* stands in for the original secret).
|
|
45
|
+
*
|
|
46
|
+
* @param options {object}
|
|
47
|
+
* @param options.seed {Uint8Array} the 32-byte seed
|
|
48
|
+
* @returns {Promise<ProfileAgents>}
|
|
49
|
+
*/
|
|
50
|
+
export declare function agentsFromSeed({ seed }: {
|
|
51
|
+
seed: Uint8Array;
|
|
52
|
+
}): Promise<ProfileAgents>;
|
|
53
|
+
/**
|
|
54
|
+
* Derives the WAS agents from a controller secret. **The secret is ALWAYS a
|
|
55
|
+
* string** (a passphrase, or the base64url TEXT of 32 random bytes -- never
|
|
56
|
+
* the decoded bytes): `CapabilityAgent.fromSecret`'s salted hash is
|
|
57
|
+
* type-sensitive, so a string and its UTF-8 bytes derive different keys.
|
|
58
|
+
* Passing a string keeps every secret typeable/scannable into a login form
|
|
59
|
+
* (the cross-wallet linking flow).
|
|
60
|
+
*
|
|
61
|
+
* @param options {object}
|
|
62
|
+
* @param options.secret {string} the controller secret (see above)
|
|
63
|
+
* @returns {Promise<ProfileAgents>}
|
|
64
|
+
*/
|
|
65
|
+
export declare function agentsFromSecret({ secret }: {
|
|
66
|
+
secret: string;
|
|
67
|
+
}): Promise<ProfileAgents>;
|
|
68
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/identity/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AAGrC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAA;AAC3C,eAAO,MAAM,kBAAkB,iBAAiB,CAAA;AAEhD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,eAAe,CAAA;IACzB,UAAU,EAAE,UAAU,CAAA;IACtB,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,EACnC,IAAI,EACL,EAAE;IACD,IAAI,EAAE,UAAU,CAAA;CACjB,GAAG,OAAO,CAAC,aAAa,CAAC,CAOzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,MAAM,EACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;CACf,GAAG,OAAO,CAAC,aAAa,CAAC,CAOzB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* WAS identity derivation: controller secret / seed to the agent set a wallet
|
|
6
|
+
* profile operates with. Both wallet apps must derive byte-for-byte
|
|
7
|
+
* identically, so that supplying the same controller secret on any device
|
|
8
|
+
* joins the same WAS account/Space.
|
|
9
|
+
*
|
|
10
|
+
* The derivation: secret or 32-byte seed enters `CapabilityAgent` under the
|
|
11
|
+
* fixed `'bootstrap'` / `'boostrap-key'` names (the typo is load-bearing --
|
|
12
|
+
* every account's data identity derives through these exact strings, so they
|
|
13
|
+
* can never change without stranding existing wallets). The resulting Ed25519
|
|
14
|
+
* signing key backs a did:key DID, a `ZcapClient` for signing storage
|
|
15
|
+
* requests, and -- via did:key's encryption-key derivation (the Montgomery
|
|
16
|
+
* form of the signing key) -- the X25519 key agreement key (KAK) the EDV
|
|
17
|
+
* DocCipher encrypts and decrypts with. Everything is deterministic: a
|
|
18
|
+
* returning user, on any device, decrypts the same envelopes.
|
|
19
|
+
*/
|
|
20
|
+
import { CapabilityAgent } from '@interop/webkms-client';
|
|
21
|
+
import { Ed25519Signature2020 } from '@interop/ed25519-signature';
|
|
22
|
+
import { ZcapClient } from '@interop/ezcap';
|
|
23
|
+
import { X25519KeyAgreementKey2020 } from '@interop/x25519-key-agreement-key';
|
|
24
|
+
import { singleKeyResolver } from './keyResolver.js';
|
|
25
|
+
/**
|
|
26
|
+
* The load-bearing `CapabilityAgent` derivation names (see the module doc:
|
|
27
|
+
* the typo in the key name can never be fixed without stranding wallets).
|
|
28
|
+
*/
|
|
29
|
+
export const BOOTSTRAP_HANDLE = 'bootstrap';
|
|
30
|
+
export const BOOTSTRAP_KEY_NAME = 'boostrap-key';
|
|
31
|
+
/**
|
|
32
|
+
* Derives the WAS agents from an already-derived 32-byte seed, skipping the
|
|
33
|
+
* salted-hash step (`CapabilityAgent.fromSeed` semantics: a stored seed
|
|
34
|
+
* stands in for the original secret).
|
|
35
|
+
*
|
|
36
|
+
* @param options {object}
|
|
37
|
+
* @param options.seed {Uint8Array} the 32-byte seed
|
|
38
|
+
* @returns {Promise<ProfileAgents>}
|
|
39
|
+
*/
|
|
40
|
+
export async function agentsFromSeed({ seed }) {
|
|
41
|
+
const keyAgent = await CapabilityAgent.fromSeed({
|
|
42
|
+
seed,
|
|
43
|
+
handle: BOOTSTRAP_HANDLE,
|
|
44
|
+
keyName: BOOTSTRAP_KEY_NAME
|
|
45
|
+
});
|
|
46
|
+
return agentsFromKeyAgent({ keyAgent });
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Derives the WAS agents from a controller secret. **The secret is ALWAYS a
|
|
50
|
+
* string** (a passphrase, or the base64url TEXT of 32 random bytes -- never
|
|
51
|
+
* the decoded bytes): `CapabilityAgent.fromSecret`'s salted hash is
|
|
52
|
+
* type-sensitive, so a string and its UTF-8 bytes derive different keys.
|
|
53
|
+
* Passing a string keeps every secret typeable/scannable into a login form
|
|
54
|
+
* (the cross-wallet linking flow).
|
|
55
|
+
*
|
|
56
|
+
* @param options {object}
|
|
57
|
+
* @param options.secret {string} the controller secret (see above)
|
|
58
|
+
* @returns {Promise<ProfileAgents>}
|
|
59
|
+
*/
|
|
60
|
+
export async function agentsFromSecret({ secret }) {
|
|
61
|
+
const keyAgent = await CapabilityAgent.fromSecret({
|
|
62
|
+
secret,
|
|
63
|
+
handle: BOOTSTRAP_HANDLE,
|
|
64
|
+
keyName: BOOTSTRAP_KEY_NAME
|
|
65
|
+
});
|
|
66
|
+
return agentsFromKeyAgent({ keyAgent });
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The shared tail of both derivations: ZcapClient + KAK + resolver from the
|
|
70
|
+
* bootstrap CapabilityAgent.
|
|
71
|
+
*/
|
|
72
|
+
function agentsFromKeyAgent({ keyAgent }) {
|
|
73
|
+
const signer = keyAgent.getSigner();
|
|
74
|
+
const zcapClient = new ZcapClient({
|
|
75
|
+
SuiteClass: Ed25519Signature2020,
|
|
76
|
+
invocationSigner: signer,
|
|
77
|
+
// The root key also signs delegations (sharing grants, app capability
|
|
78
|
+
// grants).
|
|
79
|
+
delegationSigner: signer
|
|
80
|
+
});
|
|
81
|
+
const keyAgreementKey = X25519KeyAgreementKey2020.fromEd25519VerificationKey2020({
|
|
82
|
+
keyPair: keyAgent.getVerificationKeyPair()
|
|
83
|
+
});
|
|
84
|
+
const keyResolver = singleKeyResolver({ keyAgreementKey });
|
|
85
|
+
return {
|
|
86
|
+
controllerDid: keyAgent.id,
|
|
87
|
+
keyAgent,
|
|
88
|
+
zcapClient,
|
|
89
|
+
// `id` is always set on the KAK here (a controller was supplied at
|
|
90
|
+
// derivation), so it satisfies IKeyAgreementKey's required `id`.
|
|
91
|
+
keyAgreementKey: keyAgreementKey,
|
|
92
|
+
keyResolver
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/identity/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAK7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAA;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAA;AAehD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,IAAI,EAGL;IACC,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC;QAC9C,IAAI;QACJ,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,kBAAkB;KAC5B,CAAC,CAAA;IACF,OAAO,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;AACzC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,MAAM,EAGP;IACC,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC;QAChD,MAAM;QACN,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,kBAAkB;KAC5B,CAAC,CAAA;IACF,OAAO,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;AACzC,CAAC;AAED;;;GAGG;AACH,SAAS,kBAAkB,CAAC,EAC1B,QAAQ,EAGT;IACC,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAA;IACnC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC;QAChC,UAAU,EAAE,oBAAoB;QAChC,gBAAgB,EAAE,MAAM;QACxB,sEAAsE;QACtE,WAAW;QACX,gBAAgB,EAAE,MAAM;KACzB,CAAC,CAAA;IAEF,MAAM,eAAe,GACnB,yBAAyB,CAAC,8BAA8B,CAAC;QACvD,OAAO,EAAE,QAAQ,CAAC,sBAAsB,EAAE;KAC3C,CAAC,CAAA;IACJ,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC,CAAA;IAE1D,OAAO;QACL,aAAa,EAAE,QAAQ,CAAC,EAAE;QAC1B,QAAQ;QACR,UAAU;QACV,mEAAmE;QACnE,iEAAiE;QACjE,eAAe,EAAE,eAAmC;QACpD,WAAW;KACZ,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The `@interop/wallet-core/identity` subpath: the WAS identity derivation
|
|
6
|
+
* both wallet apps must perform byte-for-byte identically.
|
|
7
|
+
*
|
|
8
|
+
* - `agentsFromSecret` / `agentsFromSeed` -- controller secret or 32-byte seed
|
|
9
|
+
* to `ProfileAgents` (did:key CapabilityAgent, ZcapClient, X25519 KAK,
|
|
10
|
+
* single-key resolver) under the fixed bootstrap handle / key name.
|
|
11
|
+
* - `singleKeyResolver` -- the one-key `IKeyResolver` factory (also used by
|
|
12
|
+
* app-side derivations such as a keyring unlock identity).
|
|
13
|
+
*
|
|
14
|
+
* Kept out of the root export: this subpath pulls the webkms-client / ezcap /
|
|
15
|
+
* x25519 dependency graph (the same isolation pattern as `./request`).
|
|
16
|
+
*/
|
|
17
|
+
export { BOOTSTRAP_HANDLE, BOOTSTRAP_KEY_NAME, agentsFromSecret, agentsFromSeed } from './agents.js';
|
|
18
|
+
export type { ProfileAgents } from './agents.js';
|
|
19
|
+
export { singleKeyResolver } from './keyResolver.js';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACf,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The `@interop/wallet-core/identity` subpath: the WAS identity derivation
|
|
6
|
+
* both wallet apps must perform byte-for-byte identically.
|
|
7
|
+
*
|
|
8
|
+
* - `agentsFromSecret` / `agentsFromSeed` -- controller secret or 32-byte seed
|
|
9
|
+
* to `ProfileAgents` (did:key CapabilityAgent, ZcapClient, X25519 KAK,
|
|
10
|
+
* single-key resolver) under the fixed bootstrap handle / key name.
|
|
11
|
+
* - `singleKeyResolver` -- the one-key `IKeyResolver` factory (also used by
|
|
12
|
+
* app-side derivations such as a keyring unlock identity).
|
|
13
|
+
*
|
|
14
|
+
* Kept out of the root export: this subpath pulls the webkms-client / ezcap /
|
|
15
|
+
* x25519 dependency graph (the same isolation pattern as `./request`).
|
|
16
|
+
*/
|
|
17
|
+
export { BOOTSTRAP_HANDLE, BOOTSTRAP_KEY_NAME, agentsFromSecret, agentsFromSeed } from './agents.js';
|
|
18
|
+
export { singleKeyResolver } from './keyResolver.js';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACf,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* A single-key `IKeyResolver` factory. Wallet key agreement happens against one
|
|
6
|
+
* known KAK at a time (for example the vault KAK for the data identity, or an
|
|
7
|
+
* unlock KAK for a keyring), so the resolver only ever needs to answer for that
|
|
8
|
+
* one key. Any other key id is an error.
|
|
9
|
+
*/
|
|
10
|
+
import type { IKeyResolver } from '@interop/data-integrity-core';
|
|
11
|
+
/**
|
|
12
|
+
* Builds an `IKeyResolver` that resolves exactly one key -- the supplied key
|
|
13
|
+
* agreement key -- and throws for any other id.
|
|
14
|
+
*
|
|
15
|
+
* @param options {object}
|
|
16
|
+
* @param options.keyAgreementKey {object} the one KAK this resolver answers
|
|
17
|
+
* for; only its `id`, `type`, and `publicKeyMultibase` are read
|
|
18
|
+
* @param [options.keyAgreementKey.id] {string}
|
|
19
|
+
* @param [options.keyAgreementKey.type] {string}
|
|
20
|
+
* @param [options.keyAgreementKey.publicKeyMultibase] {string}
|
|
21
|
+
* @returns {IKeyResolver}
|
|
22
|
+
*/
|
|
23
|
+
export declare function singleKeyResolver({ keyAgreementKey }: {
|
|
24
|
+
keyAgreementKey: {
|
|
25
|
+
id?: string;
|
|
26
|
+
type?: string;
|
|
27
|
+
publicKeyMultibase?: string;
|
|
28
|
+
};
|
|
29
|
+
}): IKeyResolver;
|
|
30
|
+
//# sourceMappingURL=keyResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyResolver.d.ts","sourceRoot":"","sources":["../../src/identity/keyResolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEhE;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,eAAe,EAChB,EAAE;IACD,eAAe,EAAE;QACf,EAAE,CAAC,EAAE,MAAM,CAAA;QACX,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAC5B,CAAA;CACF,GAAG,YAAY,CAWf"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds an `IKeyResolver` that resolves exactly one key -- the supplied key
|
|
3
|
+
* agreement key -- and throws for any other id.
|
|
4
|
+
*
|
|
5
|
+
* @param options {object}
|
|
6
|
+
* @param options.keyAgreementKey {object} the one KAK this resolver answers
|
|
7
|
+
* for; only its `id`, `type`, and `publicKeyMultibase` are read
|
|
8
|
+
* @param [options.keyAgreementKey.id] {string}
|
|
9
|
+
* @param [options.keyAgreementKey.type] {string}
|
|
10
|
+
* @param [options.keyAgreementKey.publicKeyMultibase] {string}
|
|
11
|
+
* @returns {IKeyResolver}
|
|
12
|
+
*/
|
|
13
|
+
export function singleKeyResolver({ keyAgreementKey }) {
|
|
14
|
+
return async ({ id }) => {
|
|
15
|
+
if (id !== keyAgreementKey.id) {
|
|
16
|
+
throw new Error(`Unknown key id "${id}".`);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
id: keyAgreementKey.id,
|
|
20
|
+
type: keyAgreementKey.type,
|
|
21
|
+
publicKeyMultibase: keyAgreementKey.publicKeyMultibase
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=keyResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyResolver.js","sourceRoot":"","sources":["../../src/identity/keyResolver.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,eAAe,EAOhB;IACC,OAAO,KAAK,EAAE,EAAE,EAAE,EAAmB,EAAE,EAAE;QACvC,IAAI,EAAE,KAAK,eAAe,CAAC,EAAE,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAA;QAC5C,CAAC;QACD,OAAO;YACL,EAAE,EAAE,eAAe,CAAC,EAAE;YACtB,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,kBAAkB,EAAE,eAAe,CAAC,kBAAkB;SACvD,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
*
|
|
8
8
|
* - `@interop/wallet-core/sync` -- the WAS replication engine core.
|
|
9
9
|
* - `@interop/wallet-core/space` -- the wallet Space layout contract.
|
|
10
|
+
* - `@interop/wallet-core/identity` -- the WAS identity derivation
|
|
11
|
+
* (`agentsFromSecret` / `agentsFromSeed`, `singleKeyResolver`) both wallet
|
|
12
|
+
* apps must perform byte-for-byte identically.
|
|
10
13
|
* - `@interop/wallet-core/request` -- wallet-request / exchange protocol
|
|
11
14
|
* handling (classification and parsing, QueryByExample matching, cryptosuite
|
|
12
15
|
* negotiation, VP composition, the VC-API exchange client, and VCALM
|
|
@@ -14,10 +17,10 @@
|
|
|
14
17
|
* - `@interop/wallet-core/display` -- pure VC derivation / display helpers and
|
|
15
18
|
* credential input parsing (raw values out; formatting stays in the UI).
|
|
16
19
|
*
|
|
17
|
-
* This root re-exports `sync` and `space` for convenience. `
|
|
18
|
-
* `display` are deliberately NOT re-exported here, so plaintext
|
|
19
|
-
* the root never pull the signing / document-loader
|
|
20
|
-
* was-client subpath-isolation pattern).
|
|
20
|
+
* This root re-exports `sync` and `space` for convenience. `identity`,
|
|
21
|
+
* `request`, and `display` are deliberately NOT re-exported here, so plaintext
|
|
22
|
+
* consumers of the root never pull the signing / KMS / document-loader
|
|
23
|
+
* dependency graph (the was-client subpath-isolation pattern).
|
|
21
24
|
*/
|
|
22
25
|
export * from './sync/index.js';
|
|
23
26
|
export * from './space/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
*
|
|
8
8
|
* - `@interop/wallet-core/sync` -- the WAS replication engine core.
|
|
9
9
|
* - `@interop/wallet-core/space` -- the wallet Space layout contract.
|
|
10
|
+
* - `@interop/wallet-core/identity` -- the WAS identity derivation
|
|
11
|
+
* (`agentsFromSecret` / `agentsFromSeed`, `singleKeyResolver`) both wallet
|
|
12
|
+
* apps must perform byte-for-byte identically.
|
|
10
13
|
* - `@interop/wallet-core/request` -- wallet-request / exchange protocol
|
|
11
14
|
* handling (classification and parsing, QueryByExample matching, cryptosuite
|
|
12
15
|
* negotiation, VP composition, the VC-API exchange client, and VCALM
|
|
@@ -14,10 +17,10 @@
|
|
|
14
17
|
* - `@interop/wallet-core/display` -- pure VC derivation / display helpers and
|
|
15
18
|
* credential input parsing (raw values out; formatting stays in the UI).
|
|
16
19
|
*
|
|
17
|
-
* This root re-exports `sync` and `space` for convenience. `
|
|
18
|
-
* `display` are deliberately NOT re-exported here, so plaintext
|
|
19
|
-
* the root never pull the signing / document-loader
|
|
20
|
-
* was-client subpath-isolation pattern).
|
|
20
|
+
* This root re-exports `sync` and `space` for convenience. `identity`,
|
|
21
|
+
* `request`, and `display` are deliberately NOT re-exported here, so plaintext
|
|
22
|
+
* consumers of the root never pull the signing / KMS / document-loader
|
|
23
|
+
* dependency graph (the was-client subpath-isolation pattern).
|
|
21
24
|
*/
|
|
22
25
|
export * from './sync/index.js';
|
|
23
26
|
export * from './space/index.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interop/wallet-core",
|
|
3
3
|
"description": "Shared wallet-domain logic (WAS sync engine core and wallet Space layout contracts) for Interop wallet apps.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|
|
@@ -42,6 +42,12 @@
|
|
|
42
42
|
"import": "./dist/space/index.js",
|
|
43
43
|
"default": "./dist/space/index.js"
|
|
44
44
|
},
|
|
45
|
+
"./identity": {
|
|
46
|
+
"types": "./dist/identity/index.d.ts",
|
|
47
|
+
"react-native": "./dist/identity/index.js",
|
|
48
|
+
"import": "./dist/identity/index.js",
|
|
49
|
+
"default": "./dist/identity/index.js"
|
|
50
|
+
},
|
|
45
51
|
"./request": {
|
|
46
52
|
"types": "./dist/request/index.d.ts",
|
|
47
53
|
"react-native": "./dist/request/index.js",
|
|
@@ -63,9 +69,12 @@
|
|
|
63
69
|
"@interop/data-integrity-core": "^8.4.0",
|
|
64
70
|
"@interop/data-integrity-proof": "^3.4.2",
|
|
65
71
|
"@interop/ed25519-signature": "^7.1.4",
|
|
72
|
+
"@interop/ezcap": "^7.4.1",
|
|
66
73
|
"@interop/security-document-loader": "^9.4.4",
|
|
67
74
|
"@interop/vc": "^11.0.5",
|
|
68
|
-
"@interop/was-client": "^0.
|
|
75
|
+
"@interop/was-client": "^0.20.0",
|
|
76
|
+
"@interop/webkms-client": "^14.7.1",
|
|
77
|
+
"@interop/x25519-key-agreement-key": "^5.2.1",
|
|
69
78
|
"@scure/base": "^1.2.1",
|
|
70
79
|
"jsonpath-plus": "^10.3.0"
|
|
71
80
|
},
|