@interop/wallet-core 0.108.0 → 0.109.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 -5
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +3 -3
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +3 -3
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
- package/dist/clientAnnex/establish.d.ts +5 -5
- package/dist/clientAnnex/establish.d.ts.map +1 -1
- package/dist/clientAnnex/establish.js +15 -12
- package/dist/clientAnnex/establish.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +2 -2
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +2 -2
- package/dist/clientAnnex/forgetLast.js.map +1 -1
- package/dist/clientAnnex/gc.d.ts +6 -6
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +9 -9
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/heal.d.ts +5 -5
- package/dist/clientAnnex/heal.d.ts.map +1 -1
- package/dist/clientAnnex/heal.js +16 -13
- package/dist/clientAnnex/heal.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts +5 -5
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +7 -7
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +31 -30
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +41 -40
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clientAnnex/mend.d.ts.map +1 -1
- package/dist/clientAnnex/mend.js +22 -16
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
- package/dist/clientAnnex/selfEnroll.js +5 -6
- package/dist/clientAnnex/selfEnroll.js.map +1 -1
- package/dist/clientAnnex/spaceCapability.d.ts +6 -6
- package/dist/clientAnnex/spaceCapability.d.ts.map +1 -1
- package/dist/clientAnnex/spaceCapability.js +9 -12
- package/dist/clientAnnex/spaceCapability.js.map +1 -1
- package/dist/clients/index.d.ts +1 -1
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/listing.d.ts +12 -18
- package/dist/clients/listing.d.ts.map +1 -1
- package/dist/clients/listing.js +17 -13
- package/dist/clients/listing.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +4 -4
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +5 -4
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/connections/grantProof.d.ts.map +1 -1
- package/dist/connections/grantProof.js +4 -5
- package/dist/connections/grantProof.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +4 -5
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +4 -4
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +4 -4
- package/dist/genesis/accountGenesis.js.map +1 -1
- package/dist/keyring/fetch.d.ts +3 -3
- package/dist/keyring/fetch.d.ts.map +1 -1
- package/dist/keyring/fetch.js +3 -3
- package/dist/keyring/fetch.js.map +1 -1
- package/dist/keyring/record.d.ts.map +1 -1
- package/dist/keyring/record.js +1 -2
- package/dist/keyring/record.js.map +1 -1
- package/dist/keyring/recordEnvelope.d.ts +8 -6
- package/dist/keyring/recordEnvelope.d.ts.map +1 -1
- package/dist/keyring/recordEnvelope.js +12 -6
- package/dist/keyring/recordEnvelope.js.map +1 -1
- package/dist/keyring/unlockSpace.d.ts +15 -15
- package/dist/keyring/unlockSpace.d.ts.map +1 -1
- package/dist/keyring/unlockSpace.js +18 -19
- package/dist/keyring/unlockSpace.js.map +1 -1
- package/dist/keys/collectionLogStore.d.ts +3 -3
- package/dist/keys/collectionLogStore.d.ts.map +1 -1
- package/dist/keys/collectionLogStore.js +5 -7
- package/dist/keys/collectionLogStore.js.map +1 -1
- package/dist/keys/rosterStore.d.ts +3 -3
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +3 -4
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
- package/dist/recovery/recoveryDelegation.js +2 -21
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/space/collections.d.ts +2 -2
- package/dist/space/collections.js +2 -2
- package/dist/space/deleteSpace.d.ts +3 -3
- package/dist/space/deleteSpace.d.ts.map +1 -1
- package/dist/space/deleteSpace.js +3 -4
- package/dist/space/deleteSpace.js.map +1 -1
- package/dist/space/errors.d.ts +1 -1
- package/dist/space/errors.js +1 -1
- package/dist/space/index.d.ts +4 -4
- package/dist/space/index.js +3 -3
- package/dist/space/provisioning.d.ts.map +1 -1
- package/dist/space/provisioning.js +6 -5
- package/dist/space/provisioning.js.map +1 -1
- package/dist/space/publicLink.d.ts +4 -4
- package/dist/space/publicLink.d.ts.map +1 -1
- package/dist/space/publicLink.js +9 -8
- package/dist/space/publicLink.js.map +1 -1
- package/dist/space/pwsLink.d.ts +58 -0
- package/dist/space/pwsLink.d.ts.map +1 -0
- package/dist/space/{wasLink.js → pwsLink.js} +42 -37
- package/dist/space/pwsLink.js.map +1 -0
- package/dist/testing/accountBuilder.d.ts +19 -19
- package/dist/testing/accountBuilder.d.ts.map +1 -1
- package/dist/testing/accountBuilder.js +44 -40
- package/dist/testing/accountBuilder.js.map +1 -1
- package/dist/unlock/unlockRecord.d.ts.map +1 -1
- package/dist/unlock/unlockRecord.js +7 -7
- package/dist/unlock/unlockRecord.js.map +1 -1
- package/dist/webvh/clientAnnexDid.d.ts +21 -14
- package/dist/webvh/clientAnnexDid.d.ts.map +1 -1
- package/dist/webvh/clientAnnexDid.js +19 -14
- package/dist/webvh/clientAnnexDid.js.map +1 -1
- package/dist/webvh/delegatedLogStore.d.ts +3 -3
- package/dist/webvh/delegatedLogStore.d.ts.map +1 -1
- package/dist/webvh/delegatedLogStore.js +9 -8
- package/dist/webvh/delegatedLogStore.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +6 -25
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +19 -34
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/index.d.ts +1 -1
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +1 -1
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/logLocation.d.ts +75 -0
- package/dist/webvh/logLocation.d.ts.map +1 -0
- package/dist/webvh/logLocation.js +102 -0
- package/dist/webvh/logLocation.js.map +1 -0
- package/dist/webvh/verifyLog.d.ts +9 -18
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +43 -50
- package/dist/webvh/verifyLog.js.map +1 -1
- package/package.json +5 -5
- package/dist/space/wasLink.d.ts +0 -57
- package/dist/space/wasLink.d.ts.map +0 -1
- package/dist/space/wasLink.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryDelegation.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"recoveryDelegation.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAElE,OAAO,EACL,oBAAoB,EAErB,MAAM,0BAA0B,CAAA;AAEjC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,0BAA0B,QAAuB,CAAA;AAI9D,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAE/E;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,GAAgB,EACjB,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,cAAc,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,KAAK,CAAC,CAOjB;AAID,OAAO,EAAE,oBAAoB,EAAE,CAAA;AAE/B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,UAAU,EACV,gBAAgB,EACjB,EAAE;IACD,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,gBAAgB,CAAC,EAAE,KAAK,CAAA;CACzB,GAAG;IACF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,uBAAuB,CAAC,EAAE,MAAM,CAAA;CACjC,CAiBA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DID_LOG_RESOURCE, ID_COLLECTION } from '../space/collections.js';
|
|
1
|
+
import { accountLogUrl } from '../webvh/logLocation.js';
|
|
3
2
|
import { delegationProofKeyId, STANDING_ZCAP_TTL_MS } from '../webvh/standingZcap.js';
|
|
4
3
|
/**
|
|
5
4
|
* The recovery delegation's lifetime: the house standing-zcap value
|
|
@@ -19,24 +18,6 @@ export const RECOVERY_DELEGATION_TTL_MS = STANDING_ZCAP_TTL_MS;
|
|
|
19
18
|
// Re-exported from their shared home (`webvh/standingZcap.ts`), so this
|
|
20
19
|
// module's public surface predating the move is unchanged.
|
|
21
20
|
export { ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from '../webvh/standingZcap.js';
|
|
22
|
-
/**
|
|
23
|
-
* The absolute URL of the account's `did.jsonl` log resource -- the
|
|
24
|
-
* invocation target of the pre-minted recovery delegation. Built with
|
|
25
|
-
* was-client's path builders, the one owner of the WAS path grammar, so the
|
|
26
|
-
* path is joined onto the pointer host's base path (a sub-path deployment
|
|
27
|
-
* keeps its prefix) and the minted target matches the URL the server checks
|
|
28
|
-
* it against byte for byte.
|
|
29
|
-
*
|
|
30
|
-
* @param options {object}
|
|
31
|
-
* @param options.pointer {AccountPointer}
|
|
32
|
-
* @returns {string}
|
|
33
|
-
*/
|
|
34
|
-
function didLogUrl({ pointer }) {
|
|
35
|
-
return toUrl({
|
|
36
|
-
baseUrl: pointer.host,
|
|
37
|
-
path: resourcePath(pointer.spaceId, ID_COLLECTION.id, DID_LOG_RESOURCE)
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
21
|
/**
|
|
41
22
|
* Delegates the narrow log-write bridge to a code-derived client: PUT on the
|
|
42
23
|
* one `did.jsonl` resource, {@link RECOVERY_DELEGATION_TTL_MS} lifetime. The
|
|
@@ -54,7 +35,7 @@ function didLogUrl({ pointer }) {
|
|
|
54
35
|
*/
|
|
55
36
|
export async function delegateLogWrite({ zcapClient, pointer, recoveryClientDid, now = Date.now() }) {
|
|
56
37
|
return zcapClient.delegate({
|
|
57
|
-
invocationTarget:
|
|
38
|
+
invocationTarget: accountLogUrl({ spaceUrl: pointer.spaceUrl }),
|
|
58
39
|
controller: recoveryClientDid,
|
|
59
40
|
allowedActions: ['PUT'],
|
|
60
41
|
expires: new Date(now + RECOVERY_DELEGATION_TTL_MS)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryDelegation.js","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"recoveryDelegation.js","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,0BAA0B,CAAA;AAEjC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAA;AAE9D,wEAAwE;AACxE,2DAA2D;AAC3D,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAE/E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,EAMjB;IACC,OAAO,UAAU,CAAC,QAAQ,CAAC;QACzB,gBAAgB,EAAE,aAAa,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC/D,UAAU,EAAE,iBAAiB;QAC7B,cAAc,EAAE,CAAC,KAAK,CAAC;QACvB,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,GAAG,0BAA0B,CAAC;KACpD,CAAC,CAAA;AACJ,CAAC;AAED,sEAAsE;AACtE,wCAAwC;AACxC,OAAO,EAAE,oBAAoB,EAAE,CAAA;AAE/B;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,wBAAwB,CAAC,EACvC,UAAU,EACV,gBAAgB,EAIjB;IAMC,MAAM,eAAe,GAAG,UAAU;QAChC,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC;QAClC,CAAC,CAAC,SAAS,CAAA;IACb,MAAM,iBAAiB,GAAG,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1E,MAAM,qBAAqB,GAAG,gBAAgB;QAC5C,CAAC,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;QACxC,CAAC,CAAC,SAAS,CAAA;IACb,MAAM,uBAAuB,GAAG,gBAAgB;QAC9C,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC;QAC/B,CAAC,CAAC,SAAS,CAAA;IACb,OAAO;QACL,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnD,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChE,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,IAAW;IAC9B,OAAQ,IAA6B,CAAC,OAAO,CAAA;AAC/C,CAAC"}
|
|
@@ -219,8 +219,8 @@ export declare const DID_DOCUMENT_RESOURCE = "did.json";
|
|
|
219
219
|
* The world-readable did:webvh history log, a raw JSON-Lines string served as
|
|
220
220
|
* `text/jsonl`: one log entry per line, each a full DID-document snapshot in a
|
|
221
221
|
* hash chain. Sibling of `did.json` in the same `id` collection;
|
|
222
|
-
* `did:webvh:<scid>:<host
|
|
223
|
-
* `https://<host>/space/<spaceId>/id/did.jsonl`.
|
|
222
|
+
* `did:webvh:<scid>:<host>:<prefix...>:space:<spaceId>:id` resolves to
|
|
223
|
+
* `https://<host>/<prefix>/space/<spaceId>/id/did.jsonl`.
|
|
224
224
|
*/
|
|
225
225
|
export declare const DID_LOG_RESOURCE = "did.jsonl";
|
|
226
226
|
/**
|
|
@@ -291,8 +291,8 @@ export const DID_DOCUMENT_RESOURCE = 'did.json';
|
|
|
291
291
|
* The world-readable did:webvh history log, a raw JSON-Lines string served as
|
|
292
292
|
* `text/jsonl`: one log entry per line, each a full DID-document snapshot in a
|
|
293
293
|
* hash chain. Sibling of `did.json` in the same `id` collection;
|
|
294
|
-
* `did:webvh:<scid>:<host
|
|
295
|
-
* `https://<host>/space/<spaceId>/id/did.jsonl`.
|
|
294
|
+
* `did:webvh:<scid>:<host>:<prefix...>:space:<spaceId>:id` resolves to
|
|
295
|
+
* `https://<host>/<prefix>/space/<spaceId>/id/did.jsonl`.
|
|
296
296
|
*/
|
|
297
297
|
export const DID_LOG_RESOURCE = 'did.jsonl';
|
|
298
298
|
/**
|
|
@@ -30,7 +30,7 @@ import type { ZcapClient } from '@interop/ezcap';
|
|
|
30
30
|
* DELETE against the Space.
|
|
31
31
|
*
|
|
32
32
|
* @param options {object}
|
|
33
|
-
* @param options.
|
|
33
|
+
* @param options.baseServerUrl {string}
|
|
34
34
|
* @param options.zcapClient {ZcapClient} the invoking client
|
|
35
35
|
* @param options.spaceId {string} the Space to delete
|
|
36
36
|
* @param options.capability {IZcap} the attached capability (must allow
|
|
@@ -43,8 +43,8 @@ import type { ZcapClient } from '@interop/ezcap';
|
|
|
43
43
|
* indistinguishable on the wire, so this is not a statement of absence.
|
|
44
44
|
* Every other error propagates unchanged
|
|
45
45
|
*/
|
|
46
|
-
export declare function deleteSpaceWithCapability({
|
|
47
|
-
|
|
46
|
+
export declare function deleteSpaceWithCapability({ baseServerUrl, zcapClient, spaceId, capability, serviceDescription }: {
|
|
47
|
+
baseServerUrl: string;
|
|
48
48
|
zcapClient: ZcapClient;
|
|
49
49
|
spaceId: string;
|
|
50
50
|
capability: IZcap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteSpace.d.ts","sourceRoot":"","sources":["../../src/space/deleteSpace.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAa,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"deleteSpace.d.ts","sourceRoot":"","sources":["../../src/space/deleteSpace.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAa,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,yBAAyB,CAAC,EAC9C,aAAa,EACb,UAAU,EACV,OAAO,EACP,UAAU,EACV,kBAAkB,EACnB,EAAE;IACD,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,KAAK,CAAA;IACjB,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;CACxC,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,SAAS,GAAG,WAAW,CAAA;CAAE,CAAC,CAOhD"}
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
* it by its own prior discovery.
|
|
22
22
|
*/
|
|
23
23
|
import { WasClient } from '@interop/was-client';
|
|
24
|
-
import { spacesUrl } from '@interop/was-client/paths';
|
|
25
24
|
/**
|
|
26
25
|
* Deletes a Space with an explicitly attached capability, rather than by root
|
|
27
26
|
* invocation. The `zcapClient`'s invocation signer must be a controller of
|
|
@@ -29,7 +28,7 @@ import { spacesUrl } from '@interop/was-client/paths';
|
|
|
29
28
|
* DELETE against the Space.
|
|
30
29
|
*
|
|
31
30
|
* @param options {object}
|
|
32
|
-
* @param options.
|
|
31
|
+
* @param options.baseServerUrl {string}
|
|
33
32
|
* @param options.zcapClient {ZcapClient} the invoking client
|
|
34
33
|
* @param options.spaceId {string} the Space to delete
|
|
35
34
|
* @param options.capability {IZcap} the attached capability (must allow
|
|
@@ -42,9 +41,9 @@ import { spacesUrl } from '@interop/was-client/paths';
|
|
|
42
41
|
* indistinguishable on the wire, so this is not a statement of absence.
|
|
43
42
|
* Every other error propagates unchanged
|
|
44
43
|
*/
|
|
45
|
-
export async function deleteSpaceWithCapability({
|
|
44
|
+
export async function deleteSpaceWithCapability({ baseServerUrl, zcapClient, spaceId, capability, serviceDescription }) {
|
|
46
45
|
const was = new WasClient({
|
|
47
|
-
|
|
46
|
+
baseServerUrl,
|
|
48
47
|
zcapClient,
|
|
49
48
|
serviceDescription
|
|
50
49
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteSpace.js","sourceRoot":"","sources":["../../src/space/deleteSpace.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"deleteSpace.js","sourceRoot":"","sources":["../../src/space/deleteSpace.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAA;AAIxE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,EAC9C,aAAa,EACb,UAAU,EACV,OAAO,EACP,UAAU,EACV,kBAAkB,EAOnB;IACC,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC;QACxB,aAAa;QACb,UAAU;QACV,kBAAkB;KACnB,CAAC,CAAA;IACF,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAA;AAC/D,CAAC"}
|
package/dist/space/errors.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* A user-facing error whose `message` is safe to show verbatim. Carries the name
|
|
6
6
|
* `'HumanReadableError'` so an app that classifies errors by `name` (rather than
|
|
7
7
|
* by `instanceof`, which fails across module realms) treats a wallet-core error
|
|
8
|
-
* the same as its own. Thrown by `
|
|
8
|
+
* the same as its own. Thrown by `parsePwsLinkPayload` for every malformed /
|
|
9
9
|
* wrong-version / non-link input.
|
|
10
10
|
*/
|
|
11
11
|
export declare class HumanReadableError extends Error {
|
package/dist/space/errors.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* A user-facing error whose `message` is safe to show verbatim. Carries the name
|
|
6
6
|
* `'HumanReadableError'` so an app that classifies errors by `name` (rather than
|
|
7
7
|
* by `instanceof`, which fails across module realms) treats a wallet-core error
|
|
8
|
-
* the same as its own. Thrown by `
|
|
8
|
+
* the same as its own. Thrown by `parsePwsLinkPayload` for every malformed /
|
|
9
9
|
* wrong-version / non-link input.
|
|
10
10
|
*/
|
|
11
11
|
export class HumanReadableError extends Error {
|
package/dist/space/index.d.ts
CHANGED
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
* backup-bundle import writes) among them.
|
|
32
32
|
* - `publicCredentialUrl`, the world-readable shared-credential URL both
|
|
33
33
|
* replicas derive identically.
|
|
34
|
-
* - The `
|
|
35
|
-
* `
|
|
34
|
+
* - The `pws-link` QR hand-off contract (`buildPwsLinkPayload` /
|
|
35
|
+
* `parsePwsLinkPayload` / `encodePwsLinkSecret`) and `isPwsLinkPayload`,
|
|
36
36
|
* the recognizer a wallet hands `@interop/wallet-request`'s input
|
|
37
37
|
* classifier.
|
|
38
38
|
* - The inbox message envelope (`InboxGrantMessage`, built by
|
|
@@ -50,8 +50,8 @@ export { plaintextCollection } from './plaintextCollection.js';
|
|
|
50
50
|
export { ACTIVITY_TYPE, addHistoryNewAccount, addHistorySpaceCreated, addHistoryCredentialCreated, addHistoryCredentialDeleted, addHistoryCredentialShared, addHistoryCredentialUnshared, addHistoryLogin, addHistoryGrant, addHistoryWalletLogin, addHistoryAppRevoke, addHistoryAgentRevoke, addHistoryClientConnected, addHistoryClientRevoked, addHistoryGenerationCollected, addHistoryContentImported, addHistoryProfileCreated, addHistoryCollectionShared, addHistoryCollectionUnshared } from './activity.js';
|
|
51
51
|
export type { WalletActivity, ActivityGrant, ImportCollectionOutcome } from './activity.js';
|
|
52
52
|
export { publicCredentialUrl } from './publicLink.js';
|
|
53
|
-
export {
|
|
54
|
-
export type {
|
|
53
|
+
export { encodePwsLinkSecret, isPwsLinkPayload, buildPwsLinkPayload, parsePwsLinkPayload } from './pwsLink.js';
|
|
54
|
+
export type { PwsLinkPayload } from './pwsLink.js';
|
|
55
55
|
export { inboxGrantMessage, parseInboxGrantMessage } from './inboxMessage.js';
|
|
56
56
|
export type { InboxGrantMessage, InboxMessageZcap } from './inboxMessage.js';
|
|
57
57
|
export { HumanReadableError } from './errors.js';
|
package/dist/space/index.js
CHANGED
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
* backup-bundle import writes) among them.
|
|
32
32
|
* - `publicCredentialUrl`, the world-readable shared-credential URL both
|
|
33
33
|
* replicas derive identically.
|
|
34
|
-
* - The `
|
|
35
|
-
* `
|
|
34
|
+
* - The `pws-link` QR hand-off contract (`buildPwsLinkPayload` /
|
|
35
|
+
* `parsePwsLinkPayload` / `encodePwsLinkSecret`) and `isPwsLinkPayload`,
|
|
36
36
|
* the recognizer a wallet hands `@interop/wallet-request`'s input
|
|
37
37
|
* classifier.
|
|
38
38
|
* - The inbox message envelope (`InboxGrantMessage`, built by
|
|
@@ -48,7 +48,7 @@ export { provisionWalletSpace } from './provisioning.js';
|
|
|
48
48
|
export { plaintextCollection } from './plaintextCollection.js';
|
|
49
49
|
export { ACTIVITY_TYPE, addHistoryNewAccount, addHistorySpaceCreated, addHistoryCredentialCreated, addHistoryCredentialDeleted, addHistoryCredentialShared, addHistoryCredentialUnshared, addHistoryLogin, addHistoryGrant, addHistoryWalletLogin, addHistoryAppRevoke, addHistoryAgentRevoke, addHistoryClientConnected, addHistoryClientRevoked, addHistoryGenerationCollected, addHistoryContentImported, addHistoryProfileCreated, addHistoryCollectionShared, addHistoryCollectionUnshared } from './activity.js';
|
|
50
50
|
export { publicCredentialUrl } from './publicLink.js';
|
|
51
|
-
export {
|
|
51
|
+
export { encodePwsLinkSecret, isPwsLinkPayload, buildPwsLinkPayload, parsePwsLinkPayload } from './pwsLink.js';
|
|
52
52
|
export { inboxGrantMessage, parseInboxGrantMessage } from './inboxMessage.js';
|
|
53
53
|
export { HumanReadableError } from './errors.js';
|
|
54
54
|
export { CEREMONY_IDS } from './ceremony.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provisioning.d.ts","sourceRoot":"","sources":["../../src/space/provisioning.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,qBAAqB,CAAA;AASnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,GAAG,EACH,OAAO,EACP,aAAa,EACd,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;CACtB,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"provisioning.d.ts","sourceRoot":"","sources":["../../src/space/provisioning.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,qBAAqB,CAAA;AASnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,GAAG,EACH,OAAO,EACP,aAAa,EACd,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;CACtB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhB"}
|
|
@@ -36,19 +36,20 @@ export async function provisionWalletSpace({ was, spaceId, controllerDid }) {
|
|
|
36
36
|
// each of the roster's branches describe and configure the same Space
|
|
37
37
|
// concurrently -- nine reads and nine racing writes where one of each does,
|
|
38
38
|
// since none of them can observe another's create.
|
|
39
|
+
const spaceUrl = was.space(spaceId).url;
|
|
39
40
|
const spaceDescription = await ensureSpace({
|
|
40
41
|
was,
|
|
41
|
-
|
|
42
|
+
spaceUrl,
|
|
42
43
|
controllerDid,
|
|
43
44
|
spaceName: WALLET_SPACE_NAME
|
|
44
45
|
});
|
|
45
|
-
await Promise.all(WALLET_SPACE_PROVISION_ROSTER.map(spec => ensureCollection({ was,
|
|
46
|
+
await Promise.all(WALLET_SPACE_PROVISION_ROSTER.map(spec => ensureCollection({ was, spaceUrl, controllerDid, spaceDescription, spec })));
|
|
46
47
|
}
|
|
47
|
-
async function ensureCollection({ was,
|
|
48
|
+
async function ensureCollection({ was, spaceUrl, controllerDid, spaceDescription, spec: { collectionId, name, encryption, isPublic } }) {
|
|
48
49
|
try {
|
|
49
50
|
await ensureSpaceAndCollection({
|
|
50
51
|
was,
|
|
51
|
-
|
|
52
|
+
spaceUrl,
|
|
52
53
|
controllerDid,
|
|
53
54
|
collectionId,
|
|
54
55
|
collectionName: name,
|
|
@@ -62,7 +63,7 @@ async function ensureCollection({ was, spaceId, controllerDid, spaceDescription,
|
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
catch (err) {
|
|
65
|
-
throw new Error(`Error provisioning collection "${collectionId}" in
|
|
66
|
+
throw new Error(`Error provisioning collection "${collectionId}" in Space "${spaceUrl}".`, { cause: err });
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
//# sourceMappingURL=provisioning.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provisioning.js","sourceRoot":"","sources":["../../src/space/provisioning.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,WAAW,EAAE,wBAAwB,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H,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,EAOnD;IACC,IAAI,CAAC;QACH,MAAM,wBAAwB,CAAC;YAC7B,GAAG;YACH,QAAQ;YACR,aAAa;YACb,YAAY;YACZ,cAAc,EAAE,IAAI;YACpB,oEAAoE;YACpE,sEAAsE;YACtE,iDAAiD;YACjD,UAAU,EAAE,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU;YAC1D,QAAQ;YACR,gBAAgB;YAChB,SAAS,EAAE,iBAAiB;SAC7B,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,kCAAkC,YAAY,eAAe,QAAQ,IAAI,EACzE,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The absolute, world-readable URL of a credential's shared copy:
|
|
3
|
-
* `{
|
|
3
|
+
* `{baseServerUrl}/space/{spaceId}/public-credentials/{cid}`. Takes the server URL,
|
|
4
4
|
* Space id, and credential cid as arguments, with no dependency on app config.
|
|
5
5
|
* The path is joined onto the server URL's base path (a sub-path deployment
|
|
6
6
|
* keeps its prefix), and each segment is percent-encoded by the builder.
|
|
7
7
|
*
|
|
8
8
|
* @param options {object}
|
|
9
|
-
* @param options.
|
|
9
|
+
* @param options.baseServerUrl {string} the server's base server URL
|
|
10
10
|
* @param options.spaceId {string} the profile's WAS Space id
|
|
11
11
|
* @param options.cid {string} the credential's content cid
|
|
12
12
|
* @returns {string}
|
|
13
13
|
*/
|
|
14
|
-
export declare function publicCredentialUrl({
|
|
15
|
-
|
|
14
|
+
export declare function publicCredentialUrl({ baseServerUrl, spaceId, cid }: {
|
|
15
|
+
baseServerUrl: string;
|
|
16
16
|
spaceId: string;
|
|
17
17
|
cid: string;
|
|
18
18
|
}): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicLink.d.ts","sourceRoot":"","sources":["../../src/space/publicLink.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,
|
|
1
|
+
{"version":3,"file":"publicLink.d.ts","sourceRoot":"","sources":["../../src/space/publicLink.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,aAAa,EACb,OAAO,EACP,GAAG,EACJ,EAAE;IACD,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,MAAM,CAMT"}
|
package/dist/space/publicLink.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* into the profile's `public-credentials` collection, keyed by the credential's
|
|
7
7
|
* content cid; once replication mirrors it to the profile's WAS Space it
|
|
8
8
|
* resolves at the URL below. Both wallet replicas build the identical URL for a
|
|
9
|
-
* given `(
|
|
9
|
+
* given `(baseServerUrl, spaceId, cid)`, so a link handed out by one resolves the
|
|
10
10
|
* copy replicated by the other.
|
|
11
11
|
*
|
|
12
12
|
* The URL is assembled by was-client's path builders, the one owner of the WAS
|
|
@@ -15,25 +15,26 @@
|
|
|
15
15
|
* sub-path deployment keeps its prefix and the link addresses the same URL the
|
|
16
16
|
* client wrote to.
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
18
|
+
import { resourceUrl, spaceUrlById } from '@interop/was-client/paths';
|
|
19
19
|
import { PUBLIC_CREDENTIALS_COLLECTION } from './collections.js';
|
|
20
20
|
/**
|
|
21
21
|
* The absolute, world-readable URL of a credential's shared copy:
|
|
22
|
-
* `{
|
|
22
|
+
* `{baseServerUrl}/space/{spaceId}/public-credentials/{cid}`. Takes the server URL,
|
|
23
23
|
* Space id, and credential cid as arguments, with no dependency on app config.
|
|
24
24
|
* The path is joined onto the server URL's base path (a sub-path deployment
|
|
25
25
|
* keeps its prefix), and each segment is percent-encoded by the builder.
|
|
26
26
|
*
|
|
27
27
|
* @param options {object}
|
|
28
|
-
* @param options.
|
|
28
|
+
* @param options.baseServerUrl {string} the server's base server URL
|
|
29
29
|
* @param options.spaceId {string} the profile's WAS Space id
|
|
30
30
|
* @param options.cid {string} the credential's content cid
|
|
31
31
|
* @returns {string}
|
|
32
32
|
*/
|
|
33
|
-
export function publicCredentialUrl({
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
export function publicCredentialUrl({ baseServerUrl, spaceId, cid }) {
|
|
34
|
+
return resourceUrl({
|
|
35
|
+
spaceUrl: spaceUrlById({ baseServerUrl, spaceId }),
|
|
36
|
+
collectionId: PUBLIC_CREDENTIALS_COLLECTION,
|
|
37
|
+
resourceId: cid
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
//# sourceMappingURL=publicLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicLink.js","sourceRoot":"","sources":["../../src/space/publicLink.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"publicLink.js","sourceRoot":"","sources":["../../src/space/publicLink.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAEhE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,aAAa,EACb,OAAO,EACP,GAAG,EAKJ;IACC,OAAO,WAAW,CAAC;QACjB,QAAQ,EAAE,YAAY,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;QAClD,YAAY,EAAE,6BAA6B;QAC3C,UAAU,EAAE,GAAG;KAChB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decoded link: the base server URL plus the controller secret AS A
|
|
3
|
+
* STRING.
|
|
4
|
+
*/
|
|
5
|
+
export interface PwsLinkPayload {
|
|
6
|
+
baseServerUrl: string;
|
|
7
|
+
/**
|
|
8
|
+
* The controller secret (already decoded back to the passphrase string).
|
|
9
|
+
*/
|
|
10
|
+
secret: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The `t` discriminator member every `pws-link` payload carries.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PWS_LINK_TYPE = "pws-link";
|
|
16
|
+
/**
|
|
17
|
+
* Whether some scanned or pasted text has a `pws-link` payload's JSON shape.
|
|
18
|
+
* Matched structurally on the `t` member rather than by calling the parser,
|
|
19
|
+
* so an unrelated JSON blob is not refused with a connection-code error
|
|
20
|
+
* message. This is the recognizer a wallet hands `@interop/wallet-request`'s
|
|
21
|
+
* input classifier for its `pws-link` branch; whether the payload is valid
|
|
22
|
+
* is {@link parsePwsLinkPayload}'s answer.
|
|
23
|
+
*
|
|
24
|
+
* @param text {string}
|
|
25
|
+
* @returns {boolean}
|
|
26
|
+
*/
|
|
27
|
+
export declare function isPwsLinkPayload(text: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Encodes a passphrase into the payload's `secret` field: `base64url(utf8(...))`,
|
|
30
|
+
* no padding.
|
|
31
|
+
*
|
|
32
|
+
* @param passphrase {string}
|
|
33
|
+
* @returns {string}
|
|
34
|
+
*/
|
|
35
|
+
export declare function encodePwsLinkSecret(passphrase: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Builds the full `pws-link` payload string a QR encodes.
|
|
38
|
+
*
|
|
39
|
+
* @param options {object}
|
|
40
|
+
* @param options.baseServerUrl {string} the server's base server URL
|
|
41
|
+
* @param options.passphrase {string}
|
|
42
|
+
* @returns {string}
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildPwsLinkPayload({ baseServerUrl, passphrase }: {
|
|
45
|
+
baseServerUrl: string;
|
|
46
|
+
passphrase: string;
|
|
47
|
+
}): string;
|
|
48
|
+
/**
|
|
49
|
+
* Parses and validates a scanned payload, returning the base server URL and the
|
|
50
|
+
* decoded string secret. Throws {@link HumanReadableError} for anything that is
|
|
51
|
+
* not a valid current-version `pws-link` payload (so the scanner shows a clean
|
|
52
|
+
* message rather than mis-handling an unrelated QR).
|
|
53
|
+
*
|
|
54
|
+
* @param raw {string} the raw scanned code value
|
|
55
|
+
* @returns {PwsLinkPayload}
|
|
56
|
+
*/
|
|
57
|
+
export declare function parsePwsLinkPayload(raw: string): PwsLinkPayload;
|
|
58
|
+
//# sourceMappingURL=pwsLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pwsLink.d.ts","sourceRoot":"","sources":["../../src/space/pwsLink.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,aAAa,CAAA;AAEvC;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgBtD;AA6CD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,aAAa,EACb,UAAU,EACX,EAAE;IACD,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;CACnB,GAAG,MAAM,CAOT;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAyC/D"}
|
|
@@ -2,33 +2,37 @@
|
|
|
2
2
|
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* The `
|
|
5
|
+
* The `pws-link` QR hand-off payload -- the "Connect mobile wallet" flow where
|
|
6
6
|
* the web wallet displays a QR that carries an account's controller secret and
|
|
7
7
|
* the mobile wallet scans it.
|
|
8
8
|
*
|
|
9
9
|
* The payload is a NON-URL JSON blob (deliberately not a link, so the OS camera
|
|
10
10
|
* app / deep-link handling never routes it and it cannot leak into browser
|
|
11
11
|
* history or link-preview fetchers). It is accepted only by the in-app scanner.
|
|
12
|
-
* Shape:
|
|
12
|
+
* Shape:
|
|
13
|
+
* `{ v: 1, t: 'pws-link', baseServerUrl, secret: base64url(utf8(passphrase)) }`.
|
|
14
|
+
* `baseServerUrl` is the server's base server URL, the one the receiving
|
|
15
|
+
* wallet builds its client from; the account itself is reached through the
|
|
16
|
+
* keyring record the secret unlocks, so the link carries no DID.
|
|
13
17
|
*/
|
|
14
18
|
import { base64urlnopad } from '@scure/base';
|
|
15
19
|
import { HumanReadableError } from './errors.js';
|
|
16
20
|
/**
|
|
17
|
-
* The `t` discriminator member every `
|
|
21
|
+
* The `t` discriminator member every `pws-link` payload carries.
|
|
18
22
|
*/
|
|
19
|
-
export const
|
|
23
|
+
export const PWS_LINK_TYPE = 'pws-link';
|
|
20
24
|
/**
|
|
21
|
-
* Whether some scanned or pasted text has a `
|
|
25
|
+
* Whether some scanned or pasted text has a `pws-link` payload's JSON shape.
|
|
22
26
|
* Matched structurally on the `t` member rather than by calling the parser,
|
|
23
27
|
* so an unrelated JSON blob is not refused with a connection-code error
|
|
24
28
|
* message. This is the recognizer a wallet hands `@interop/wallet-request`'s
|
|
25
|
-
* input classifier for its `
|
|
26
|
-
* is {@link
|
|
29
|
+
* input classifier for its `pws-link` branch; whether the payload is valid
|
|
30
|
+
* is {@link parsePwsLinkPayload}'s answer.
|
|
27
31
|
*
|
|
28
32
|
* @param text {string}
|
|
29
33
|
* @returns {boolean}
|
|
30
34
|
*/
|
|
31
|
-
export function
|
|
35
|
+
export function isPwsLinkPayload(text) {
|
|
32
36
|
const trimmed = text.trim();
|
|
33
37
|
if (!trimmed.startsWith('{')) {
|
|
34
38
|
return false;
|
|
@@ -42,7 +46,7 @@ export function isWasLinkPayload(text) {
|
|
|
42
46
|
}
|
|
43
47
|
return (parsed !== null &&
|
|
44
48
|
typeof parsed === 'object' &&
|
|
45
|
-
parsed.t ===
|
|
49
|
+
parsed.t === PWS_LINK_TYPE);
|
|
46
50
|
}
|
|
47
51
|
const NOT_A_LINK = 'This QR code is not a wallet connection code.';
|
|
48
52
|
const BAD_SERVER = 'Connection code points at an insecure or invalid server and was rejected.';
|
|
@@ -53,22 +57,23 @@ function stripPadding(value) {
|
|
|
53
57
|
return value.replace(/=+$/, '');
|
|
54
58
|
}
|
|
55
59
|
/**
|
|
56
|
-
* Validates the scanned `
|
|
57
|
-
* it. The code carries the controller secret in the clear, so a
|
|
58
|
-
* would let a crafted QR aim capability-signed requests (and the
|
|
59
|
-
* attacker-controlled or cleartext host. Requires a parseable
|
|
60
|
-
* plain `http:` is allowed ONLY for loopback dev hosts.
|
|
60
|
+
* Validates the scanned `baseServerUrl` before the wallet ever signs a
|
|
61
|
+
* request to it. The code carries the controller secret in the clear, so a
|
|
62
|
+
* bad base would let a crafted QR aim capability-signed requests (and the
|
|
63
|
+
* secret) at an attacker-controlled or cleartext host. Requires a parseable
|
|
64
|
+
* `https:` URL; plain `http:` is allowed ONLY for loopback dev hosts.
|
|
61
65
|
*
|
|
62
66
|
* This is a scheme/host rule, not an allowlist: the payload carries its own
|
|
63
|
-
*
|
|
64
|
-
* -- a connection code names the storage server the user is
|
|
65
|
-
* consuming app later needs to constrain the host further, that
|
|
66
|
-
* the call site, on the returned
|
|
67
|
+
* base server URL, and there is no app-configured set of permitted servers
|
|
68
|
+
* to inject -- a connection code names the storage server the user is
|
|
69
|
+
* joining. If a consuming app later needs to constrain the host further, that
|
|
70
|
+
* check belongs at the call site, on the returned
|
|
71
|
+
* {@link PwsLinkPayload.baseServerUrl}.
|
|
67
72
|
*/
|
|
68
|
-
function
|
|
73
|
+
function assertValidBaseServerUrl(baseServerUrl) {
|
|
69
74
|
let url;
|
|
70
75
|
try {
|
|
71
|
-
url = new URL(
|
|
76
|
+
url = new URL(baseServerUrl);
|
|
72
77
|
}
|
|
73
78
|
catch {
|
|
74
79
|
throw new HumanReadableError(BAD_SERVER);
|
|
@@ -89,35 +94,35 @@ function assertValidServerUrl(serverUrl) {
|
|
|
89
94
|
* @param passphrase {string}
|
|
90
95
|
* @returns {string}
|
|
91
96
|
*/
|
|
92
|
-
export function
|
|
97
|
+
export function encodePwsLinkSecret(passphrase) {
|
|
93
98
|
return base64urlnopad.encode(new TextEncoder().encode(passphrase));
|
|
94
99
|
}
|
|
95
100
|
/**
|
|
96
|
-
* Builds the full `
|
|
101
|
+
* Builds the full `pws-link` payload string a QR encodes.
|
|
97
102
|
*
|
|
98
103
|
* @param options {object}
|
|
99
|
-
* @param options.
|
|
104
|
+
* @param options.baseServerUrl {string} the server's base server URL
|
|
100
105
|
* @param options.passphrase {string}
|
|
101
106
|
* @returns {string}
|
|
102
107
|
*/
|
|
103
|
-
export function
|
|
108
|
+
export function buildPwsLinkPayload({ baseServerUrl, passphrase }) {
|
|
104
109
|
return JSON.stringify({
|
|
105
110
|
v: 1,
|
|
106
|
-
t:
|
|
107
|
-
|
|
108
|
-
secret:
|
|
111
|
+
t: PWS_LINK_TYPE,
|
|
112
|
+
baseServerUrl,
|
|
113
|
+
secret: encodePwsLinkSecret(passphrase)
|
|
109
114
|
});
|
|
110
115
|
}
|
|
111
116
|
/**
|
|
112
|
-
* Parses and validates a scanned payload, returning the server URL and the
|
|
117
|
+
* Parses and validates a scanned payload, returning the base server URL and the
|
|
113
118
|
* decoded string secret. Throws {@link HumanReadableError} for anything that is
|
|
114
|
-
* not a valid current-version `
|
|
119
|
+
* not a valid current-version `pws-link` payload (so the scanner shows a clean
|
|
115
120
|
* message rather than mis-handling an unrelated QR).
|
|
116
121
|
*
|
|
117
122
|
* @param raw {string} the raw scanned code value
|
|
118
|
-
* @returns {
|
|
123
|
+
* @returns {PwsLinkPayload}
|
|
119
124
|
*/
|
|
120
|
-
export function
|
|
125
|
+
export function parsePwsLinkPayload(raw) {
|
|
121
126
|
let parsed;
|
|
122
127
|
try {
|
|
123
128
|
parsed = JSON.parse(raw);
|
|
@@ -128,17 +133,17 @@ export function parseWasLinkPayload(raw) {
|
|
|
128
133
|
if (typeof parsed !== 'object' || parsed === null) {
|
|
129
134
|
throw new HumanReadableError(NOT_A_LINK);
|
|
130
135
|
}
|
|
131
|
-
const { v, t,
|
|
132
|
-
if (t !==
|
|
136
|
+
const { v, t, baseServerUrl, secret } = parsed;
|
|
137
|
+
if (t !== PWS_LINK_TYPE) {
|
|
133
138
|
throw new HumanReadableError(NOT_A_LINK);
|
|
134
139
|
}
|
|
135
140
|
if (v !== 1) {
|
|
136
141
|
throw new HumanReadableError('This connection code is from a newer app version. Please update.');
|
|
137
142
|
}
|
|
138
|
-
if (typeof
|
|
143
|
+
if (typeof baseServerUrl !== 'string' || baseServerUrl.length === 0) {
|
|
139
144
|
throw new HumanReadableError('Connection code is missing its server.');
|
|
140
145
|
}
|
|
141
|
-
|
|
146
|
+
assertValidBaseServerUrl(baseServerUrl);
|
|
142
147
|
if (typeof secret !== 'string' || secret.length === 0) {
|
|
143
148
|
throw new HumanReadableError('Connection code is missing its secret.');
|
|
144
149
|
}
|
|
@@ -152,6 +157,6 @@ export function parseWasLinkPayload(raw) {
|
|
|
152
157
|
if (secretText.length === 0) {
|
|
153
158
|
throw new HumanReadableError('Connection code has an empty secret.');
|
|
154
159
|
}
|
|
155
|
-
return {
|
|
160
|
+
return { baseServerUrl, secret: secretText };
|
|
156
161
|
}
|
|
157
|
-
//# sourceMappingURL=
|
|
162
|
+
//# sourceMappingURL=pwsLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pwsLink.js","s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