@interop/wallet-core 0.39.0 → 0.41.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 +5 -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 +32 -22
- package/dist/clients/revocation.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 +44 -4
- 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 +2 -1
- package/dist/keyring/fetch.d.ts.map +1 -1
- package/dist/keyring/fetch.js +7 -2
- package/dist/keyring/fetch.js.map +1 -1
- package/dist/keyring/index.d.ts +16 -9
- package/dist/keyring/index.d.ts.map +1 -1
- package/dist/keyring/index.js +15 -8
- package/dist/keyring/index.js.map +1 -1
- package/dist/keyring/kdf.d.ts +3 -1
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +16 -2
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keyring/record.d.ts +236 -50
- package/dist/keyring/record.d.ts.map +1 -1
- package/dist/keyring/record.js +348 -46
- package/dist/keyring/record.js.map +1 -1
- package/dist/keyring/unlockSpace.d.ts +25 -0
- package/dist/keyring/unlockSpace.d.ts.map +1 -1
- package/dist/keyring/unlockSpace.js +31 -2
- package/dist/keyring/unlockSpace.js.map +1 -1
- package/dist/keys/index.d.ts +4 -2
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +2 -1
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +18 -1
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +34 -6
- package/dist/keys/rosterLogStore.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 +39 -24
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +28 -77
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/recovery/index.d.ts +16 -3
- package/dist/recovery/index.d.ts.map +1 -1
- package/dist/recovery/index.js +14 -2
- package/dist/recovery/index.js.map +1 -1
- package/dist/recovery/recoveryCode.d.ts +7 -0
- package/dist/recovery/recoveryCode.d.ts.map +1 -1
- package/dist/recovery/recoveryCode.js +10 -0
- package/dist/recovery/recoveryCode.js.map +1 -1
- package/dist/recovery/recoveryDelegation.d.ts +120 -0
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -0
- package/dist/recovery/recoveryDelegation.js +216 -0
- package/dist/recovery/recoveryDelegation.js.map +1 -0
- package/dist/recovery/recoveryRecord.d.ts +138 -46
- package/dist/recovery/recoveryRecord.d.ts.map +1 -1
- package/dist/recovery/recoveryRecord.js +231 -30
- package/dist/recovery/recoveryRecord.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +20 -14
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/request/index.d.ts +1 -1
- package/dist/request/index.js +1 -1
- package/dist/request/matching.d.ts +24 -5
- package/dist/request/matching.d.ts.map +1 -1
- package/dist/request/matching.js +36 -39
- package/dist/request/matching.js.map +1 -1
- package/dist/request/walletInput.d.ts.map +1 -1
- package/dist/request/walletInput.js +3 -6
- package/dist/request/walletInput.js.map +1 -1
- package/dist/resourceLog/controller.d.ts +7 -4
- package/dist/resourceLog/controller.d.ts.map +1 -1
- package/dist/resourceLog/controller.js +17 -35
- package/dist/resourceLog/controller.js.map +1 -1
- package/dist/resourceLog/index.d.ts +1 -0
- package/dist/resourceLog/index.d.ts.map +1 -1
- package/dist/resourceLog/index.js +1 -0
- package/dist/resourceLog/index.js.map +1 -1
- package/dist/resourceLog/seal.d.ts +9 -1
- package/dist/resourceLog/seal.d.ts.map +1 -1
- package/dist/resourceLog/seal.js +21 -11
- package/dist/resourceLog/seal.js.map +1 -1
- package/dist/resourceLog/verify.d.ts.map +1 -1
- package/dist/resourceLog/verify.js +26 -9
- package/dist/resourceLog/verify.js.map +1 -1
- package/dist/resourceLog/vmFragment.d.ts +33 -0
- package/dist/resourceLog/vmFragment.d.ts.map +1 -0
- package/dist/resourceLog/vmFragment.js +39 -0
- package/dist/resourceLog/vmFragment.js.map +1 -0
- package/dist/space/publicLink.d.ts +2 -0
- package/dist/space/publicLink.d.ts.map +1 -1
- package/dist/space/publicLink.js +13 -1
- package/dist/space/publicLink.js.map +1 -1
- package/dist/space/wasLink.d.ts +5 -0
- package/dist/space/wasLink.d.ts.map +1 -1
- package/dist/space/wasLink.js +7 -2
- package/dist/space/wasLink.js.map +1 -1
- package/dist/webvh/didWeb.d.ts +3 -11
- package/dist/webvh/didWeb.d.ts.map +1 -1
- package/dist/webvh/didWeb.js +5 -1
- package/dist/webvh/didWeb.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +72 -1
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +111 -12
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/index.d.ts +9 -2
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +8 -2
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/keyAgreement.d.ts +56 -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 -18
- package/dist/webvh/listClients.d.ts.map +1 -1
- package/dist/webvh/listClients.js +141 -36
- 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.map +1 -1
- package/dist/webvh/verifyLog.js +5 -1
- package/dist/webvh/verifyLog.js.map +1 -1
- package/package.json +4 -4
|
@@ -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,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
|
@@ -11,12 +11,19 @@
|
|
|
11
11
|
* unchanged where WebCrypto's `deriveBits` is unavailable) and the unlock
|
|
12
12
|
* Space addressing convention.
|
|
13
13
|
* - `wrapKeyringRecord` / `unwrapKeyringRecord` -- the
|
|
14
|
-
* `{ version, encryption, wrapped }` account-pointer record codec.
|
|
15
|
-
* - `
|
|
16
|
-
* record
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* `{ version, encryption, wrapped, proof }` account-pointer record codec.
|
|
15
|
+
* - `recordSignerFromAgent` / `signRecordFrame` / `verifyRecordProof` /
|
|
16
|
+
* `RecordProofError` -- the record's authenticity layer: the proof over the
|
|
17
|
+
* frame members by the unlock identity's signing key, verified before any
|
|
18
|
+
* decryption, so a storage host cannot substitute a record it sealed itself.
|
|
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,
|
|
24
|
+
* exported so an app's own locally stored records seal and unseal the same
|
|
25
|
+
* way (under their own cipher context) rather than re-deriving the
|
|
26
|
+
* construction.
|
|
20
27
|
* - `ensureUnlockSpace` / `getUnlockKeyring` / `putUnlockKeyring` /
|
|
21
28
|
* `deleteUnlockSpace` / `deleteUnlockSpaceWithCapability` -- the unlock
|
|
22
29
|
* Space's lifecycle and its one resource.
|
|
@@ -27,7 +34,7 @@
|
|
|
27
34
|
* was-client dependency graph (the same isolation pattern as `./identity`).
|
|
28
35
|
*/
|
|
29
36
|
export { deriveUnlockIdentity, KEYRING_KDF, UNLOCK_HANDLE, UNLOCK_KEY_NAME, unlockSpaceIdFor } from './kdf.js';
|
|
30
|
-
export { KEYRING_RECORD_VERSION, mintRecordEncryption, parseRecordFrame, parseRecordPointer, recordCipher, unwrapKeyringRecord, wrapKeyringRecord } from './record.js';
|
|
31
|
-
export { deleteUnlockSpace, deleteUnlockSpaceWithCapability, ensureUnlockSpace, getUnlockKeyring, putUnlockKeyring, putUnlockKeyringWithCapability, UNLOCK_SPACE_NAME } from './unlockSpace.js';
|
|
37
|
+
export { KEYRING_RECORD_VERSION, mintRecordEncryption, parseRecordCreatedAt, parseRecordFrame, parseRecordPointer, recordCipher, recordCreatedAtStamp, RecordProofError, recordProofKeyMultibase, recordSealCipher, recordSignerFromAgent, signRecordFrame, unwrapKeyringRecord, verifyRecordProof, wrapKeyringRecord } from './record.js';
|
|
38
|
+
export { deleteUnlockSpace, deleteUnlockSpaceWithCapability, ensureUnlockSpace, getUnlockKeyring, getUnlockKeyringWithCapability, putUnlockKeyring, putUnlockKeyringWithCapability, UNLOCK_SPACE_NAME } from './unlockSpace.js';
|
|
32
39
|
export { fetchKeyringRecord } from './fetch.js';
|
|
33
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,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
|
@@ -64,7 +64,8 @@ export declare const KEYRING_KDF: UnlockKdf;
|
|
|
64
64
|
* Derives the full unlock identity from an unlock secret: the unlock
|
|
65
65
|
* CapabilityAgent, a ZcapClient that can both invoke and delegate (the
|
|
66
66
|
* unlock agent delegates a management zcap on its own Space to the account
|
|
67
|
-
* controller at bind time), the unlock KAK + resolver for wrap/unwrap,
|
|
67
|
+
* controller at bind time), the unlock KAK + resolver for wrap/unwrap, the
|
|
68
|
+
* record signer that signs and verifies the keyring record's proof, and the
|
|
68
69
|
* unlock Space id. Performs no I/O -- the derivation seam for tests and future
|
|
69
70
|
* unlock methods.
|
|
70
71
|
*
|
|
@@ -81,6 +82,7 @@ export declare function deriveUnlockIdentity({ secret, kdf }: {
|
|
|
81
82
|
zcapClient: ZcapClient;
|
|
82
83
|
keyAgreementKey: X25519KeyAgreementKey2020;
|
|
83
84
|
keyResolver: IKeyResolver;
|
|
85
|
+
recordSigner: import("./record.js").RecordSigner;
|
|
84
86
|
spaceId: string;
|
|
85
87
|
}>;
|
|
86
88
|
/**
|
|
@@ -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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B,gBAAgB,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEjE;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAA"}
|
package/dist/keyring/kdf.js
CHANGED
|
@@ -24,6 +24,7 @@ import { hkdf } from '@noble/hashes/hkdf.js';
|
|
|
24
24
|
import { pbkdf2Async } from '@noble/hashes/pbkdf2.js';
|
|
25
25
|
import { sha256, sha512 } from '@noble/hashes/sha2.js';
|
|
26
26
|
import { singleKeyResolver } from '../identity/keyResolver.js';
|
|
27
|
+
import { recordSignerFromAgent } from './record.js';
|
|
27
28
|
/**
|
|
28
29
|
* The load-bearing `CapabilityAgent` derivation names for an unlock identity
|
|
29
30
|
* (the counterpart of the data identity's bootstrap names): every unlock
|
|
@@ -101,7 +102,8 @@ async function deriveUnlockSeed({ secret, kdf }) {
|
|
|
101
102
|
* Derives the full unlock identity from an unlock secret: the unlock
|
|
102
103
|
* CapabilityAgent, a ZcapClient that can both invoke and delegate (the
|
|
103
104
|
* unlock agent delegates a management zcap on its own Space to the account
|
|
104
|
-
* controller at bind time), the unlock KAK + resolver for wrap/unwrap,
|
|
105
|
+
* controller at bind time), the unlock KAK + resolver for wrap/unwrap, the
|
|
106
|
+
* record signer that signs and verifies the keyring record's proof, and the
|
|
105
107
|
* unlock Space id. Performs no I/O -- the derivation seam for tests and future
|
|
106
108
|
* unlock methods.
|
|
107
109
|
*
|
|
@@ -130,8 +132,20 @@ export async function deriveUnlockIdentity({ secret, kdf }) {
|
|
|
130
132
|
keyPair: agent.getVerificationKeyPair()
|
|
131
133
|
});
|
|
132
134
|
const keyResolver = singleKeyResolver({ keyAgreementKey });
|
|
135
|
+
// The record signer is the unlock signing key itself, named by its public
|
|
136
|
+
// multibase: the keyring record's proof is made and checked against a key
|
|
137
|
+
// that derives from the secret, so the storage host never holds it and a
|
|
138
|
+
// fresh client holds the verification prior by construction.
|
|
139
|
+
const recordSigner = recordSignerFromAgent({ keyAgent: agent });
|
|
133
140
|
const spaceId = unlockSpaceIdFor({ did: agent.id });
|
|
134
|
-
return {
|
|
141
|
+
return {
|
|
142
|
+
agent,
|
|
143
|
+
zcapClient,
|
|
144
|
+
keyAgreementKey,
|
|
145
|
+
keyResolver,
|
|
146
|
+
recordSigner,
|
|
147
|
+
spaceId
|
|
148
|
+
};
|
|
135
149
|
}
|
|
136
150
|
/**
|
|
137
151
|
* The unlock Space id an unlock identity addresses:
|
package/dist/keyring/kdf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kdf.js","sourceRoot":"","sources":["../../src/keyring/kdf.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;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;AAE7E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"kdf.js","sourceRoot":"","sources":["../../src/keyring/kdf.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,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AO,EAAE,KAAK,CAAC,sBAAsB,EAAE;KACxC,CAAC,CAAA;IACJ,MAAM,WAAW,GAAiB,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC,CAAA;IAExE,0EAA0E;IAC1E,0EAA0E;IAC1E,yEAAyE;IACzE,6DAA6D;IAC7D,MAAM,YAAY,GAAG,qBAAqB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;IAE/D,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;IACnD,OAAO;QACL,KAAK;QACL,UAAU;QACV,eAAe;QACf,WAAW;QACX,YAAY;QACZ,OAAO;KACR,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,GAAG,EAAmB;IACvD,OAAO,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AACrE,CAAC"}
|
package/dist/keyring/record.d.ts
CHANGED
|
@@ -1,31 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { IKeyAgreementKey, IKeyResolver } from '@interop/data-integrity-core';
|
|
2
|
+
import type { CollectionEncryption } from '@interop/was-client';
|
|
3
|
+
import { type DocCipher } from '@interop/was-client/edv';
|
|
4
|
+
/**
|
|
5
|
+
* The version stamped on the stored `{ version, encryption, wrapped, proof }`
|
|
6
|
+
* keyring envelope: the signed record, whose envelope seals under the record's
|
|
7
|
+
* own key epoch (the `encryption` member) and whose sibling members carry a
|
|
8
|
+
* Data Integrity proof by the unlock identity's signing key. Any other version
|
|
9
|
+
* is refused as unusable -- such accounts are re-provisioned, not migrated.
|
|
10
|
+
*/
|
|
11
|
+
export declare const KEYRING_RECORD_VERSION = 2;
|
|
12
|
+
/**
|
|
13
|
+
* The record signer's seam: the signing key's public multibase (which names
|
|
14
|
+
* the key in the proof's `verificationMethod`) and a raw detached-signature
|
|
15
|
+
* hook over it. Structurally the resource log's `ResourceLogSigner`, so one
|
|
16
|
+
* adapter feeds both, deliberately restated here rather than imported -- a
|
|
17
|
+
* record is not a log, and the keyring module keeps its own vocabulary.
|
|
18
|
+
*/
|
|
19
|
+
export interface RecordSigner {
|
|
20
|
+
keyMultibase: string;
|
|
21
|
+
sign(input: {
|
|
22
|
+
data: Uint8Array;
|
|
23
|
+
}): Promise<Uint8Array>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The fixed proof shape a signed record carries: an eddsa-jcs-2022 Data
|
|
27
|
+
* Integrity proof over the record's sibling members, `assertionMethod`
|
|
28
|
+
* purpose, with the signing key named by a `did:key:<multibase>#<multibase>`
|
|
29
|
+
* verification method.
|
|
30
|
+
*/
|
|
31
|
+
export interface RecordProof {
|
|
32
|
+
type: 'DataIntegrityProof';
|
|
33
|
+
cryptosuite: 'eddsa-jcs-2022';
|
|
34
|
+
verificationMethod: string;
|
|
35
|
+
proofPurpose: 'assertionMethod';
|
|
36
|
+
created?: string;
|
|
37
|
+
proofValue: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A stored signed record: the frame members the proof secures, plus the proof
|
|
41
|
+
* itself.
|
|
42
|
+
*/
|
|
43
|
+
export interface SignedRecord {
|
|
44
|
+
version: number;
|
|
45
|
+
encryption: CollectionEncryption;
|
|
46
|
+
wrapped: unknown;
|
|
47
|
+
proof: RecordProof;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A record's proof is absent, malformed, signed by a key this client does not
|
|
51
|
+
* accept, or does not verify over the record's own members. Its own class,
|
|
52
|
+
* distinct from a decrypt failure or an unusable-version refusal: this is the
|
|
53
|
+
* refusal that says the storage host forged or tampered with the record, which
|
|
54
|
+
* an app maps to its own login copy.
|
|
3
55
|
*/
|
|
56
|
+
export declare class RecordProofError extends Error {
|
|
57
|
+
constructor(message: string, options?: {
|
|
58
|
+
cause?: unknown;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
4
61
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* account pointer -- and deliberately no key material of any kind, so the
|
|
9
|
-
* record locates an account without authorizing anything against it.
|
|
62
|
+
* Adapts a signing key agent (the unlock identity's `CapabilityAgent`, or an
|
|
63
|
+
* enrolled client's own key agent) to the record signer seam: the agent's
|
|
64
|
+
* did:key id supplies the public multibase, its signer the raw signature.
|
|
10
65
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* unlock key-agreement key. The record stays self-contained -- unlock KAK in,
|
|
15
|
-
* contents out. The cipher's `keyring` collection context labels errors only
|
|
16
|
-
* (the codec is agnostic to it); what keeps a swapped-in foreign record from
|
|
17
|
-
* being accepted is the contents validation on unwrap, not the cipher.
|
|
66
|
+
* @param options {object}
|
|
67
|
+
* @param options.keyAgent {object} a did:key `CapabilityAgent`-shaped agent
|
|
68
|
+
* @returns {RecordSigner}
|
|
18
69
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
70
|
+
export declare function recordSignerFromAgent({ keyAgent }: {
|
|
71
|
+
keyAgent: {
|
|
72
|
+
id: string;
|
|
73
|
+
getSigner: () => {
|
|
74
|
+
sign: (input: {
|
|
75
|
+
data: Uint8Array;
|
|
76
|
+
}) => Promise<Uint8Array>;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
}): RecordSigner;
|
|
22
80
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
81
|
+
* Signs a record's frame members and returns the stored signed record. Shared
|
|
82
|
+
* by the keyring and recovery wrap paths (and available to an app's own record
|
|
83
|
+
* kinds), so one construction produces every signed record: the proof covers
|
|
84
|
+
* `{ version, encryption, wrapped }` plus any record-kind members under JCS
|
|
85
|
+
* canonicalization.
|
|
86
|
+
*
|
|
87
|
+
* @param options {object}
|
|
88
|
+
* @param options.version {number} the frame version to stamp
|
|
89
|
+
* @param options.encryption {CollectionEncryption} the record's descriptor
|
|
90
|
+
* @param options.wrapped {unknown} the sealed envelope
|
|
91
|
+
* @param options.signer {RecordSigner} the signing key
|
|
92
|
+
* @param [options.members] {object} additional record-kind frame members the
|
|
93
|
+
* proof must cover (e.g. the recovery record's `binding`)
|
|
94
|
+
* @returns {Promise<SignedRecord>}
|
|
27
95
|
*/
|
|
28
|
-
export declare
|
|
96
|
+
export declare function signRecordFrame({ version, encryption, wrapped, signer, members }: {
|
|
97
|
+
version: number;
|
|
98
|
+
encryption: CollectionEncryption;
|
|
99
|
+
wrapped: unknown;
|
|
100
|
+
signer: RecordSigner;
|
|
101
|
+
members?: Record<string, unknown>;
|
|
102
|
+
}): Promise<SignedRecord>;
|
|
103
|
+
/**
|
|
104
|
+
* The signing key's public multibase named by a proof's `verificationMethod`:
|
|
105
|
+
* its fragment. The signer emits `did:key:<multibase>#<multibase>`; the DID
|
|
106
|
+
* half is not what authorizes anything -- the multibase IS the key, and the
|
|
107
|
+
* caller's allowlist decides whether it may sign this record.
|
|
108
|
+
*
|
|
109
|
+
* @param options {object}
|
|
110
|
+
* @param options.verificationMethod {string}
|
|
111
|
+
* @param options.label {string} names the record kind in the refusal
|
|
112
|
+
* @returns {string}
|
|
113
|
+
*/
|
|
114
|
+
export declare function recordProofKeyMultibase({ verificationMethod, label }: {
|
|
115
|
+
verificationMethod: string;
|
|
116
|
+
label: string;
|
|
117
|
+
}): string;
|
|
29
118
|
/**
|
|
30
119
|
* Mints the one-epoch descriptor a fresh record is sealed under: epoch[0]
|
|
31
120
|
* wrapped to the given KAK alone, built through `initRecipients` against a
|
|
@@ -44,12 +133,14 @@ export declare function mintRecordEncryption({ keyAgreementKey }: {
|
|
|
44
133
|
keyAgreementKey: IKeyAgreementKey;
|
|
45
134
|
}): Promise<CollectionEncryption>;
|
|
46
135
|
/**
|
|
47
|
-
* Builds the record cipher: an EDV cipher over the record's own
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* kind
|
|
136
|
+
* Builds the record's reading cipher: an EDV cipher over the record's own
|
|
137
|
+
* descriptor, from the reader's key-agreement key. The unwrap paths' cipher
|
|
138
|
+
* (and the recovery record's, which reuses the keyring cipher context
|
|
139
|
+
* verbatim); the wrap paths seal through {@link recordSealCipher} instead. An
|
|
140
|
+
* app's own record kind passes its own `collectionId` so its failures name
|
|
141
|
+
* the record kind. The context labels errors only -- the codec is agnostic to
|
|
142
|
+
* it, so a record kind's real swap protection is its contents validation on
|
|
143
|
+
* unwrap.
|
|
53
144
|
*
|
|
54
145
|
* @param options {object}
|
|
55
146
|
* @param options.keyAgreementKey {IKeyAgreementKey} the wrapping KAK (for
|
|
@@ -66,12 +157,37 @@ export declare function recordCipher({ keyAgreementKey, keyResolver, encryption,
|
|
|
66
157
|
encryption: CollectionEncryption;
|
|
67
158
|
collectionId?: string;
|
|
68
159
|
}): Promise<DocCipher>;
|
|
160
|
+
/**
|
|
161
|
+
* Builds the record's sealing cipher: an encrypt-only EDV cipher over the
|
|
162
|
+
* record's own descriptor, needing no key-agreement secret -- a write seals to
|
|
163
|
+
* the descriptor's epoch public key, reconstructed from the epoch id. This is
|
|
164
|
+
* what lets the recovery re-mint, which holds only the code's unlock KAK
|
|
165
|
+
* public half, re-seal a record it can never open; the issuance wraps go
|
|
166
|
+
* through the same construction and produce the same envelope shape. Decrypt
|
|
167
|
+
* on it refuses with was-client's typed `EncryptOnlyCipherError`.
|
|
168
|
+
*
|
|
169
|
+
* @param options {object}
|
|
170
|
+
* @param options.encryption {CollectionEncryption} the record's descriptor
|
|
171
|
+
* @param [options.collectionId] {string} the cipher context failures are
|
|
172
|
+
* labeled with; defaults to the keyring context
|
|
173
|
+
* @returns {Promise<DocCipher>}
|
|
174
|
+
*/
|
|
175
|
+
export declare function recordSealCipher({ encryption, collectionId }: {
|
|
176
|
+
encryption: CollectionEncryption;
|
|
177
|
+
collectionId?: string;
|
|
178
|
+
}): Promise<DocCipher>;
|
|
69
179
|
/**
|
|
70
180
|
* Validates the common `{ version, encryption, wrapped }` frame of a stored
|
|
71
181
|
* record (keyring or recovery -- `label` names the refusals) and returns its
|
|
72
|
-
* members. Exported so an app's
|
|
73
|
-
*
|
|
74
|
-
* the version and shape checks.
|
|
182
|
+
* members, the `proof` among them for the signed frame. Exported so an app's
|
|
183
|
+
* own record kinds open their records through the same frame validation the
|
|
184
|
+
* codec here seals with, rather than re-deriving the version and shape checks.
|
|
185
|
+
*
|
|
186
|
+
* A frame at the keyring record version is the signed frame, so it must carry
|
|
187
|
+
* a fixed-shape proof; a record kind stamping its own version is unaffected
|
|
188
|
+
* (its authenticity story is its own). Validating the shape here does not
|
|
189
|
+
* verify it -- {@link verifyRecordProof} does, and every unwrap path in this
|
|
190
|
+
* module runs it before decrypting.
|
|
75
191
|
*
|
|
76
192
|
* @param options {object}
|
|
77
193
|
* @param options.record {unknown}
|
|
@@ -79,7 +195,8 @@ export declare function recordCipher({ keyAgreementKey, keyResolver, encryption,
|
|
|
79
195
|
* kind's own label
|
|
80
196
|
* @param [options.version] {number} the version the frame must carry;
|
|
81
197
|
* defaults to the keyring record version
|
|
82
|
-
* @returns {{ encryption: CollectionEncryption, wrapped: unknown
|
|
198
|
+
* @returns {{ encryption: CollectionEncryption, wrapped: unknown,
|
|
199
|
+
* proof?: RecordProof }}
|
|
83
200
|
*/
|
|
84
201
|
export declare function parseRecordFrame({ record, label, version }: {
|
|
85
202
|
record: unknown;
|
|
@@ -88,7 +205,34 @@ export declare function parseRecordFrame({ record, label, version }: {
|
|
|
88
205
|
}): {
|
|
89
206
|
encryption: CollectionEncryption;
|
|
90
207
|
wrapped: unknown;
|
|
208
|
+
proof?: RecordProof;
|
|
91
209
|
};
|
|
210
|
+
/**
|
|
211
|
+
* Verifies a stored record's proof: the fixed proof shape, the signing key
|
|
212
|
+
* against the caller's allowlist, and the signature over the record's sibling
|
|
213
|
+
* members (everything except `proof`, JCS-canonicalized). Refuses with
|
|
214
|
+
* {@link RecordProofError} in every failing case -- a class of its own, so an
|
|
215
|
+
* app tells "the host forged or tampered with this record" apart from a wrong
|
|
216
|
+
* unlock secret or an unusable version.
|
|
217
|
+
*
|
|
218
|
+
* Standalone as well as internal, because the recovery record's re-minted
|
|
219
|
+
* signer is only knowable after the record is decrypted (see
|
|
220
|
+
* `unwrapRecoveryRecord`).
|
|
221
|
+
*
|
|
222
|
+
* @param options {object}
|
|
223
|
+
* @param options.record {unknown} the stored record, proof included
|
|
224
|
+
* @param options.allowedKeyMultibases {string | string[]} the signing keys
|
|
225
|
+
* this caller accepts, as public multibases or as verification-method ids
|
|
226
|
+
* whose fragment is one
|
|
227
|
+
* @param [options.label] {string} names the record kind in refusals;
|
|
228
|
+
* defaults to the keyring record
|
|
229
|
+
* @returns {Promise<string>} the verified signing key's public multibase
|
|
230
|
+
*/
|
|
231
|
+
export declare function verifyRecordProof({ record, allowedKeyMultibases, label }: {
|
|
232
|
+
record: unknown;
|
|
233
|
+
allowedKeyMultibases: string | string[];
|
|
234
|
+
label?: string;
|
|
235
|
+
}): Promise<string>;
|
|
92
236
|
/**
|
|
93
237
|
* The account pointer a keyring record carries in place of the retired data
|
|
94
238
|
* seed: where the account lives (`spaceId` + `host`, the WAS server origin)
|
|
@@ -111,51 +255,93 @@ export interface KeyringRecordContents {
|
|
|
111
255
|
controller: string;
|
|
112
256
|
email?: string;
|
|
113
257
|
pointer?: AccountPointer;
|
|
258
|
+
createdAt: string;
|
|
114
259
|
}
|
|
115
260
|
/**
|
|
116
261
|
* Wraps the account-pointer contents into a keyring record: the controller,
|
|
117
262
|
* email, and pointer (+ timestamp) sealed under a freshly minted record epoch
|
|
118
|
-
* whose key is wrapped to the unlock KAK
|
|
119
|
-
* of any kind.
|
|
263
|
+
* whose key is wrapped to the unlock KAK, then signed by the unlock identity's
|
|
264
|
+
* signing key. Deliberately carries no key material of any kind.
|
|
265
|
+
*
|
|
266
|
+
* The timestamp stays inside the plaintext (the signature covers the
|
|
267
|
+
* ciphertext, so it is covered transitively), so bind times do not leak to a
|
|
268
|
+
* reader of the unlock Space.
|
|
120
269
|
*
|
|
121
270
|
* @param options {object}
|
|
122
271
|
* @param options.controller {string} the account did:key
|
|
123
272
|
* @param [options.email] {string} the account email, when known
|
|
124
273
|
* @param [options.pointer] {AccountPointer} the account pointer (absent on
|
|
125
274
|
* no-WAS deployments)
|
|
126
|
-
* @param options.keyAgreementKey {IKeyAgreementKey} the unlock KAK
|
|
127
|
-
*
|
|
128
|
-
* @
|
|
129
|
-
*
|
|
275
|
+
* @param options.keyAgreementKey {IKeyAgreementKey} the unlock KAK (its
|
|
276
|
+
* public half is all the wrap uses: sealing needs no key-agreement secret)
|
|
277
|
+
* @param options.signer {RecordSigner} the unlock identity's signing key
|
|
278
|
+
* (`recordSignerFromAgent` over the unlock agent)
|
|
279
|
+
* @param [options.createdAt] {string} the bind timestamp to stamp, as an ISO
|
|
280
|
+
* string; defaults to now. Supplied by a caller that pins record freshness,
|
|
281
|
+
* so it knows the stamp without unwrapping the record it just wrote.
|
|
282
|
+
* @returns {Promise<SignedRecord>}
|
|
130
283
|
*/
|
|
131
|
-
export declare function wrapKeyringRecord({ controller, email, pointer, keyAgreementKey,
|
|
284
|
+
export declare function wrapKeyringRecord({ controller, email, pointer, keyAgreementKey, signer, createdAt }: {
|
|
132
285
|
controller: string;
|
|
133
286
|
email?: string;
|
|
134
287
|
pointer?: AccountPointer;
|
|
135
288
|
keyAgreementKey: IKeyAgreementKey;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
encryption: CollectionEncryption;
|
|
140
|
-
wrapped: unknown;
|
|
141
|
-
}>;
|
|
289
|
+
signer: RecordSigner;
|
|
290
|
+
createdAt?: string;
|
|
291
|
+
}): Promise<SignedRecord>;
|
|
142
292
|
/**
|
|
143
|
-
* Unwraps and validates a keyring record.
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
293
|
+
* Unwraps and validates a keyring record. Verifies the record's proof against
|
|
294
|
+
* the unlock identity's own signing key BEFORE decrypting -- there is no
|
|
295
|
+
* unwrap path that skips it, so a record the storage host substituted is
|
|
296
|
+
* refused ({@link RecordProofError}) rather than decrypted and inspected.
|
|
297
|
+
* Rejects a record whose `version` is not the current one (accounts are
|
|
298
|
+
* re-provisioned, not migrated), and sanity-checks the decrypted plaintext
|
|
299
|
+
* (non-empty controller, well-formed pointer when present, a parseable
|
|
300
|
+
* `createdAt`).
|
|
147
301
|
*
|
|
148
302
|
* @param options {object}
|
|
149
303
|
* @param options.record {unknown}
|
|
150
304
|
* @param options.keyAgreementKey {IKeyAgreementKey} the unlock KAK
|
|
151
305
|
* @param options.keyResolver {IKeyResolver}
|
|
306
|
+
* @param options.expectedKeyMultibase {string} the unlock identity's signing
|
|
307
|
+
* key multibase, derived from the typed secret -- the only key that may have
|
|
308
|
+
* signed this record
|
|
152
309
|
* @returns {Promise<KeyringRecordContents>}
|
|
153
310
|
*/
|
|
154
|
-
export declare function unwrapKeyringRecord({ record, keyAgreementKey, keyResolver }: {
|
|
311
|
+
export declare function unwrapKeyringRecord({ record, keyAgreementKey, keyResolver, expectedKeyMultibase }: {
|
|
155
312
|
record: unknown;
|
|
156
313
|
keyAgreementKey: IKeyAgreementKey;
|
|
157
314
|
keyResolver: IKeyResolver;
|
|
315
|
+
expectedKeyMultibase: string;
|
|
158
316
|
}): Promise<KeyringRecordContents>;
|
|
317
|
+
/**
|
|
318
|
+
* The bind timestamp a wrap path stamps into a record's plaintext: the
|
|
319
|
+
* caller's, validated as a parseable ISO timestamp, or now. A caller supplies
|
|
320
|
+
* one when it pins record freshness, so it knows the stamp of the record it is
|
|
321
|
+
* writing without reading it back.
|
|
322
|
+
*
|
|
323
|
+
* @param options {object}
|
|
324
|
+
* @param [options.createdAt] {string} the caller's timestamp
|
|
325
|
+
* @returns {string}
|
|
326
|
+
*/
|
|
327
|
+
export declare function recordCreatedAtStamp({ createdAt }: {
|
|
328
|
+
createdAt?: string;
|
|
329
|
+
}): string;
|
|
330
|
+
/**
|
|
331
|
+
* Parses and validates the required `createdAt` member of a record plaintext:
|
|
332
|
+
* the moment the record was bound, as an ISO timestamp that must parse. Apps
|
|
333
|
+
* pin freshness on it, so a record that cannot state its own bind time is
|
|
334
|
+
* refused rather than defaulted.
|
|
335
|
+
*
|
|
336
|
+
* @param options {object}
|
|
337
|
+
* @param options.value {unknown} the plaintext's `createdAt` member
|
|
338
|
+
* @param options.label {string} names the record kind in the refusal
|
|
339
|
+
* @returns {string}
|
|
340
|
+
*/
|
|
341
|
+
export declare function parseRecordCreatedAt({ value, label }: {
|
|
342
|
+
value: unknown;
|
|
343
|
+
label: string;
|
|
344
|
+
}): string;
|
|
159
345
|
/**
|
|
160
346
|
* Parses and validates the optional `pointer` member of a keyring record
|
|
161
347
|
* plaintext. An absent member is a no-WAS record (returns undefined); a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/keyring/record.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/keyring/record.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAKL,KAAK,SAAS,EAEf,MAAM,yBAAyB,CAAA;AAGhC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CACvD;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,oBAAo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