@interop/wallet-core 0.40.0 → 0.42.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 +17 -3
- package/dist/clients/listing.d.ts +4 -3
- package/dist/clients/listing.d.ts.map +1 -1
- package/dist/clients/listing.js.map +1 -1
- package/dist/clients/policy.d.ts +3 -2
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +3 -3
- package/dist/clients/policy.js.map +1 -1
- package/dist/clients/revocation.d.ts +14 -4
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +29 -14
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +22 -15
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +32 -15
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/index.d.ts +1 -1
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +1 -1
- package/dist/descriptors/index.js.map +1 -1
- package/dist/descriptors/logSource.d.ts +58 -6
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +57 -15
- package/dist/descriptors/logSource.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts +30 -2
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +58 -30
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/enrollment/index.d.ts +4 -1
- package/dist/enrollment/index.d.ts.map +1 -1
- package/dist/enrollment/index.js +4 -1
- package/dist/enrollment/index.js.map +1 -1
- package/dist/keyring/fetch.d.ts +12 -0
- package/dist/keyring/fetch.d.ts.map +1 -1
- package/dist/keyring/fetch.js +0 -2
- package/dist/keyring/fetch.js.map +1 -1
- package/dist/keyring/index.d.ts +7 -6
- package/dist/keyring/index.d.ts.map +1 -1
- package/dist/keyring/index.js +7 -6
- package/dist/keyring/index.js.map +1 -1
- package/dist/keyring/kdf.d.ts +22 -6
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +9 -14
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keyring/record.d.ts +30 -10
- package/dist/keyring/record.d.ts.map +1 -1
- package/dist/keyring/record.js +31 -15
- package/dist/keyring/record.js.map +1 -1
- package/dist/keys/index.d.ts +5 -3
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +3 -2
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +22 -2
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +40 -20
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/rosterStore.d.ts +13 -1
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +18 -0
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/userKeyCascade.d.ts +10 -3
- package/dist/keys/userKeyCascade.d.ts.map +1 -1
- package/dist/keys/userKeyCascade.js +10 -4
- package/dist/keys/userKeyCascade.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +29 -21
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +47 -23
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/recovery/index.d.ts +21 -11
- package/dist/recovery/index.d.ts.map +1 -1
- package/dist/recovery/index.js +19 -10
- package/dist/recovery/index.js.map +1 -1
- package/dist/recovery/recoveryCode.d.ts +5 -17
- package/dist/recovery/recoveryCode.d.ts.map +1 -1
- package/dist/recovery/recoveryCode.js +4 -14
- package/dist/recovery/recoveryCode.js.map +1 -1
- package/dist/recovery/recoveryDelegation.d.ts +151 -0
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -0
- package/dist/recovery/recoveryDelegation.js +261 -0
- package/dist/recovery/recoveryDelegation.js.map +1 -0
- package/dist/recovery/recoveryWebvh.d.ts +13 -22
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +53 -139
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/resourceLog/append.d.ts +12 -3
- package/dist/resourceLog/append.d.ts.map +1 -1
- package/dist/resourceLog/append.js +17 -10
- package/dist/resourceLog/append.js.map +1 -1
- package/dist/resourceLog/index.d.ts +1 -1
- package/dist/resourceLog/index.d.ts.map +1 -1
- package/dist/resourceLog/index.js +1 -1
- package/dist/resourceLog/index.js.map +1 -1
- package/dist/resourceLog/pin.d.ts +46 -8
- package/dist/resourceLog/pin.d.ts.map +1 -1
- package/dist/resourceLog/pin.js +32 -7
- package/dist/resourceLog/pin.js.map +1 -1
- package/dist/resourceLog/seal.d.ts +4 -1
- package/dist/resourceLog/seal.d.ts.map +1 -1
- package/dist/resourceLog/seal.js +6 -2
- package/dist/resourceLog/seal.js.map +1 -1
- package/dist/unlock/index.d.ts +40 -0
- package/dist/unlock/index.d.ts.map +1 -0
- package/dist/unlock/index.js +36 -0
- package/dist/unlock/index.js.map +1 -0
- package/dist/unlock/ladder.d.ts +100 -0
- package/dist/unlock/ladder.d.ts.map +1 -0
- package/dist/unlock/ladder.js +144 -0
- package/dist/unlock/ladder.js.map +1 -0
- package/dist/unlock/selfEnroll.d.ts +83 -0
- package/dist/unlock/selfEnroll.d.ts.map +1 -0
- package/dist/unlock/selfEnroll.js +126 -0
- package/dist/unlock/selfEnroll.js.map +1 -0
- package/dist/unlock/standingClient.d.ts +68 -0
- package/dist/unlock/standingClient.d.ts.map +1 -0
- package/dist/unlock/standingClient.js +81 -0
- package/dist/unlock/standingClient.js.map +1 -0
- package/dist/unlock/standingWebvh.d.ts +153 -0
- package/dist/unlock/standingWebvh.d.ts.map +1 -0
- package/dist/unlock/standingWebvh.js +370 -0
- package/dist/unlock/standingWebvh.js.map +1 -0
- package/dist/unlock/unlockRecord.d.ts +207 -0
- package/dist/unlock/unlockRecord.d.ts.map +1 -0
- package/dist/unlock/unlockRecord.js +435 -0
- package/dist/unlock/unlockRecord.js.map +1 -0
- package/dist/webvh/didWebvh.d.ts +166 -7
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +286 -31
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/index.d.ts +15 -3
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +14 -3
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/keyAgreement.d.ts +72 -0
- package/dist/webvh/keyAgreement.d.ts.map +1 -0
- package/dist/webvh/keyAgreement.js +47 -0
- package/dist/webvh/keyAgreement.js.map +1 -0
- package/dist/webvh/listClients.d.ts +69 -20
- package/dist/webvh/listClients.d.ts.map +1 -1
- package/dist/webvh/listClients.js +102 -14
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/revokeClient.d.ts +21 -11
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +31 -14
- package/dist/webvh/revokeClient.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +15 -2
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +22 -3
- package/dist/webvh/verifyLog.js.map +1 -1
- package/package.json +11 -5
- package/dist/recovery/recoveryRecord.d.ts +0 -171
- package/dist/recovery/recoveryRecord.d.ts.map +0 -1
- package/dist/recovery/recoveryRecord.js +0 -290
- package/dist/recovery/recoveryRecord.js.map +0 -1
|
@@ -5,6 +5,52 @@ import { readResourceLog, ResourceLogIntegrityError } from '../resourceLog/index
|
|
|
5
5
|
* governed log entry, per WAS-EC.
|
|
6
6
|
*/
|
|
7
7
|
export const EPOCH_CONFIGURATION_STATE_TYPE = 'WasEpochConfiguration';
|
|
8
|
+
/**
|
|
9
|
+
* The one governed epoch-configuration read: the fail-closed boundary that
|
|
10
|
+
* decides whether a served log state may be treated as an encryption
|
|
11
|
+
* descriptor. Resolves the controller view, reads and fully verifies the log
|
|
12
|
+
* (chain, proofs, external authorization, and the chain-head pin, via
|
|
13
|
+
* `readResourceLog`), and refuses a verified head whose state is not a
|
|
14
|
+
* `WasEpochConfiguration` rather than handing it out as a descriptor.
|
|
15
|
+
* Resolves `null` for an absent log (the pre-genesis state). Both governed
|
|
16
|
+
* descriptor consumers -- the log-governed descriptor source below and the
|
|
17
|
+
* roster's log-governed descriptor store -- read through this helper, so a
|
|
18
|
+
* hardening applied here reaches every trusted descriptor read.
|
|
19
|
+
*
|
|
20
|
+
* @param options {object}
|
|
21
|
+
* @param options.store {ResourceLogStore} the log's transport seam
|
|
22
|
+
* @param options.resolveController {function}
|
|
23
|
+
* `() => Promise<ResourceLogController>` -- the caller's currently verified
|
|
24
|
+
* controller view, resolved per operation
|
|
25
|
+
* @param options.pinStore {ResourceLogPinStore} this client's chain-head
|
|
26
|
+
* pin for this log
|
|
27
|
+
* @param options.logId {string} the pin-slot key for this log, from
|
|
28
|
+
* `resourceLogPinId`
|
|
29
|
+
* @returns {Promise<{ verified: VerifiedResourceLog; descriptor: CollectionEncryption; etag?: string } | null>}
|
|
30
|
+
*/
|
|
31
|
+
export async function readGovernedEpochConfiguration({ store, resolveController, pinStore, logId }) {
|
|
32
|
+
const controller = await resolveController();
|
|
33
|
+
const current = await readResourceLog({
|
|
34
|
+
store,
|
|
35
|
+
controller,
|
|
36
|
+
expectedMethod: RESOURCE_LOG_METHOD,
|
|
37
|
+
pinStore,
|
|
38
|
+
logId
|
|
39
|
+
});
|
|
40
|
+
if (current === null) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const state = current.verified.state;
|
|
44
|
+
if (state.type !== EPOCH_CONFIGURATION_STATE_TYPE) {
|
|
45
|
+
throw new ResourceLogIntegrityError(`The governed descriptor log carries state of type ` +
|
|
46
|
+
`"${state.type}", not "${EPOCH_CONFIGURATION_STATE_TYPE}".`);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
verified: current.verified,
|
|
50
|
+
descriptor: state,
|
|
51
|
+
etag: current.etag
|
|
52
|
+
};
|
|
53
|
+
}
|
|
8
54
|
/**
|
|
9
55
|
* Builds the {@link EncryptionDescriptorSource} over per-collection resource
|
|
10
56
|
* logs. An absent log resolves `undefined` exactly like an absent
|
|
@@ -19,30 +65,26 @@ export const EPOCH_CONFIGURATION_STATE_TYPE = 'WasEpochConfiguration';
|
|
|
19
65
|
* @param options.resolveController {function}
|
|
20
66
|
* `() => Promise<ResourceLogController>` -- the caller's currently verified
|
|
21
67
|
* controller view, resolved per operation
|
|
22
|
-
* @param options.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
68
|
+
* @param options.pinStore {ResourceLogPinStore} this client's chain-head
|
|
69
|
+
* pins, keyed per log
|
|
70
|
+
* @param options.logIdFor {function} `(collectionId) => string` -- the
|
|
71
|
+
* collection's descriptor log's pin-slot key, typically built with
|
|
72
|
+
* `resourceLogPinId`
|
|
25
73
|
* @returns {EncryptionDescriptorSource}
|
|
26
74
|
*/
|
|
27
|
-
export function logGovernedDescriptorSource({ logFor, resolveController,
|
|
75
|
+
export function logGovernedDescriptorSource({ logFor, resolveController, pinStore, logIdFor }) {
|
|
28
76
|
return {
|
|
29
77
|
async collectionEncryption({ collectionId }) {
|
|
30
|
-
const
|
|
31
|
-
const current = await readResourceLog({
|
|
78
|
+
const current = await readGovernedEpochConfiguration({
|
|
32
79
|
store: logFor(collectionId),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
80
|
+
resolveController,
|
|
81
|
+
pinStore,
|
|
82
|
+
logId: logIdFor(collectionId)
|
|
36
83
|
});
|
|
37
84
|
if (current === null) {
|
|
38
85
|
return undefined;
|
|
39
86
|
}
|
|
40
|
-
|
|
41
|
-
if (state.type !== EPOCH_CONFIGURATION_STATE_TYPE) {
|
|
42
|
-
throw new ResourceLogIntegrityError(`The governed descriptor log carries state of type ` +
|
|
43
|
-
`"${state.type}", not "${EPOCH_CONFIGURATION_STATE_TYPE}".`);
|
|
44
|
-
}
|
|
45
|
-
return state;
|
|
87
|
+
return current.descriptor;
|
|
46
88
|
}
|
|
47
89
|
};
|
|
48
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logSource.js","sourceRoot":"","sources":["../../src/descriptors/logSource.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,mBAAmB,EAEpB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,eAAe,EACf,yBAAyB,
|
|
1
|
+
{"version":3,"file":"logSource.js","sourceRoot":"","sources":["../../src/descriptors/logSource.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,mBAAmB,EAEpB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,eAAe,EACf,yBAAyB,EAI1B,MAAM,yBAAyB,CAAA;AAGhC;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,uBAAuB,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAAC,EACnD,KAAK,EACL,iBAAiB,EACjB,QAAQ,EACR,KAAK,EAMN;IAKC,MAAM,UAAU,GAAG,MAAM,iBAAiB,EAAE,CAAA;IAC5C,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC;QACpC,KAAK;QACL,UAAU;QACV,cAAc,EAAE,mBAAmB;QACnC,QAAQ;QACR,KAAK;KACN,CAAC,CAAA;IACF,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;IACpC,IAAI,KAAK,CAAC,IAAI,KAAK,8BAA8B,EAAE,CAAC;QAClD,MAAM,IAAI,yBAAyB,CACjC,oDAAoD;YAClD,IAAI,KAAK,CAAC,IAAI,WAAW,8BAA8B,IAAI,CAC9D,CAAA;IACH,CAAC;IACD,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE,KAA6B;QACzC,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,2BAA2B,CAAC,EAC1C,MAAM,EACN,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EAMT;IACC,OAAO;QACL,KAAK,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE;YACzC,MAAM,OAAO,GAAG,MAAM,8BAA8B,CAAC;gBACnD,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC;gBAC3B,iBAAiB;gBACjB,QAAQ;gBACR,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC;aAC9B,CAAC,CAAA;YACF,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACrB,OAAO,SAAS,CAAA;YAClB,CAAC;YACD,OAAO,OAAO,CAAC,UAAU,CAAA;QAC3B,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -60,7 +60,10 @@ export declare function encodeEnrollmentRequest({ request }: {
|
|
|
60
60
|
/**
|
|
61
61
|
* Parses and validates a connect code: the prefix, the payload version, and
|
|
62
62
|
* each key decoded to its bytes (Ed25519 multibase for the signing and update
|
|
63
|
-
* keys, X25519 for the key-agreement key)
|
|
63
|
+
* keys, X25519 for the key-agreement key), plus the canonicality of the
|
|
64
|
+
* key-agreement key ({@link assertCanonicalEnrollmentKeys}), so the refusal
|
|
65
|
+
* reaches the approver's consent screen rather than the ceremony. Throws on
|
|
66
|
+
* anything malformed -- a
|
|
64
67
|
* code is typed or scanned, so a clear refusal beats a half-parsed ceremony,
|
|
65
68
|
* and the approving client signs these keys into an append-only log where a
|
|
66
69
|
* corrupted one would be published permanently.
|
|
@@ -72,6 +75,29 @@ export declare function encodeEnrollmentRequest({ request }: {
|
|
|
72
75
|
export declare function parseEnrollmentRequest({ code }: {
|
|
73
76
|
code: string;
|
|
74
77
|
}): EnrollmentRequest;
|
|
78
|
+
/**
|
|
79
|
+
* Refuses a connect code whose key-agreement key is not the canonical X25519
|
|
80
|
+
* twin of its signing key.
|
|
81
|
+
*
|
|
82
|
+
* The document publishes a client's key-agreement method under the controller
|
|
83
|
+
* marker `did:key:<signing multibase>` -- a claim that the key belongs to
|
|
84
|
+
* that signing key -- and every reader (the client listing, the revocation
|
|
85
|
+
* removal, the roster's recipient resolver) trusts it. This check is what
|
|
86
|
+
* makes the claim true: without it an enrollee could supply a key-agreement
|
|
87
|
+
* key nobody else can pair with its signing key, and publishing it under the
|
|
88
|
+
* marker would state something the account cannot back.
|
|
89
|
+
*
|
|
90
|
+
* It runs here so the refusal reaches the approver's consent screen before
|
|
91
|
+
* anything is published; the write sites enforce the same rule as a backstop,
|
|
92
|
+
* through `markedVerificationMethodPair`.
|
|
93
|
+
*
|
|
94
|
+
* @param options {object}
|
|
95
|
+
* @param options.request {EnrollmentRequest}
|
|
96
|
+
* @returns {void}
|
|
97
|
+
*/
|
|
98
|
+
export declare function assertCanonicalEnrollmentKeys({ request }: {
|
|
99
|
+
request: EnrollmentRequest;
|
|
100
|
+
}): void;
|
|
75
101
|
/**
|
|
76
102
|
* The did:key a connect code's signing key derives -- shown on BOTH screens
|
|
77
103
|
* so the person running the ceremony can compare them before approving (the
|
|
@@ -118,7 +144,9 @@ export declare function mintEnrollmentRequest(): Promise<{
|
|
|
118
144
|
* wrapped into the roster first (escrow: every epoch, so the new client reads
|
|
119
145
|
* pre-enrollment history), then the two log entries. Quorum-of-one: this
|
|
120
146
|
* client's own update key signs both entries. Idempotent at every stage, so
|
|
121
|
-
* re-approving the same code after any tear converges.
|
|
147
|
+
* re-approving the same code after any tear converges. A request whose
|
|
148
|
+
* key-agreement key is not its signing key's canonical twin is refused before
|
|
149
|
+
* anything is written ({@link assertCanonicalEnrollmentKeys}).
|
|
122
150
|
*
|
|
123
151
|
* @param options {object}
|
|
124
152
|
* @param options.request {EnrollmentRequest} the parsed connect code
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrollment.d.ts","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"enrollment.d.ts","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAaxE,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAc7B,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAQ1D;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,CAAA;AAEnD;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;gBAE7C,OAAO,SAC+C;CAKzD;AAiDD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACR,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAA;CAC3B,GAAG,MAAM,CAKT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACL,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,iBAAiB,CAwDpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,OAAO,EACR,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAA;CAC3B,GAAG,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AAa,EAAE,MAAM,CAAA;CAAE,CAAC,CAyEvD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { decodeMultikey, MultikeyCodec } from '@interop/data-integrity-core/multihash';
|
|
1
2
|
import { base64urlnopad } from '@scure/base';
|
|
2
|
-
import { multibaseDecode, MULTICODEC_X25519_PUB_HEADER } from '@interop/x25519-key-agreement-key';
|
|
3
3
|
import { agentsFromSeed } from '../identity/agents.js';
|
|
4
|
-
import { enrollWebvhClient, mintClientWebvhUpdateKeys, updateKeyMultibase } from '../webvh/didWebvh.js';
|
|
4
|
+
import { enrollWebvhClient, keyAgreementTwinMultibase, mintClientWebvhUpdateKeys, updateKeyMultibase } from '../webvh/didWebvh.js';
|
|
5
5
|
import { clientSigningKeyMultibase, isWebvhDid, webvhZcapClient } from '../webvh/zcap.js';
|
|
6
6
|
import { AccountLogMissingError, verifyAccountLog } from '../webvh/verifyLog.js';
|
|
7
7
|
import { addUserKeyRosterRecipient } from '../keys/userKeyRoster.js';
|
|
@@ -31,46 +31,34 @@ export class EnrollmentPendingError extends Error {
|
|
|
31
31
|
*/
|
|
32
32
|
const ED25519_MULTIBASE_PREFIX = 'z6Mk';
|
|
33
33
|
const X25519_MULTIBASE_PREFIX = 'z6LS';
|
|
34
|
-
/**
|
|
35
|
-
* The multicodec varint header of an `ed25519-pub` value, the registry
|
|
36
|
-
* constant the `z6Mk` prefix renders. The X25519 counterpart is imported from
|
|
37
|
-
* the key suite that owns it; there is no exported Ed25519 equivalent.
|
|
38
|
-
*/
|
|
39
|
-
const MULTICODEC_ED25519_PUB_HEADER = new Uint8Array([0xed, 0x01]);
|
|
40
|
-
/**
|
|
41
|
-
* The byte length of both public key types a connect code carries.
|
|
42
|
-
*/
|
|
43
|
-
const PUBLIC_KEY_BYTES = 32;
|
|
44
34
|
/**
|
|
45
35
|
* Validates one connect-code key all the way down to its bytes: the multibase
|
|
46
|
-
* prefix, a real base58btc decode
|
|
47
|
-
* The prefix alone is worth nothing here
|
|
48
|
-
* append-only did:webvh log, where a key
|
|
49
|
-
* published forever.
|
|
36
|
+
* prefix, then a real base58btc decode with the multicodec header and key
|
|
37
|
+
* length enforced by `decodeMultikey`. The prefix alone is worth nothing here
|
|
38
|
+
* -- these keys are signed into an append-only did:webvh log, where a key
|
|
39
|
+
* that only LOOKS like a multibase is published forever. The prefix check
|
|
40
|
+
* stays alongside the decode: it is a stricter, deliberate spelling
|
|
41
|
+
* constraint (`z6Mk` / `z6LS` exactly) the codec-level decode does not cover.
|
|
50
42
|
*
|
|
51
43
|
* @param options {object}
|
|
52
44
|
* @param options.value {unknown} the payload member
|
|
53
45
|
* @param options.prefix {string} the expected multibase prefix
|
|
54
|
-
* @param options.
|
|
46
|
+
* @param options.expectedCodec {MultikeyCodec} the expected multicodec
|
|
55
47
|
* @param options.name {string} the key's name, for the error message
|
|
56
48
|
* @returns {string} the key, verbatim
|
|
57
49
|
*/
|
|
58
|
-
function requireConnectCodeKey({ value, prefix,
|
|
50
|
+
function requireConnectCodeKey({ value, prefix, expectedCodec, name }) {
|
|
59
51
|
if (typeof value !== 'string' || !value.startsWith(prefix)) {
|
|
60
52
|
throw new Error(`The connect code carries a malformed ${name}.`);
|
|
61
53
|
}
|
|
62
|
-
let bytes;
|
|
63
54
|
try {
|
|
64
|
-
|
|
55
|
+
decodeMultikey({ multikey: value, expectedCodec });
|
|
65
56
|
}
|
|
66
57
|
catch (err) {
|
|
67
58
|
throw new Error(`The connect code carries a malformed ${name}.`, {
|
|
68
59
|
cause: err
|
|
69
60
|
});
|
|
70
61
|
}
|
|
71
|
-
if (bytes.length !== PUBLIC_KEY_BYTES) {
|
|
72
|
-
throw new Error(`The connect code carries a malformed ${name}.`);
|
|
73
|
-
}
|
|
74
62
|
return value;
|
|
75
63
|
}
|
|
76
64
|
/**
|
|
@@ -87,7 +75,10 @@ export function encodeEnrollmentRequest({ request }) {
|
|
|
87
75
|
/**
|
|
88
76
|
* Parses and validates a connect code: the prefix, the payload version, and
|
|
89
77
|
* each key decoded to its bytes (Ed25519 multibase for the signing and update
|
|
90
|
-
* keys, X25519 for the key-agreement key)
|
|
78
|
+
* keys, X25519 for the key-agreement key), plus the canonicality of the
|
|
79
|
+
* key-agreement key ({@link assertCanonicalEnrollmentKeys}), so the refusal
|
|
80
|
+
* reaches the approver's consent screen rather than the ceremony. Throws on
|
|
81
|
+
* anything malformed -- a
|
|
91
82
|
* code is typed or scanned, so a clear refusal beats a half-parsed ceremony,
|
|
92
83
|
* and the approving client signs these keys into an append-only log where a
|
|
93
84
|
* corrupted one would be published permanently.
|
|
@@ -115,32 +106,63 @@ export function parseEnrollmentRequest({ code }) {
|
|
|
115
106
|
if (v !== CONNECT_CODE_VERSION) {
|
|
116
107
|
throw new Error(`Unsupported connect code version "${String(v)}".`);
|
|
117
108
|
}
|
|
118
|
-
|
|
109
|
+
const request = {
|
|
119
110
|
signingKeyMultibase: requireConnectCodeKey({
|
|
120
111
|
value: signingKeyMultibase,
|
|
121
112
|
prefix: ED25519_MULTIBASE_PREFIX,
|
|
122
|
-
|
|
113
|
+
expectedCodec: MultikeyCodec.ED25519_PUB,
|
|
123
114
|
name: 'signing key'
|
|
124
115
|
}),
|
|
125
116
|
keyAgreementKeyMultibase: requireConnectCodeKey({
|
|
126
117
|
value: keyAgreementKeyMultibase,
|
|
127
118
|
prefix: X25519_MULTIBASE_PREFIX,
|
|
128
|
-
|
|
119
|
+
expectedCodec: MultikeyCodec.X25519_PUB,
|
|
129
120
|
name: 'key-agreement key'
|
|
130
121
|
}),
|
|
131
122
|
updateKeyMultibase: requireConnectCodeKey({
|
|
132
123
|
value: updateKey,
|
|
133
124
|
prefix: ED25519_MULTIBASE_PREFIX,
|
|
134
|
-
|
|
125
|
+
expectedCodec: MultikeyCodec.ED25519_PUB,
|
|
135
126
|
name: 'update key'
|
|
136
127
|
}),
|
|
137
128
|
stagedUpdateKeyMultibase: requireConnectCodeKey({
|
|
138
129
|
value: stagedUpdateKeyMultibase,
|
|
139
130
|
prefix: ED25519_MULTIBASE_PREFIX,
|
|
140
|
-
|
|
131
|
+
expectedCodec: MultikeyCodec.ED25519_PUB,
|
|
141
132
|
name: 'staged update key'
|
|
142
133
|
})
|
|
143
134
|
};
|
|
135
|
+
assertCanonicalEnrollmentKeys({ request });
|
|
136
|
+
return request;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Refuses a connect code whose key-agreement key is not the canonical X25519
|
|
140
|
+
* twin of its signing key.
|
|
141
|
+
*
|
|
142
|
+
* The document publishes a client's key-agreement method under the controller
|
|
143
|
+
* marker `did:key:<signing multibase>` -- a claim that the key belongs to
|
|
144
|
+
* that signing key -- and every reader (the client listing, the revocation
|
|
145
|
+
* removal, the roster's recipient resolver) trusts it. This check is what
|
|
146
|
+
* makes the claim true: without it an enrollee could supply a key-agreement
|
|
147
|
+
* key nobody else can pair with its signing key, and publishing it under the
|
|
148
|
+
* marker would state something the account cannot back.
|
|
149
|
+
*
|
|
150
|
+
* It runs here so the refusal reaches the approver's consent screen before
|
|
151
|
+
* anything is published; the write sites enforce the same rule as a backstop,
|
|
152
|
+
* through `markedVerificationMethodPair`.
|
|
153
|
+
*
|
|
154
|
+
* @param options {object}
|
|
155
|
+
* @param options.request {EnrollmentRequest}
|
|
156
|
+
* @returns {void}
|
|
157
|
+
*/
|
|
158
|
+
export function assertCanonicalEnrollmentKeys({ request }) {
|
|
159
|
+
const { signingKeyMultibase, keyAgreementKeyMultibase } = request;
|
|
160
|
+
if (keyAgreementKeyMultibase !==
|
|
161
|
+
keyAgreementTwinMultibase({ signingKeyMultibase })) {
|
|
162
|
+
throw new Error("The connect code's key-agreement key is not the canonical X25519 " +
|
|
163
|
+
'twin of its signing key; this wallet cannot be connected. Generate ' +
|
|
164
|
+
'a fresh connect code on the other wallet and try again.');
|
|
165
|
+
}
|
|
144
166
|
}
|
|
145
167
|
/**
|
|
146
168
|
* The did:key a connect code's signing key derives -- shown on BOTH screens
|
|
@@ -212,7 +234,9 @@ export async function mintEnrollmentRequest() {
|
|
|
212
234
|
* wrapped into the roster first (escrow: every epoch, so the new client reads
|
|
213
235
|
* pre-enrollment history), then the two log entries. Quorum-of-one: this
|
|
214
236
|
* client's own update key signs both entries. Idempotent at every stage, so
|
|
215
|
-
* re-approving the same code after any tear converges.
|
|
237
|
+
* re-approving the same code after any tear converges. A request whose
|
|
238
|
+
* key-agreement key is not its signing key's canonical twin is refused before
|
|
239
|
+
* anything is written ({@link assertCanonicalEnrollmentKeys}).
|
|
216
240
|
*
|
|
217
241
|
* @param options {object}
|
|
218
242
|
* @param options.request {EnrollmentRequest} the parsed connect code
|
|
@@ -230,6 +254,10 @@ export async function mintEnrollmentRequest() {
|
|
|
230
254
|
* needs no second parse of the connect code
|
|
231
255
|
*/
|
|
232
256
|
export async function approveEnrollment({ request, clientWebvhKeys, clientKeyAgreementKey, userKeyRosterStore, idStore }) {
|
|
257
|
+
// Re-checked here rather than trusted from the parse: this is the one seam
|
|
258
|
+
// every approval path runs through, and it is what publishes the key under
|
|
259
|
+
// the controller marker.
|
|
260
|
+
assertCanonicalEnrollmentKeys({ request });
|
|
233
261
|
// Decryption material before authorization: the wrap lands first, so no
|
|
234
262
|
// enrolled client is ever authorized but blind.
|
|
235
263
|
await addUserKeyRosterRecipient({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrollment.js","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AA+BA,OAAO,
|
|
1
|
+
{"version":3,"file":"enrollment.js","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AA+BA,OAAO,EACL,cAAc,EACd,aAAa,EACd,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,sBAAsB,CA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AU,GAAG,eAAe,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;IACrD,MAAM,KAAK,GAAG,4BAA4B,CAAC;QACzC,gBAAgB,EAAE,OAAO,CAAC,IAAI;QAC9B,UAAU;QACV,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,iBAAiB,EAAE,KAAK,IAAI,EAAE,CAC5B,0BAA0B,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;QACxD,QAAQ,EAAE,yBAAyB,EAAE;QACrC,MAAM,EAAE,sBAAsB,CAAC,EAAE,QAAQ,EAAE,CAAC;KAC7C,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC;QACnC,KAAK;QACL,qBAAqB,EAAE,eAAe;KACvC,CAAC,CAAA;IACF,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,yEAAyE;YACvE,2BAA2B,CAC9B,CAAA;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAA;AACrE,CAAC"}
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* - `mintEnrollmentRequest` / `encodeEnrollmentRequest` /
|
|
12
12
|
* `parseEnrollmentRequest` / `enrollmentClientDid` /
|
|
13
13
|
* `enrollmentRecipientKid` -- the connect-code channel layer.
|
|
14
|
+
* - `assertCanonicalEnrollmentKeys` -- the refusal of a code whose
|
|
15
|
+
* key-agreement key is not its signing key's canonical X25519 twin, run by
|
|
16
|
+
* both the parse and the approval.
|
|
14
17
|
* - `approveEnrollment` -- the enrolling client's half, in the push order
|
|
15
18
|
* (roster wrap, then the two did:webvh log entries).
|
|
16
19
|
* - `encodeOnboardingResponse` / `parseOnboardingResponse` -- the onboarding-
|
|
@@ -24,7 +27,7 @@
|
|
|
24
27
|
* log, read the roster, hand back the user key and the epoch to pin. Persisting
|
|
25
28
|
* the key set stays with the caller's own unlock layer.
|
|
26
29
|
*/
|
|
27
|
-
export { approveEnrollment, completeEnrollmentCore, encodeEnrollmentRequest, EnrollmentPendingError, enrollmentClientDid, enrollmentRecipientKid, mintEnrollmentRequest, parseEnrollmentRequest } from './enrollment.js';
|
|
30
|
+
export { approveEnrollment, assertCanonicalEnrollmentKeys, completeEnrollmentCore, encodeEnrollmentRequest, EnrollmentPendingError, enrollmentClientDid, enrollmentRecipientKid, mintEnrollmentRequest, parseEnrollmentRequest } from './enrollment.js';
|
|
28
31
|
export type { EnrollmentRequest } from './enrollment.js';
|
|
29
32
|
export { CONNECT_CODE_PREFIX, isConnectCode } from './connectCode.js';
|
|
30
33
|
export { encodeOnboardingResponse, ONBOARDING_LABEL_MAX_LENGTH, ONBOARDING_RESPONSE_VERSION, parseOnboardingResponse } from './onboardingResponse.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/enrollment/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/enrollment/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,iBAAiB,CAAA;AACxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AACvE,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,uBAAuB,CAAA"}
|
package/dist/enrollment/index.js
CHANGED
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* - `mintEnrollmentRequest` / `encodeEnrollmentRequest` /
|
|
12
12
|
* `parseEnrollmentRequest` / `enrollmentClientDid` /
|
|
13
13
|
* `enrollmentRecipientKid` -- the connect-code channel layer.
|
|
14
|
+
* - `assertCanonicalEnrollmentKeys` -- the refusal of a code whose
|
|
15
|
+
* key-agreement key is not its signing key's canonical X25519 twin, run by
|
|
16
|
+
* both the parse and the approval.
|
|
14
17
|
* - `approveEnrollment` -- the enrolling client's half, in the push order
|
|
15
18
|
* (roster wrap, then the two did:webvh log entries).
|
|
16
19
|
* - `encodeOnboardingResponse` / `parseOnboardingResponse` -- the onboarding-
|
|
@@ -24,7 +27,7 @@
|
|
|
24
27
|
* log, read the roster, hand back the user key and the epoch to pin. Persisting
|
|
25
28
|
* the key set stays with the caller's own unlock layer.
|
|
26
29
|
*/
|
|
27
|
-
export { approveEnrollment, completeEnrollmentCore, encodeEnrollmentRequest, EnrollmentPendingError, enrollmentClientDid, enrollmentRecipientKid, mintEnrollmentRequest, parseEnrollmentRequest } from './enrollment.js';
|
|
30
|
+
export { approveEnrollment, assertCanonicalEnrollmentKeys, completeEnrollmentCore, encodeEnrollmentRequest, EnrollmentPendingError, enrollmentClientDid, enrollmentRecipientKid, mintEnrollmentRequest, parseEnrollmentRequest } from './enrollment.js';
|
|
28
31
|
export { CONNECT_CODE_PREFIX, isConnectCode } from './connectCode.js';
|
|
29
32
|
export { encodeOnboardingResponse, ONBOARDING_LABEL_MAX_LENGTH, ONBOARDING_RESPONSE_VERSION, parseOnboardingResponse } from './onboardingResponse.js';
|
|
30
33
|
export { createOnboardingExchange, ONBOARDING_INTERACTION_PATH, ONBOARDING_INVITE_TTL_MS, ONBOARDING_POLL_INTERVAL_MS, OnboardingExchangeGoneError, pollOnboardingExchange } from './onboardingInvite.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enrollment/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enrollment/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,uBAAuB,CAAA"}
|
package/dist/keyring/fetch.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The portable keyring lookup: an unlock secret to the account it locates.
|
|
6
|
+
* One derivation, one read of the unlock Space's single resource, one unwrap.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately I/O-only over the remote copy, which is the source of truth: an
|
|
9
|
+
* app's local caching, account-pointer pinning, and client-key-record handling
|
|
10
|
+
* wrap around this rather than living inside it, because those are per-app
|
|
11
|
+
* storage concerns with per-app durability rules.
|
|
12
|
+
*/
|
|
1
13
|
import type { UnlockKdf } from './kdf.js';
|
|
2
14
|
import type { KeyringRecordContents } from './record.js';
|
|
3
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/keyring/fetch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/keyring/fetch.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAIzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,MAAM,EACN,GAAiB,EACjB,gBAAgB,EACjB,EAAE;IACD,MAAM,EAAE,MAAM,GAAG,UAAU,CAAA;IAC3B,GAAG,CAAC,EAAE,SAAS,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;CACzB,GAAG,OAAO,CAAC,CAAC,qBAAqB,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,IAAI,CAAC,CAoBtE"}
|
package/dist/keyring/fetch.js
CHANGED
|
@@ -26,8 +26,6 @@ export async function fetchKeyringRecord({ secret, kdf = KEYRING_KDF, storageSer
|
|
|
26
26
|
}
|
|
27
27
|
const contents = await unwrapKeyringRecord({
|
|
28
28
|
record,
|
|
29
|
-
// `id` is always set on the unlock KAK (a controller was supplied at
|
|
30
|
-
// derivation), so it satisfies IKeyAgreementKey's required `id`.
|
|
31
29
|
keyAgreementKey: unlock.keyAgreementKey,
|
|
32
30
|
keyResolver: unlock.keyResolver,
|
|
33
31
|
// The unlock identity's own signing key: derived from the secret the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/keyring/fetch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/keyring/fetch.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAGjD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EACvC,MAAM,EACN,GAAG,GAAG,WAAW,EACjB,gBAAgB,EAKjB;IACC,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IAC1D,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC;QACpC,gBAAgB;QAChB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAA;IACF,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC;QACzC,MAAM;QACN,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,qEAAqE;QACrE,uEAAuE;QACvE,iEAAiE;QACjE,oBAAoB,EAAE,MAAM,CAAC,YAAY,CAAC,YAAY;KACvD,CAAC,CAAA;IACF,OAAO,EAAE,GAAG,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,CAAA;AACvD,CAAC"}
|
package/dist/keyring/index.d.ts
CHANGED
|
@@ -16,10 +16,11 @@
|
|
|
16
16
|
* `RecordProofError` -- the record's authenticity layer: the proof over the
|
|
17
17
|
* frame members by the unlock identity's signing key, verified before any
|
|
18
18
|
* decryption, so a storage host cannot substitute a record it sealed itself.
|
|
19
|
-
* - `mintRecordEncryption` / `
|
|
20
|
-
* `parseRecordCreatedAt` / `recordCreatedAtStamp` --
|
|
21
|
-
* envelope construction the
|
|
22
|
-
*
|
|
19
|
+
* - `mintRecordEncryption` / `recordSealCipher` / `recordCipher` /
|
|
20
|
+
* `parseRecordFrame` / `parseRecordCreatedAt` / `recordCreatedAtStamp` --
|
|
21
|
+
* the record-own-epoch envelope construction the codec seals with (the seal
|
|
22
|
+
* cipher is encrypt-only, so sealing needs no key-agreement secret) plus
|
|
23
|
+
* the frame and plaintext validation it opens with,
|
|
23
24
|
* exported so an app's own locally stored records seal and unseal the same
|
|
24
25
|
* way (under their own cipher context) rather than re-deriving the
|
|
25
26
|
* construction.
|
|
@@ -32,9 +33,9 @@
|
|
|
32
33
|
* Kept out of the root export: this subpath pulls the webkms-client / ezcap /
|
|
33
34
|
* was-client dependency graph (the same isolation pattern as `./identity`).
|
|
34
35
|
*/
|
|
35
|
-
export { deriveUnlockIdentity, KEYRING_KDF, UNLOCK_HANDLE, UNLOCK_KEY_NAME, unlockSpaceIdFor } from './kdf.js';
|
|
36
|
+
export { deriveUnlockIdentity, deriveUnlockSeed, KEYRING_KDF, UNLOCK_HANDLE, UNLOCK_KEY_NAME, unlockSpaceIdFor } from './kdf.js';
|
|
36
37
|
export type { UnlockIdentity, UnlockKdf } from './kdf.js';
|
|
37
|
-
export { KEYRING_RECORD_VERSION, mintRecordEncryption, parseRecordCreatedAt, parseRecordFrame, parseRecordPointer, recordCipher, recordCreatedAtStamp, RecordProofError, recordProofKeyMultibase, recordSignerFromAgent, signRecordFrame, unwrapKeyringRecord, verifyRecordProof, wrapKeyringRecord } from './record.js';
|
|
38
|
+
export { KEYRING_RECORD_VERSION, mintRecordEncryption, parseRecordCreatedAt, parseRecordFrame, parseRecordPointer, recordCipher, recordCreatedAtStamp, RecordProofError, recordProofKeyMultibase, recordSealCipher, recordSignerFromAgent, signRecordFrame, unwrapKeyringRecord, verifyRecordProof, wrapKeyringRecord } from './record.js';
|
|
38
39
|
export type { AccountPointer, KeyringRecordContents, RecordProof, RecordSigner, SignedRecord } from './record.js';
|
|
39
40
|
export { deleteUnlockSpace, deleteUnlockSpaceWithCapability, ensureUnlockSpace, getUnlockKeyring, getUnlockKeyringWithCapability, putUnlockKeyring, putUnlockKeyringWithCapability, UNLOCK_SPACE_NAME } from './unlockSpace.js';
|
|
40
41
|
export { fetchKeyringRecord } from './fetch.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keyring/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keyring/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EACjB,MAAM,UAAU,CAAA;AACjB,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzD,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,YAAY,EACb,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,iBAAiB,EACjB,+BAA+B,EAC/B,iBAAiB,EACjB,gBAAgB,EAChB,8BAA8B,EAC9B,gBAAgB,EAChB,8BAA8B,EAC9B,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/keyring/index.js
CHANGED
|
@@ -16,10 +16,11 @@
|
|
|
16
16
|
* `RecordProofError` -- the record's authenticity layer: the proof over the
|
|
17
17
|
* frame members by the unlock identity's signing key, verified before any
|
|
18
18
|
* decryption, so a storage host cannot substitute a record it sealed itself.
|
|
19
|
-
* - `mintRecordEncryption` / `
|
|
20
|
-
* `parseRecordCreatedAt` / `recordCreatedAtStamp` --
|
|
21
|
-
* envelope construction the
|
|
22
|
-
*
|
|
19
|
+
* - `mintRecordEncryption` / `recordSealCipher` / `recordCipher` /
|
|
20
|
+
* `parseRecordFrame` / `parseRecordCreatedAt` / `recordCreatedAtStamp` --
|
|
21
|
+
* the record-own-epoch envelope construction the codec seals with (the seal
|
|
22
|
+
* cipher is encrypt-only, so sealing needs no key-agreement secret) plus
|
|
23
|
+
* the frame and plaintext validation it opens with,
|
|
23
24
|
* exported so an app's own locally stored records seal and unseal the same
|
|
24
25
|
* way (under their own cipher context) rather than re-deriving the
|
|
25
26
|
* construction.
|
|
@@ -32,8 +33,8 @@
|
|
|
32
33
|
* Kept out of the root export: this subpath pulls the webkms-client / ezcap /
|
|
33
34
|
* was-client dependency graph (the same isolation pattern as `./identity`).
|
|
34
35
|
*/
|
|
35
|
-
export { deriveUnlockIdentity, KEYRING_KDF, UNLOCK_HANDLE, UNLOCK_KEY_NAME, unlockSpaceIdFor } from './kdf.js';
|
|
36
|
-
export { KEYRING_RECORD_VERSION, mintRecordEncryption, parseRecordCreatedAt, parseRecordFrame, parseRecordPointer, recordCipher, recordCreatedAtStamp, RecordProofError, recordProofKeyMultibase, recordSignerFromAgent, signRecordFrame, unwrapKeyringRecord, verifyRecordProof, wrapKeyringRecord } from './record.js';
|
|
36
|
+
export { deriveUnlockIdentity, deriveUnlockSeed, KEYRING_KDF, UNLOCK_HANDLE, UNLOCK_KEY_NAME, unlockSpaceIdFor } from './kdf.js';
|
|
37
|
+
export { KEYRING_RECORD_VERSION, mintRecordEncryption, parseRecordCreatedAt, parseRecordFrame, parseRecordPointer, recordCipher, recordCreatedAtStamp, RecordProofError, recordProofKeyMultibase, recordSealCipher, recordSignerFromAgent, signRecordFrame, unwrapKeyringRecord, verifyRecordProof, wrapKeyringRecord } from './record.js';
|
|
37
38
|
export { deleteUnlockSpace, deleteUnlockSpaceWithCapability, ensureUnlockSpace, getUnlockKeyring, getUnlockKeyringWithCapability, putUnlockKeyring, putUnlockKeyringWithCapability, UNLOCK_SPACE_NAME } from './unlockSpace.js';
|
|
38
39
|
export { fetchKeyringRecord } from './fetch.js';
|
|
39
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keyring/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keyring/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EACjB,MAAM,UAAU,CAAA;AAGjB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,aAAa,CAAA;AASpB,OAAO,EACL,iBAAiB,EACjB,+BAA+B,EAC/B,iBAAiB,EACjB,gBAAgB,EAChB,8BAA8B,EAC9B,gBAAgB,EAChB,8BAA8B,EAC9B,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/keyring/kdf.d.ts
CHANGED
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
* (RFC 8018 / RFC 5869), so the two implementations agree bit for bit.
|
|
17
17
|
*/
|
|
18
18
|
import { CapabilityAgent } from '@interop/webkms-client';
|
|
19
|
-
import { ZcapClient } from '@interop/ezcap';
|
|
20
|
-
import { X25519KeyAgreementKey2020 } from '@interop/x25519-key-agreement-key';
|
|
21
|
-
import type { IKeyResolver } from '@interop/data-integrity-core';
|
|
22
19
|
/**
|
|
23
20
|
* The load-bearing `CapabilityAgent` derivation names for an unlock identity
|
|
24
21
|
* (the counterpart of the data identity's bootstrap names): every unlock
|
|
@@ -60,6 +57,25 @@ export type UnlockKdf = {
|
|
|
60
57
|
* unlock Space.
|
|
61
58
|
*/
|
|
62
59
|
export declare const KEYRING_KDF: UnlockKdf;
|
|
60
|
+
/**
|
|
61
|
+
* Derives the 32-byte unlock seed from an unlock secret, branching on the KDF
|
|
62
|
+
* family: PBKDF2 stretches a passphrase, HKDF expands already-uniform key
|
|
63
|
+
* material such as a passkey PRF output.
|
|
64
|
+
*
|
|
65
|
+
* Exported for the standing-credential derivation (`unlock/standingClient`):
|
|
66
|
+
* a standing unlock method expands its client identity and binding MAC key
|
|
67
|
+
* from this same seed under distinct HKDF salts, so the expensive stretch
|
|
68
|
+
* runs once per typed secret.
|
|
69
|
+
*
|
|
70
|
+
* @param options {object}
|
|
71
|
+
* @param options.secret {string | Uint8Array}
|
|
72
|
+
* @param options.kdf {UnlockKdf}
|
|
73
|
+
* @returns {Promise<Uint8Array>}
|
|
74
|
+
*/
|
|
75
|
+
export declare function deriveUnlockSeed({ secret, kdf }: {
|
|
76
|
+
secret: string | Uint8Array;
|
|
77
|
+
kdf: UnlockKdf;
|
|
78
|
+
}): Promise<Uint8Array>;
|
|
63
79
|
/**
|
|
64
80
|
* Derives the full unlock identity from an unlock secret: the unlock
|
|
65
81
|
* CapabilityAgent, a ZcapClient that can both invoke and delegate (the
|
|
@@ -79,9 +95,9 @@ export declare function deriveUnlockIdentity({ secret, kdf }: {
|
|
|
79
95
|
kdf: UnlockKdf;
|
|
80
96
|
}): Promise<{
|
|
81
97
|
agent: CapabilityAgent;
|
|
82
|
-
zcapClient: ZcapClient;
|
|
83
|
-
keyAgreementKey:
|
|
84
|
-
keyResolver: IKeyResolver;
|
|
98
|
+
zcapClient: import("@interop/ezcap").ZcapClient;
|
|
99
|
+
keyAgreementKey: import("@interop/data-integrity-core").IKeyAgreementKey;
|
|
100
|
+
keyResolver: import("@interop/data-integrity-core").IKeyResolver;
|
|
85
101
|
recordSigner: import("./record.js").RecordSigner;
|
|
86
102
|
spaceId: string;
|
|
87
103
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kdf.d.ts","sourceRoot":"","sources":["../../src/keyring/kdf.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"kdf.d.ts","sourceRoot":"","sources":["../../src/keyring/kdf.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAQxD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,WAAW,CAAA;AACrC,eAAO,MAAM,eAAe,eAAe,CAAA;AAQ3C;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GACjB;IACE,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,QAAQ,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAEL;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,SAMzB,CAAA;AAmBD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAA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