keri-ts 2.1.0 → 2.2.1
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 +30 -2
- package/esm/keri/npm/src/acdc/authoring.js +195 -0
- package/esm/keri/npm/src/acdc/custody.js +187 -0
- package/esm/keri/npm/src/acdc/dhking.js +244 -32
- package/esm/keri/npm/src/acdc/regbasing.js +10 -0
- package/esm/keri/npm/src/acdc/salting.js +16 -1
- package/esm/keri/npm/src/acdc/scheming.js +93 -54
- package/esm/keri/npm/src/acdc/unblinding.js +118 -95
- package/esm/keri/npm/src/app/bootstrap/authenticating.js +4 -6
- package/esm/keri/npm/src/app/bootstrap/oobi-resolving.js +41 -0
- package/esm/keri/npm/src/app/bootstrap/oobiery.js +4 -6
- package/esm/keri/npm/src/app/credentials/credential-revoking.js +1 -0
- package/esm/keri/npm/src/app/credentials/credential-workflows.js +2 -0
- package/esm/keri/npm/src/app/credentials/registry-settling.js +44 -0
- package/esm/keri/npm/src/app/credentials/root-replicating.js +68 -60
- package/esm/keri/npm/src/app/credentials/root-replicator.js +198 -0
- package/esm/keri/npm/src/app/credentials/tel-completion.js +36 -0
- package/esm/keri/npm/src/app/delivery/forwarding.js +16 -3
- package/esm/keri/npm/src/app/exchanges/exchanging.js +14 -4
- package/esm/keri/npm/src/app/identity/challenging.js +50 -0
- package/esm/keri/npm/src/app/identity/delegating.js +77 -77
- package/esm/keri/npm/src/app/identity/delegation-approval.js +333 -0
- package/esm/keri/npm/src/app/identity/event-completion.js +154 -0
- package/esm/keri/npm/src/app/identity/habbing.js +129 -6
- package/esm/keri/npm/src/app/identity/keeping.js +77 -4
- package/esm/keri/npm/src/app/ipex/group-ipex.js +341 -0
- package/esm/keri/npm/src/app/ipex/group-issuance.js +905 -0
- package/esm/keri/npm/src/app/ipex/ipex-admitting.js +120 -0
- package/esm/keri/npm/src/app/ipex/ipex-conversation.js +197 -0
- package/esm/keri/npm/src/app/ipex/ipex-discloser.js +591 -0
- package/esm/keri/npm/src/app/ipex/ipex-granting.js +93 -0
- package/esm/keri/npm/src/app/ipex/ipex-grouping.js +50 -19
- package/esm/keri/npm/src/app/ipex/ipex-node-authentication.js +42 -18
- package/esm/keri/npm/src/app/ipex/issuance.js +896 -0
- package/esm/keri/npm/src/app/ipex/pending-presentations.js +46 -0
- package/esm/keri/npm/src/app/ipex/presentation-files.js +200 -0
- package/esm/keri/npm/src/app/ipex/presenting.js +408 -0
- package/esm/keri/npm/src/app/ipex/receive-issuance.js +86 -0
- package/esm/keri/npm/src/app/ipex/unblinding-workflow.js +667 -0
- package/esm/keri/npm/src/app/mailbox/ipex-arrival.js +103 -0
- package/esm/keri/npm/src/app/mailbox/kel-publisher.js +322 -0
- package/esm/keri/npm/src/app/mailbox/kel-publishing.js +65 -0
- package/esm/keri/npm/src/app/mailbox/kel-submission.js +24 -0
- package/esm/keri/npm/src/app/mailbox/mailbox-admin.js +208 -0
- package/esm/keri/npm/src/app/mailbox/mailbox-poller.js +212 -47
- package/esm/keri/npm/src/app/mailbox/mailboxing.js +10 -5
- package/esm/keri/npm/src/app/multisig/counseling.js +488 -0
- package/esm/keri/npm/src/app/multisig/group-members.js +18 -0
- package/esm/keri/npm/src/app/multisig/multisig-messaging.js +33 -6
- package/esm/keri/npm/src/app/multisig/multisig-workflows.js +98 -147
- package/esm/keri/npm/src/app/multisig/proposals.js +281 -0
- package/esm/keri/npm/src/app/multisig/proposing.js +122 -0
- package/esm/keri/npm/src/app/notifications/signaling.js +5 -5
- package/esm/keri/npm/src/app/protocol/parsering.js +26 -1
- package/esm/keri/npm/src/app/protocol/protocol-processing.js +9 -3
- package/esm/keri/npm/src/app/queries/query-workflows.js +98 -0
- package/esm/keri/npm/src/app/runtime/agent-runtime.js +106 -55
- package/esm/keri/npm/src/app/runtime/cue-runtime.js +3 -6
- package/esm/keri/npm/src/app/runtime/delivery-outbox.js +87 -0
- package/esm/keri/npm/src/app/runtime/doing.js +17 -0
- package/esm/keri/npm/src/app/runtime/ipex-auxiliaries.js +207 -0
- package/esm/keri/npm/src/app/runtime/operation-owners.js +151 -0
- package/esm/keri/npm/src/app/runtime/retry-backoff.js +93 -0
- package/esm/keri/npm/src/app/runtime/workflow-contract.js +80 -0
- package/esm/keri/npm/src/app/transport/http-client.js +25 -6
- package/esm/keri/npm/src/app/witness/http-endpoints.js +4 -4
- package/esm/keri/npm/src/cli/common/event-completion.js +49 -0
- package/esm/keri/npm/src/cli/common/runtime-workers.js +23 -0
- package/esm/keri/npm/src/cli/credentials/ipex.js +164 -191
- package/esm/keri/npm/src/cli/credentials/vc.js +53 -72
- package/esm/keri/npm/src/cli/endpoints/did.js +12 -3
- package/esm/keri/npm/src/cli/endpoints/oobi.js +10 -13
- package/esm/keri/npm/src/cli/identity/challenge.js +8 -34
- package/esm/keri/npm/src/cli/identity/delegate.js +81 -258
- package/esm/keri/npm/src/cli/identity/incept.js +15 -32
- package/esm/keri/npm/src/cli/identity/interact.js +5 -17
- package/esm/keri/npm/src/cli/identity/rotate.js +8 -36
- package/esm/keri/npm/src/cli/index.js +3 -1
- package/esm/keri/npm/src/cli/messaging/group-join.js +83 -0
- package/esm/keri/npm/src/cli/messaging/group-wait.js +88 -0
- package/esm/keri/npm/src/cli/messaging/multisig.js +190 -285
- package/esm/keri/npm/src/cli/messaging/root-copy-lines.js +31 -0
- package/esm/keri/npm/src/core/kel/eventing.js +66 -10
- package/esm/keri/npm/src/core/mailbox/kram-policy.js +39 -6
- package/esm/keri/npm/src/core/mailbox/kraming.js +2 -0
- package/esm/keri/npm/src/core/records.js +23 -0
- package/esm/keri/npm/src/core/routing.js +13 -0
- package/esm/keri/npm/src/db/basing.js +34 -2
- package/esm/keri/npm/src/db/core/indexeddb-persistence.js +221 -0
- package/esm/keri/npm/src/db/indexeddb.js +98 -0
- package/esm/keri/npm/src/db/keeping.js +11 -2
- package/esm/keri/npm/src/db/store-lock.js +150 -0
- package/esm/keri/npm/src/npm/db-indexeddb.browser.js +2 -0
- package/esm/keri/npm/src/npm/db-indexeddb.js +3 -0
- package/esm/keri/npm/src/npm/db.browser.js +2 -0
- package/esm/keri/npm/src/npm/index.browser.js +9 -0
- package/esm/keri/npm/src/npm/runtime-web.browser.js +2 -0
- package/esm/keri/npm/src/npm/runtime-web.js +3 -0
- package/esm/keri/npm/src/npm/runtime.browser.js +2 -0
- package/esm/keri/npm/src/runtime/index.js +51 -4
- package/esm/keri/npm/src/runtime/web/output-barrier.js +47 -0
- package/esm/keri/npm/src/runtime/web/persistent-storage.js +37 -0
- package/esm/keri/npm/src/runtime/web.js +10 -0
- package/esm/keri/npm/src/vdr/tel-publication.js +16 -0
- package/esm/keri/npm/src/version.js +2 -2
- package/package.json +15 -2
- package/types/acdc/authoring.d.ts +54 -0
- package/types/acdc/authoring.d.ts.map +1 -0
- package/types/acdc/custody.d.ts +84 -0
- package/types/acdc/custody.d.ts.map +1 -0
- package/types/acdc/dhking.d.ts +94 -3
- package/types/acdc/dhking.d.ts.map +1 -1
- package/types/acdc/regbasing.d.ts +4 -0
- package/types/acdc/regbasing.d.ts.map +1 -1
- package/types/acdc/salting.d.ts +6 -1
- package/types/acdc/salting.d.ts.map +1 -1
- package/types/acdc/scheming.d.ts +2 -0
- package/types/acdc/scheming.d.ts.map +1 -1
- package/types/acdc/unblinding.d.ts +58 -19
- package/types/acdc/unblinding.d.ts.map +1 -1
- package/types/app/bootstrap/authenticating.d.ts +3 -1
- package/types/app/bootstrap/authenticating.d.ts.map +1 -1
- package/types/app/bootstrap/oobi-resolving.d.ts +92 -0
- package/types/app/bootstrap/oobi-resolving.d.ts.map +1 -0
- package/types/app/bootstrap/oobiery.d.ts +3 -1
- package/types/app/bootstrap/oobiery.d.ts.map +1 -1
- package/types/app/credentials/credential-revoking.d.ts +3 -0
- package/types/app/credentials/credential-revoking.d.ts.map +1 -1
- package/types/app/credentials/credential-workflows.d.ts +5 -0
- package/types/app/credentials/credential-workflows.d.ts.map +1 -1
- package/types/app/credentials/registry-settling.d.ts +85 -0
- package/types/app/credentials/registry-settling.d.ts.map +1 -0
- package/types/app/credentials/root-replicating.d.ts +56 -44
- package/types/app/credentials/root-replicating.d.ts.map +1 -1
- package/types/app/credentials/root-replicator.d.ts +105 -0
- package/types/app/credentials/root-replicator.d.ts.map +1 -0
- package/types/app/credentials/tel-completion.d.ts +55 -0
- package/types/app/credentials/tel-completion.d.ts.map +1 -0
- package/types/app/delivery/forwarding.d.ts +6 -0
- package/types/app/delivery/forwarding.d.ts.map +1 -1
- package/types/app/exchanges/exchanging.d.ts.map +1 -1
- package/types/app/identity/challenging.d.ts +54 -0
- package/types/app/identity/challenging.d.ts.map +1 -1
- package/types/app/identity/delegating.d.ts +21 -4
- package/types/app/identity/delegating.d.ts.map +1 -1
- package/types/app/identity/delegation-approval.d.ts +228 -0
- package/types/app/identity/delegation-approval.d.ts.map +1 -0
- package/types/app/identity/event-completion.d.ts +151 -0
- package/types/app/identity/event-completion.d.ts.map +1 -0
- package/types/app/identity/habbing.d.ts +67 -2
- package/types/app/identity/habbing.d.ts.map +1 -1
- package/types/app/identity/keeping.d.ts +49 -3
- package/types/app/identity/keeping.d.ts.map +1 -1
- package/types/app/ipex/group-ipex.d.ts +254 -0
- package/types/app/ipex/group-ipex.d.ts.map +1 -0
- package/types/app/ipex/group-issuance.d.ts +281 -0
- package/types/app/ipex/group-issuance.d.ts.map +1 -0
- package/types/app/ipex/ipex-admitting.d.ts +47 -0
- package/types/app/ipex/ipex-admitting.d.ts.map +1 -0
- package/types/app/ipex/ipex-conversation.d.ts +195 -0
- package/types/app/ipex/ipex-conversation.d.ts.map +1 -0
- package/types/app/ipex/ipex-discloser.d.ts +156 -0
- package/types/app/ipex/ipex-discloser.d.ts.map +1 -0
- package/types/app/ipex/ipex-granting.d.ts +145 -0
- package/types/app/ipex/ipex-granting.d.ts.map +1 -0
- package/types/app/ipex/ipex-grouping.d.ts +18 -0
- package/types/app/ipex/ipex-grouping.d.ts.map +1 -1
- package/types/app/ipex/ipex-node-authentication.d.ts +9 -1
- package/types/app/ipex/ipex-node-authentication.d.ts.map +1 -1
- package/types/app/ipex/issuance.d.ts +445 -0
- package/types/app/ipex/issuance.d.ts.map +1 -0
- package/types/app/ipex/pending-presentations.d.ts +25 -0
- package/types/app/ipex/pending-presentations.d.ts.map +1 -0
- package/types/app/ipex/presentation-files.d.ts +47 -0
- package/types/app/ipex/presentation-files.d.ts.map +1 -0
- package/types/app/ipex/presenting.d.ts +300 -0
- package/types/app/ipex/presenting.d.ts.map +1 -0
- package/types/app/ipex/receive-issuance.d.ts +99 -0
- package/types/app/ipex/receive-issuance.d.ts.map +1 -0
- package/types/app/ipex/unblinding-workflow.d.ts +257 -0
- package/types/app/ipex/unblinding-workflow.d.ts.map +1 -0
- package/types/app/mailbox/ipex-arrival.d.ts +104 -0
- package/types/app/mailbox/ipex-arrival.d.ts.map +1 -0
- package/types/app/mailbox/kel-publisher.d.ts +141 -0
- package/types/app/mailbox/kel-publisher.d.ts.map +1 -0
- package/types/app/mailbox/kel-publishing.d.ts +70 -0
- package/types/app/mailbox/kel-publishing.d.ts.map +1 -0
- package/types/app/mailbox/kel-submission.d.ts +18 -0
- package/types/app/mailbox/kel-submission.d.ts.map +1 -0
- package/types/app/mailbox/mailbox-admin.d.ts +113 -0
- package/types/app/mailbox/mailbox-admin.d.ts.map +1 -0
- package/types/app/mailbox/mailbox-poller.d.ts +92 -3
- package/types/app/mailbox/mailbox-poller.d.ts.map +1 -1
- package/types/app/mailbox/mailboxing.d.ts +3 -0
- package/types/app/mailbox/mailboxing.d.ts.map +1 -1
- package/types/app/multisig/counseling.d.ts +196 -0
- package/types/app/multisig/counseling.d.ts.map +1 -0
- package/types/app/multisig/group-members.d.ts +11 -0
- package/types/app/multisig/group-members.d.ts.map +1 -1
- package/types/app/multisig/grouping.d.ts +39 -20
- package/types/app/multisig/grouping.d.ts.map +1 -1
- package/types/app/multisig/multisig-messaging.d.ts +23 -6
- package/types/app/multisig/multisig-messaging.d.ts.map +1 -1
- package/types/app/multisig/multisig-workflows.d.ts +91 -22
- package/types/app/multisig/multisig-workflows.d.ts.map +1 -1
- package/types/app/multisig/proposals.d.ts +129 -0
- package/types/app/multisig/proposals.d.ts.map +1 -0
- package/types/app/multisig/proposing.d.ts +125 -0
- package/types/app/multisig/proposing.d.ts.map +1 -0
- package/types/app/notifications/signaling.d.ts +3 -1
- package/types/app/notifications/signaling.d.ts.map +1 -1
- package/types/app/protocol/parsering.d.ts +13 -0
- package/types/app/protocol/parsering.d.ts.map +1 -1
- package/types/app/protocol/protocol-processing.d.ts +7 -1
- package/types/app/protocol/protocol-processing.d.ts.map +1 -1
- package/types/app/queries/query-workflows.d.ts +98 -0
- package/types/app/queries/query-workflows.d.ts.map +1 -0
- package/types/app/runtime/agent-runtime.d.ts +72 -25
- package/types/app/runtime/agent-runtime.d.ts.map +1 -1
- package/types/app/runtime/cue-runtime.d.ts +2 -1
- package/types/app/runtime/cue-runtime.d.ts.map +1 -1
- package/types/app/runtime/delivery-outbox.d.ts +68 -0
- package/types/app/runtime/delivery-outbox.d.ts.map +1 -0
- package/types/app/runtime/doing.d.ts +27 -0
- package/types/app/runtime/doing.d.ts.map +1 -0
- package/types/app/runtime/ipex-auxiliaries.d.ts +74 -0
- package/types/app/runtime/ipex-auxiliaries.d.ts.map +1 -0
- package/types/app/runtime/operation-owners.d.ts +137 -0
- package/types/app/runtime/operation-owners.d.ts.map +1 -0
- package/types/app/runtime/retry-backoff.d.ts +49 -0
- package/types/app/runtime/retry-backoff.d.ts.map +1 -0
- package/types/app/runtime/workflow-contract.d.ts +79 -0
- package/types/app/runtime/workflow-contract.d.ts.map +1 -0
- package/types/app/transport/http-client.d.ts.map +1 -1
- package/types/cli/common/event-completion.d.ts +26 -0
- package/types/cli/common/event-completion.d.ts.map +1 -0
- package/types/cli/common/runtime-workers.d.ts +23 -0
- package/types/cli/common/runtime-workers.d.ts.map +1 -0
- package/types/cli/credentials/ipex.d.ts.map +1 -1
- package/types/cli/credentials/vc.d.ts +1 -1
- package/types/cli/credentials/vc.d.ts.map +1 -1
- package/types/cli/endpoints/did.d.ts.map +1 -1
- package/types/cli/endpoints/oobi.d.ts +3 -1
- package/types/cli/endpoints/oobi.d.ts.map +1 -1
- package/types/cli/identity/challenge.d.ts +1 -1
- package/types/cli/identity/challenge.d.ts.map +1 -1
- package/types/cli/identity/delegate.d.ts +14 -1
- package/types/cli/identity/delegate.d.ts.map +1 -1
- package/types/cli/identity/incept.d.ts.map +1 -1
- package/types/cli/identity/interact.d.ts.map +1 -1
- package/types/cli/identity/rotate.d.ts.map +1 -1
- package/types/cli/index.d.ts +3 -1
- package/types/cli/index.d.ts.map +1 -1
- package/types/cli/messaging/group-join.d.ts +56 -0
- package/types/cli/messaging/group-join.d.ts.map +1 -0
- package/types/cli/messaging/group-wait.d.ts +34 -0
- package/types/cli/messaging/group-wait.d.ts.map +1 -0
- package/types/cli/messaging/multisig.d.ts +29 -5
- package/types/cli/messaging/multisig.d.ts.map +1 -1
- package/types/cli/messaging/root-copy-lines.d.ts +39 -0
- package/types/cli/messaging/root-copy-lines.d.ts.map +1 -0
- package/types/core/cues.d.ts +11 -0
- package/types/core/cues.d.ts.map +1 -1
- package/types/core/kel/eventing.d.ts.map +1 -1
- package/types/core/mailbox/kram-policy.d.ts +14 -0
- package/types/core/mailbox/kram-policy.d.ts.map +1 -1
- package/types/core/mailbox/kraming.d.ts +1 -1
- package/types/core/mailbox/kraming.d.ts.map +1 -1
- package/types/core/records.d.ts +61 -0
- package/types/core/records.d.ts.map +1 -1
- package/types/core/routing.d.ts +6 -0
- package/types/core/routing.d.ts.map +1 -1
- package/types/db/basing.d.ts +8 -2
- package/types/db/basing.d.ts.map +1 -1
- package/types/db/core/indexeddb-persistence.d.ts +59 -0
- package/types/db/core/indexeddb-persistence.d.ts.map +1 -0
- package/types/db/indexeddb.d.ts +37 -0
- package/types/db/indexeddb.d.ts.map +1 -0
- package/types/db/keeping.d.ts +5 -2
- package/types/db/keeping.d.ts.map +1 -1
- package/types/db/store-lock.d.ts +72 -0
- package/types/db/store-lock.d.ts.map +1 -0
- package/types/npm/db-indexeddb.d.ts +4 -0
- package/types/npm/db-indexeddb.d.ts.map +1 -0
- package/types/npm/runtime-web.d.ts +4 -0
- package/types/npm/runtime-web.d.ts.map +1 -0
- package/types/runtime/index.d.ts +42 -7
- package/types/runtime/index.d.ts.map +1 -1
- package/types/runtime/web/output-barrier.d.ts +30 -0
- package/types/runtime/web/output-barrier.d.ts.map +1 -0
- package/types/runtime/web/persistent-storage.d.ts +36 -0
- package/types/runtime/web/persistent-storage.d.ts.map +1 -0
- package/types/runtime/web.d.ts +11 -0
- package/types/runtime/web.d.ts.map +1 -0
- package/types/vdr/tel-publication.d.ts +6 -0
- package/types/vdr/tel-publication.d.ts.map +1 -1
- package/types/version.d.ts +2 -2
- package/esm/keri/npm/src/cli/common/tel-completion.js +0 -24
- package/types/cli/common/tel-completion.d.ts +0 -8
- package/types/cli/common/tel-completion.d.ts.map +0 -1
|
@@ -343,8 +343,11 @@ export class Keeper extends StoreOwner {
|
|
|
343
343
|
throw new DatabaseOperationError("Keeper AEID write failed");
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
|
-
/**
|
|
347
|
-
|
|
346
|
+
/**
|
|
347
|
+
* Retain a root under the authenticated policy, owning its commit. Immutable unless `overwrite`, which the
|
|
348
|
+
* caller sets only for a root it has established was never used; the old root then stays until this write.
|
|
349
|
+
*/
|
|
350
|
+
retainRegistryRoot(keys, root, currentAeid, encrypter, decrypter, overwrite = false) {
|
|
348
351
|
if (this.readonly)
|
|
349
352
|
throw new DatabaseOperationError("Cannot retain registry roots in a read-only keeper");
|
|
350
353
|
if (!this.store.opened)
|
|
@@ -357,6 +360,12 @@ export class Keeper extends StoreOwner {
|
|
|
357
360
|
throw new DatabaseOperationError("Keeper AEID changed before registry root retention; reopen the manager");
|
|
358
361
|
}
|
|
359
362
|
const old = this.rroots.get(keys);
|
|
363
|
+
if (old && overwrite) {
|
|
364
|
+
if (!this.rroots.pin(keys, encrypter.encrypt({ prim: root }))) {
|
|
365
|
+
throw new DatabaseOperationError("Keeper registry root write failed");
|
|
366
|
+
}
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
360
369
|
if (old) {
|
|
361
370
|
const retained = decrypter.decrypt({ cipher: old, ctor: Salter });
|
|
362
371
|
if (retained.qb64 !== root.qb64) {
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single-writer lock for a browser store identity.
|
|
3
|
+
*
|
|
4
|
+
* `WebDBer` holds a snapshot of its persisted rows taken at open, so two tabs
|
|
5
|
+
* writing the same identity would each overwrite the other's commits. `indexedDbOpener`
|
|
6
|
+
* takes this lock in its first store's `reopen`, before anything loads, and holds it
|
|
7
|
+
* until its last store of the identity closes; `acquireStoreLock` is public for hosts
|
|
8
|
+
* that compose stores their own way.
|
|
9
|
+
*/
|
|
10
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
13
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
|
+
};
|
|
15
|
+
var _StoreLockGroup_entries;
|
|
16
|
+
import { AppError } from "../core/errors.js";
|
|
17
|
+
/** Another tab, worker or window holds the store; `key`, `storeName` and `storeBase` support a UI message. */
|
|
18
|
+
export class StoreLockHeldError extends AppError {
|
|
19
|
+
constructor(key, storeName, storeBase) {
|
|
20
|
+
super(`Store ${JSON.stringify(storeName ?? "")} is already open in another tab or window`);
|
|
21
|
+
Object.defineProperty(this, "key", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: key
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(this, "storeName", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: storeName
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(this, "storeBase", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true,
|
|
37
|
+
value: storeBase
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** `navigator.locks` is absent (insecure context or old engine), so single-writer cannot be enforced. */
|
|
42
|
+
export class StoreLockUnsupportedError extends AppError {
|
|
43
|
+
constructor() {
|
|
44
|
+
super("Web Locks API unavailable; refusing to open the store without a single-writer lock");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The lock name for a store identity. It matches `IndexedDbPersistence`'s database
|
|
49
|
+
* naming minus the family, so one lock covers every store family of the identity.
|
|
50
|
+
*/
|
|
51
|
+
export function storeLockKey(identity) {
|
|
52
|
+
return `keri-ts:store:${JSON.stringify([identity.base ?? "", identity.name ?? "", identity.temp ? "temp" : "durable"])}`;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Take the exclusive lock for `identity` without waiting.
|
|
56
|
+
*
|
|
57
|
+
* @throws StoreLockHeldError when another holder has it.
|
|
58
|
+
* @throws StoreLockUnsupportedError when no lock manager exists; never proceeds unlocked.
|
|
59
|
+
*/
|
|
60
|
+
export async function acquireStoreLock(identity, options = {}) {
|
|
61
|
+
const locks = options.locks === undefined
|
|
62
|
+
? globalThis.navigator?.locks
|
|
63
|
+
: options.locks;
|
|
64
|
+
if (!locks)
|
|
65
|
+
throw new StoreLockUnsupportedError();
|
|
66
|
+
const key = storeLockKey(identity);
|
|
67
|
+
let letGo;
|
|
68
|
+
const held = new Promise((resolve) => letGo = resolve);
|
|
69
|
+
let done;
|
|
70
|
+
const acquired = await new Promise((resolve, reject) => {
|
|
71
|
+
done = locks.request(key, { mode: "exclusive", ifAvailable: true }, (lock) => {
|
|
72
|
+
resolve(lock !== null);
|
|
73
|
+
return lock === null ? undefined : held;
|
|
74
|
+
});
|
|
75
|
+
done.catch(reject);
|
|
76
|
+
});
|
|
77
|
+
if (!acquired)
|
|
78
|
+
throw new StoreLockHeldError(key, identity.name, identity.base);
|
|
79
|
+
return {
|
|
80
|
+
key,
|
|
81
|
+
release: () => {
|
|
82
|
+
letGo();
|
|
83
|
+
return done.then(() => { });
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Reference-counted store locks for one opener: every store of an identity shares
|
|
89
|
+
* one lock, taken by the first reference and released by the last.
|
|
90
|
+
*/
|
|
91
|
+
export class StoreLockGroup {
|
|
92
|
+
constructor(options = {}) {
|
|
93
|
+
Object.defineProperty(this, "options", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
configurable: true,
|
|
96
|
+
writable: true,
|
|
97
|
+
value: options
|
|
98
|
+
});
|
|
99
|
+
_StoreLockGroup_entries.set(this, new Map());
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Take a reference, acquiring the lock if no other store of the identity holds it.
|
|
103
|
+
*
|
|
104
|
+
* @throws StoreLockHeldError when another holder has the identity.
|
|
105
|
+
* @throws StoreLockUnsupportedError when no lock manager exists.
|
|
106
|
+
*/
|
|
107
|
+
async acquire(identity) {
|
|
108
|
+
const key = storeLockKey(identity);
|
|
109
|
+
let entry = __classPrivateFieldGet(this, _StoreLockGroup_entries, "f").get(key);
|
|
110
|
+
while (entry?.releasing) {
|
|
111
|
+
await entry.releasing;
|
|
112
|
+
entry = __classPrivateFieldGet(this, _StoreLockGroup_entries, "f").get(key);
|
|
113
|
+
}
|
|
114
|
+
if (!entry) {
|
|
115
|
+
entry = { refs: 0, lock: acquireStoreLock(identity, this.options) };
|
|
116
|
+
__classPrivateFieldGet(this, _StoreLockGroup_entries, "f").set(key, entry);
|
|
117
|
+
}
|
|
118
|
+
const mine = entry;
|
|
119
|
+
mine.refs++;
|
|
120
|
+
try {
|
|
121
|
+
await mine.lock;
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
mine.refs--;
|
|
125
|
+
if (__classPrivateFieldGet(this, _StoreLockGroup_entries, "f").get(key) === mine)
|
|
126
|
+
__classPrivateFieldGet(this, _StoreLockGroup_entries, "f").delete(key);
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
let released = false;
|
|
130
|
+
return {
|
|
131
|
+
release: async () => {
|
|
132
|
+
if (released)
|
|
133
|
+
return;
|
|
134
|
+
released = true;
|
|
135
|
+
if (--mine.refs > 0)
|
|
136
|
+
return;
|
|
137
|
+
const lock = await mine.lock;
|
|
138
|
+
mine.releasing = lock.release();
|
|
139
|
+
try {
|
|
140
|
+
await mine.releasing;
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
if (__classPrivateFieldGet(this, _StoreLockGroup_entries, "f").get(key) === mine)
|
|
144
|
+
__classPrivateFieldGet(this, _StoreLockGroup_entries, "f").delete(key);
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
_StoreLockGroup_entries = new WeakMap();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* npm package root entrypoint.
|
|
3
|
+
*
|
|
4
|
+
* Boundary rule:
|
|
5
|
+
* - root/default imports remain browser-safe
|
|
6
|
+
* - runtime and LMDB-backed storage move to explicit subpaths
|
|
7
|
+
*/
|
|
8
|
+
export * from "../library/index.js";
|
|
9
|
+
export { BUILD_METADATA, DISPLAY_VERSION, PACKAGE_VERSION, } from "../version.js";
|
|
@@ -22,8 +22,10 @@ export { FetchHttpClient, } from "../app/transport/http-client.js";
|
|
|
22
22
|
export { requireTcpDialer } from "../app/transport/tcp-dialer.js";
|
|
23
23
|
export { TransportError } from "../app/transport/transport-error.js";
|
|
24
24
|
// Controller state, credentials and protocol operations.
|
|
25
|
+
export { RegistryAuthor } from "../acdc/authoring.js";
|
|
25
26
|
export { DEFAULT_GRANT_WALK, evaluateChain, } from "../acdc/chaining.js";
|
|
26
|
-
export {
|
|
27
|
+
export { BaserDerivedUpdateStore, MemoryDerivedUpdateStore, RegistryCustody, } from "../acdc/custody.js";
|
|
28
|
+
export { decodePublicKey, deriveRoot, Dhke, generateKeyPair, grantTransactionId, } from "../acdc/dhking.js";
|
|
27
29
|
export { RegistryRoot, RootDeferred, rootExn, RootRefused, RootUnverified, } from "../acdc/salting.js";
|
|
28
30
|
export { Unblind } from "../acdc/unblinding.js";
|
|
29
31
|
export { Oobiery, oobiRequestExn, } from "../app/bootstrap/oobiery.js";
|
|
@@ -37,24 +39,32 @@ export { Exchanger, RouteRefuser, } from "../app/exchanges/exchanging.js";
|
|
|
37
39
|
export { findVerifiedChallengeResponse, generateChallengeWords, markChallengeVerified, parseChallengeWords, } from "../app/identity/challenging.js";
|
|
38
40
|
export { Anchorer, } from "../app/identity/delegating.js";
|
|
39
41
|
export { endpointRoleAccepted, loadAcceptedEndpointRole, proposeGroupEndpointRole, } from "../app/identity/endpoint-roleing.js";
|
|
42
|
+
export { beginDelegation, completeEvent, DELEGATION_WAIT_TIMEOUT_MS, delegationStatus, eventStatus, receiptEvent, waitForDelegation, } from "../app/identity/event-completion.js";
|
|
40
43
|
export { acceptedEventReplayMessage, Hab, Habery, openHabery, } from "../app/identity/habbing.js";
|
|
41
44
|
export { Algos, Manager, } from "../app/identity/keeping.js";
|
|
42
45
|
export { Organizer, } from "../app/identity/organizing.js";
|
|
46
|
+
export { IpexAdmitter } from "../app/ipex/ipex-admitting.js";
|
|
43
47
|
export { ipexExnBody, prepareIpexExn } from "../app/ipex/ipex-building.js";
|
|
44
48
|
export { credentialPresentationArtifacts, credentialSaidFromGrant, ipexCredentialAdmit, ipexCredentialGrant, processCredentialPresentationArtifacts, storedGrantArtifacts, } from "../app/ipex/ipex-credentialing.js";
|
|
49
|
+
export { anchorExchange as anchorIpexExchange, exchangeWire, IpexDiscloser, } from "../app/ipex/ipex-discloser.js";
|
|
45
50
|
export { walkIpexGraph } from "../app/ipex/ipex-graph.js";
|
|
46
51
|
export { approveStoredMultisigIpexWrappers, prepareAcdcV2GroupIpex, publishInitialGroupIpex, requireAcdcV2GroupUse, sendCompletedGroupIpex, } from "../app/ipex/ipex-grouping.js";
|
|
47
52
|
export { acceptedRegistryEvidence, authenticateIpexNode, issuedNodeVerdict, } from "../app/ipex/ipex-node-authentication.js";
|
|
48
53
|
export { ipexGrantWalk } from "../app/ipex/ipex-v2.js";
|
|
49
54
|
export { IPEX_GRANT_ROUTE, IPEX_ROUTES, ipexAdmitExn, ipexAgreeExn, ipexApplyExn, ipexGrantExn, ipexOfferExn, ipexSpurnExn, } from "../app/ipex/ipexing.js";
|
|
55
|
+
export { KEL_PUBLISHER_PACING, KEL_PUBLISHER_SWEEP_TOCKS, KEL_PUBLISHER_TOCK_MS, KelPublisher, kelPublisherDo, } from "../app/mailbox/kel-publisher.js";
|
|
56
|
+
export { addMailbox, completeGroupMailbox, completeMailboxAdmin, mailboxAdminUrl, mailboxStatus, proposeGroupMailbox, removeMailbox, requireMailboxEndpointUrl, waitForMailboxState, } from "../app/mailbox/mailbox-admin.js";
|
|
50
57
|
export { MailboxDirector, } from "../app/mailbox/mailbox-director.js";
|
|
51
58
|
export { MailboxPoller, } from "../app/mailbox/mailbox-poller.js";
|
|
52
59
|
export { consumeMailboxSse, parseMailboxSse, readMailboxSseBody, } from "../app/mailbox/mailbox-sse.js";
|
|
53
60
|
export { endpointBasePath, fetchEndpointUrls, mailboxPollEndpoints, mailboxQueryTopics, mailboxTopicKey, preferredUrl, resolveHostedEndpointPath, } from "../app/mailbox/mailboxing.js";
|
|
54
|
-
export {
|
|
61
|
+
export { Counselor, DEFAULT_FALLBACK_AFTER_MS, RECEIPT_BACKOFF_MS, waitForGroupEvent, } from "../app/multisig/counseling.js";
|
|
62
|
+
export { groupElectedMember, groupSigningMembers, groupWitnesser, groupWitnesserSelection, isLocalGroupHab, latestGroupContribution, localGroupMember, } from "../app/multisig/group-members.js";
|
|
55
63
|
export { Multiplexor, MULTISIG_ROUTES, multisigExn, multisigExnBody, multisigInceptExn, multisigInteractExn, multisigIpexProofExn, multisigIssueExn, multisigQueryExn, multisigRegistryInceptExn, multisigRevokeExn, multisigRotateExn, multisigRpyExn, } from "../app/multisig/grouping.js";
|
|
56
64
|
export { signGroupMessage } from "../app/multisig/multisig-messaging.js";
|
|
57
65
|
export { approveAcdcV2Registry, publishAcdcV2Registry } from "../app/multisig/multisig-workflows.js";
|
|
66
|
+
export { approveGroupProposal, dismissGroupProposal, findGroupProposal, listGroupProposals, } from "../app/multisig/proposals.js";
|
|
67
|
+
export { proposeCredentialIssue, proposeCredentialRegistry, proposeCredentialRevocation, proposeGroupInception, proposeGroupInteraction, proposeGroupRotation, proposeRegistryEvent, settleProposedRotation, } from "../app/multisig/proposing.js";
|
|
58
68
|
export { Notifier, } from "../app/notifications/notifying.js";
|
|
59
69
|
export { Signal, Signaler, } from "../app/notifications/signaling.js";
|
|
60
70
|
export { RawRecord } from "../core/records.js";
|
|
@@ -71,7 +81,8 @@ export { matchesRegistrySeal, vet, vetBinds, vetBlind, vetBound, } from "../acdc
|
|
|
71
81
|
/** ACDC v2 services are distinct from the legacy VDR Regery/Registry exports. */
|
|
72
82
|
export { createRegery as createAcdcV2Regery, Regery as AcdcV2Regery, Registry as AcdcV2Registry, } from "../acdc/registraring.js";
|
|
73
83
|
export { validateSchema as validateAcdcSchema } from "../acdc/scheming.js";
|
|
74
|
-
export { deliverRegistryRoots,
|
|
84
|
+
export { deliverRegistryRoots, replicateRootCopies, replicateRootCopy, resealRootCopies, RootResealBudgetMs, } from "../app/credentials/root-replicating.js";
|
|
85
|
+
export { RootReplicator, } from "../app/credentials/root-replicator.js";
|
|
75
86
|
export { publishPendingTel } from "../app/credentials/tel-publishing.js";
|
|
76
87
|
export { Deck } from "../core/deck.js";
|
|
77
88
|
export { AppError, DatabaseError, DatabaseKeyError, DatabaseNotOpenError, DatabaseOperationError, InvalidPathNameError, PathError, ValidationError, } from "../core/errors.js";
|
|
@@ -80,7 +91,7 @@ export { exchange } from "../core/exchange/protocol-exchanging.js";
|
|
|
80
91
|
export { Kevery, } from "../core/kel/eventing.js";
|
|
81
92
|
export { Kever, } from "../core/kel/kever.js";
|
|
82
93
|
export { consoleLogger, getLogLevel, LOG_LEVELS, noopLogger, setLogLevel, } from "../core/logger.js";
|
|
83
|
-
export { Kramer } from "../core/mailbox/kraming.js";
|
|
94
|
+
export { DEFAULT_KRAM_CACHES, Kramer } from "../core/mailbox/kraming.js";
|
|
84
95
|
export { CREDENTIAL_MAILBOX_TOPIC, DELEGATE_MAILBOX_TOPIC, normalizeMbxTopicCursor, OOBI_MAILBOX_TOPIC, RECEIPT_MAILBOX_TOPIC, REPLAY_MAILBOX_TOPIC, REPLY_MAILBOX_TOPIC, } from "../core/mailbox/mailbox-topics.js";
|
|
85
96
|
export { incept, interact, query, reply, rotate } from "../core/protocol-eventing.js";
|
|
86
97
|
export { messageAttachmentGroups, messagize } from "../core/protocol-serialization.js";
|
|
@@ -107,3 +118,39 @@ export { messengerFrom, streamMessengerFrom } from "../app/transport/messengerin
|
|
|
107
118
|
export { systemClock } from "../app/runtime/runtime-clock.js";
|
|
108
119
|
export { AnchorQuerier, KeyStateNoticer, LogQuerier, SeqNoQuerier } from "../app/queries/querying.js";
|
|
109
120
|
export { WitnessInquisitor } from "../app/queries/witness-inquisitor.js";
|
|
121
|
+
// Library OOBI resolution and key-state/anchor queries (begin, status, wait).
|
|
122
|
+
export { beginOobi, OOBI_RESOLVE_TIMEOUT_MS, oobiStatus, resolveOobi, waitForOobi, } from "../app/bootstrap/oobi-resolving.js";
|
|
123
|
+
export { anchorQueryStatus, beginAnchorQuery, beginKeyStateQuery, QUERY_TIMEOUT_MS, queryAnchor, queryKeyState, requireQueryRequester, } from "../app/queries/query-workflows.js";
|
|
124
|
+
export { MemoryChangeSink, observeUntil, signalerChangeSink, } from "../app/runtime/workflow-contract.js";
|
|
125
|
+
// Library poll-and-settle for credential IPEX arrivals (settle, status, wait).
|
|
126
|
+
export { ipexArrivalStatus, ipexBaseline, MailboxIntakeTally, settleStoredGrants, waitForIpexArrival, } from "../app/mailbox/ipex-arrival.js";
|
|
127
|
+
// Runtime-owned group IPEX messages (a group holder's Admit): propose, approve, status, wait.
|
|
128
|
+
export { abandonGroupIpex, approveGroupIpex, GROUP_IPEX_COLLECT_MS, GROUP_IPEX_RETRY_BOUND_MS, groupIpexMessages, GroupIpexOperations, groupIpexProposals, groupIpexStatus, proposeGroupAdmit, proposeGroupIpex, proposeGroupIpexAfter, waitForGroupIpex, } from "../app/ipex/group-ipex.js";
|
|
129
|
+
export { RETRY_BASE_MS, RETRY_MAX_MS, RetryBackoff } from "../app/runtime/retry-backoff.js";
|
|
130
|
+
// Runtime-owned group DH issuance: consent calls for the custodian and the members, election read, proof export.
|
|
131
|
+
export { approveGroupIssuance, approveGroupIssuanceExchange, followGroupIssuanceProof, groupIssuanceElection, groupIssuanceProof, groupIssuanceProposals, prepareGroupIssuance, proposeGroupIssuance, } from "../app/ipex/group-issuance.js";
|
|
132
|
+
// Runtime-owned DH issuance operations, single-signature and group (begin, process, status, wait, abandon).
|
|
133
|
+
export { abandonIssuance, admitIssuance, approveIssuanceExchange, beginIssuance, deliverIssuanceAdmit, ISSUANCE_RETRY_BOUND_MS, ISSUANCE_SWEEP_MS, IssuanceOperations, issuanceStatus, pendingGroupGrants, pendingIssuanceGrants, posterDelivery, prepareIssuanceGrant, proposeIssuance, rebuildIssuanceAdmit, waitForIssuance, } from "../app/ipex/issuance.js";
|
|
134
|
+
export { ADMIT_DELIVERY_TIMEOUT_MS, admitAndDeliver, receiveIssuance, } from "../app/ipex/receive-issuance.js";
|
|
135
|
+
// Runtime-owned single-signature IPEX presentation operations (present, process, status, wait, abandon).
|
|
136
|
+
export { abandonPresentation, deliverPreparedGrant, preparePresentation, present, PRESENTATION_RETRY_BOUND_MS, PresentationOperations, presentationStatus, proposeGroupPresentation, resendPresentation, waitForPresentation, } from "../app/ipex/presenting.js";
|
|
137
|
+
export { pendingPresentations } from "../app/ipex/pending-presentations.js";
|
|
138
|
+
// Exact public Grant files for a group presentation (prepare, resume), and the delivery outbox with retry.
|
|
139
|
+
export { preparePresentationFile, resumePresentationFile, } from "../app/ipex/presentation-files.js";
|
|
140
|
+
export { DeliveryOutbox, } from "../app/runtime/delivery-outbox.js";
|
|
141
|
+
// Runtime-owned single-signature IPEX Unblind operations (request, approve, process, status, wait, abandon).
|
|
142
|
+
export { abandonUnblinding, answerUnblind, requestUnblind, UnblindingOperations, unblindingStatus, waitForUnblinding, } from "../app/ipex/unblinding-workflow.js";
|
|
143
|
+
// Fixed-tock doers.
|
|
144
|
+
export { doEvery } from "../app/runtime/doing.js";
|
|
145
|
+
// Operations owners composed by the runtime.
|
|
146
|
+
export { OWNER_PACING, OWNER_SWEEP_TOCKS, OWNER_TOCK_MS, OwnerHealth, } from "../app/runtime/operation-owners.js";
|
|
147
|
+
// Library delegator approval (list, approve, status, wait, dismiss).
|
|
148
|
+
export { approveDelegation, DELEGATION_APPROVAL_TIMEOUT_MS, delegationApprovalStatus, dismissDelegation, listPendingDelegations, proposeGroupDelegationApproval, requestDelegatedEvent, settleDelegationApproval, waitForDelegationAnchor, waitForDelegationApproval, waitForPendingDelegation, } from "../app/identity/delegation-approval.js";
|
|
149
|
+
// Library TEL completion status/waits and challenge respond/status/wait.
|
|
150
|
+
export { REGISTRY_WAIT_POLL_MS, registryEventRef, registryEventStatus, settleRegistryEvent, waitForRegistryEvent, } from "../app/credentials/registry-settling.js";
|
|
151
|
+
export { issuedCredentialStatus, telEventStatus, waitForIssuedCredential, waitForTelEvent, } from "../app/credentials/tel-completion.js";
|
|
152
|
+
export { challengeStatus, respondToChallenge, waitForChallengeResponse, } from "../app/identity/challenging.js";
|
|
153
|
+
// Library legacy IPEX conversation (apply, offer, agree, spurn; status and wait).
|
|
154
|
+
export { ipexExchangeStatus, requireIpexPrior, requireIpexSender, sendIpexAgree, sendIpexApply, sendIpexOffer, sendIpexSpurn, waitForIpexExchange, } from "../app/ipex/ipex-conversation.js";
|
|
155
|
+
// Library legacy IPEX grant, admit and credential settle.
|
|
156
|
+
export { requireAdmittableGrant, sendIpexAdmit, sendIpexGrant, settleGrantCredential, } from "../app/ipex/ipex-granting.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output barrier for browser compositions (ADR-0015 durability rule 6).
|
|
3
|
+
*
|
|
4
|
+
* A browser store acknowledges a commit before it is durable, so a response,
|
|
5
|
+
* receipt or query that depends on that commit must not leave the page until
|
|
6
|
+
* the composition's persistence queue has flushed. Otherwise a crash or tab
|
|
7
|
+
* close could leave a peer holding evidence of state this wallet then forgot.
|
|
8
|
+
*/
|
|
9
|
+
import { call } from "effection";
|
|
10
|
+
import { AppError } from "../../core/errors.js";
|
|
11
|
+
/** The persistence queue failed, so the request was not sent. The queue's failure is the cause. */
|
|
12
|
+
export class OutputBarrierError extends AppError {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Wrap `inner` so no request, finite or streaming, reaches it before `flushed` resolves.
|
|
16
|
+
*
|
|
17
|
+
* `flushed` is evaluated per request, so each request waits for everything
|
|
18
|
+
* committed before it was made. Pass `() => opener.queue.flushed()` from the
|
|
19
|
+
* composition's `WebStoreOpener`: the queue is shared by every store family, so
|
|
20
|
+
* it covers all commits, which one store's `flushed()` would not.
|
|
21
|
+
*
|
|
22
|
+
* A rejected flush fails the call with `OutputBarrierError` and sends nothing.
|
|
23
|
+
* Cancelling the caller cancels only the wait.
|
|
24
|
+
*
|
|
25
|
+
* The wrapper has no `tcp` dialer: a dialer would be a network path around the
|
|
26
|
+
* barrier, and browsers have none.
|
|
27
|
+
*/
|
|
28
|
+
export function barrierHttpClient(inner, flushed) {
|
|
29
|
+
function* barrier() {
|
|
30
|
+
try {
|
|
31
|
+
yield* call(() => flushed());
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
throw new OutputBarrierError("Persistence did not flush; the request was not sent", { cause: error });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
*request(url, init) {
|
|
39
|
+
yield* barrier();
|
|
40
|
+
return yield* inner.request(url, init);
|
|
41
|
+
},
|
|
42
|
+
*open(url, init) {
|
|
43
|
+
yield* barrier();
|
|
44
|
+
return yield* inner.open(url, init);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent-storage request for browser wallets.
|
|
3
|
+
*
|
|
4
|
+
* Keys live only in IndexedDB, and Safari may evict script-writable storage
|
|
5
|
+
* that was not granted persistence, so a wallet should ask and surface a refusal.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Ask the engine to make this origin's storage persistent, then report the outcome.
|
|
9
|
+
* Never throws: an absent API reports `supported: false`, and a failing or
|
|
10
|
+
* refusing one reports `persisted: false`. Call it from a user gesture where the
|
|
11
|
+
* engine requires one.
|
|
12
|
+
*
|
|
13
|
+
* @param storage Defaults to `navigator.storage`.
|
|
14
|
+
*/
|
|
15
|
+
export async function requestPersistentStorage(storage = globalThis.navigator?.storage) {
|
|
16
|
+
if (typeof storage?.persist !== "function")
|
|
17
|
+
return { persisted: false, supported: false };
|
|
18
|
+
let persisted = await attempt(() => storage.persisted?.(), false);
|
|
19
|
+
if (!persisted)
|
|
20
|
+
persisted = await attempt(() => storage.persist(), false);
|
|
21
|
+
const estimate = await attempt(() => storage.estimate?.(), undefined);
|
|
22
|
+
return {
|
|
23
|
+
persisted,
|
|
24
|
+
supported: true,
|
|
25
|
+
...(typeof estimate?.quota === "number" ? { quota: estimate.quota } : {}),
|
|
26
|
+
...(typeof estimate?.usage === "number" ? { usage: estimate.usage } : {}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Run one engine call, treating a throw or an absent method as the fallback. */
|
|
30
|
+
async function attempt(fn, fallback) {
|
|
31
|
+
try {
|
|
32
|
+
return (await fn()) ?? fallback;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return fallback;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser host surface: the output barrier, single-writer store lock and
|
|
3
|
+
* persistence request that any browser composition needs.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors `keri-ts/runtime/node` for the browser. Nothing here may reach
|
|
6
|
+
* `node:` modules, sockets or the `Deno` global.
|
|
7
|
+
*/
|
|
8
|
+
export { acquireStoreLock, StoreLockHeldError, storeLockKey, StoreLockUnsupportedError, } from "../db/store-lock.js";
|
|
9
|
+
export { barrierHttpClient, OutputBarrierError } from "./web/output-barrier.js";
|
|
10
|
+
export { requestPersistentStorage, } from "./web/persistent-storage.js";
|
|
@@ -117,6 +117,22 @@ export class TelPublication {
|
|
|
117
117
|
complete(pre, sn = 0) {
|
|
118
118
|
return this.reger.ctel.get([pre, ordinal(sn).qb64]) !== null;
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Durable progress of one TEL event, read without side effects: waiting for the
|
|
122
|
+
* issuer's accepted anchor (`tmse.`), for the anchoring event's witness receipts
|
|
123
|
+
* (`tpwe.`), for local publication (`tede.`), complete (`ctel.`), or untracked.
|
|
124
|
+
*/
|
|
125
|
+
progress(pre, sn = 0) {
|
|
126
|
+
if (this.complete(pre, sn))
|
|
127
|
+
return "complete";
|
|
128
|
+
const coordinates = [pre, ordinal(sn).qb64];
|
|
129
|
+
if (this.reger.tede.get(coordinates).length > 0)
|
|
130
|
+
return "awaitingPublication";
|
|
131
|
+
if (this.reger.tpwe.get(coordinates).length > 0)
|
|
132
|
+
return "awaitingReceipts";
|
|
133
|
+
const waiting = [...this.reger.tmse.getTopItemIter()].some(([keys]) => keys[0] === pre && keys[1] === coordinates[1]);
|
|
134
|
+
return waiting ? "awaitingAnchor" : null;
|
|
135
|
+
}
|
|
120
136
|
/** Reverify by unique roster index; multiple signatures from one witness never fill another's slot. */
|
|
121
137
|
allReceipts(target) {
|
|
122
138
|
const current = this.target(this.keys(target), this.seal(target));
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* `src/version.ts` files by hand; edit this template instead.
|
|
7
7
|
*/
|
|
8
8
|
/** Package semantic version copied from the owning package manifest. */
|
|
9
|
-
export const PACKAGE_VERSION = "2.1
|
|
9
|
+
export const PACKAGE_VERSION = "2.2.1";
|
|
10
10
|
/** Optional build metadata stamp injected by release/CI workflows. */
|
|
11
|
-
export const BUILD_METADATA = "build.
|
|
11
|
+
export const BUILD_METADATA = "build.31.49e175e15c5b49580bbdc22ea7baa4c2f9295c3d";
|
|
12
12
|
/** User-facing version string with build metadata appended when present. */
|
|
13
13
|
export const DISPLAY_VERSION = BUILD_METADATA
|
|
14
14
|
? `${PACKAGE_VERSION}+${BUILD_METADATA}`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keri-ts",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "KERI TypeScript protocol and runtime library",
|
|
5
5
|
"homepage": "https://github.com/kentbull/keri-ts",
|
|
6
6
|
"repository": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"types": "./types/npm/index.d.ts",
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
20
|
+
"browser": "./esm/keri/npm/src/npm/index.browser.js",
|
|
20
21
|
"import": "./esm/keri/npm/src/npm/index.js",
|
|
21
22
|
"types": "./types/npm/index.d.ts"
|
|
22
23
|
},
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
"types": "./types/npm/cli.d.ts"
|
|
26
27
|
},
|
|
27
28
|
"./runtime": {
|
|
29
|
+
"browser": "./esm/keri/npm/src/npm/runtime.browser.js",
|
|
28
30
|
"import": "./esm/keri/npm/src/npm/runtime.js",
|
|
29
31
|
"types": "./types/npm/runtime.d.ts"
|
|
30
32
|
},
|
|
@@ -32,13 +34,24 @@
|
|
|
32
34
|
"import": "./esm/keri/npm/src/npm/runtime-node.js",
|
|
33
35
|
"types": "./types/npm/runtime-node.d.ts"
|
|
34
36
|
},
|
|
37
|
+
"./runtime/web": {
|
|
38
|
+
"browser": "./esm/keri/npm/src/npm/runtime-web.browser.js",
|
|
39
|
+
"import": "./esm/keri/npm/src/npm/runtime-web.js",
|
|
40
|
+
"types": "./types/npm/runtime-web.d.ts"
|
|
41
|
+
},
|
|
35
42
|
"./db": {
|
|
43
|
+
"browser": "./esm/keri/npm/src/npm/db.browser.js",
|
|
36
44
|
"import": "./esm/keri/npm/src/npm/db.js",
|
|
37
45
|
"types": "./types/npm/db.d.ts"
|
|
38
46
|
},
|
|
39
47
|
"./db/lmdb": {
|
|
40
48
|
"import": "./esm/keri/npm/src/npm/db-lmdb.js",
|
|
41
49
|
"types": "./types/npm/db-lmdb.d.ts"
|
|
50
|
+
},
|
|
51
|
+
"./db/indexeddb": {
|
|
52
|
+
"browser": "./esm/keri/npm/src/npm/db-indexeddb.browser.js",
|
|
53
|
+
"import": "./esm/keri/npm/src/npm/db-indexeddb.js",
|
|
54
|
+
"types": "./types/npm/db-indexeddb.d.ts"
|
|
42
55
|
}
|
|
43
56
|
},
|
|
44
57
|
"scripts": {
|
|
@@ -63,7 +76,7 @@
|
|
|
63
76
|
"@inquirer/password": "3.0.1",
|
|
64
77
|
"@noble/hashes": "1.8.0",
|
|
65
78
|
"ajv": "8.18.0",
|
|
66
|
-
"cesr-ts": ">=2.
|
|
79
|
+
"cesr-ts": ">=2.2.0 <2.3.0",
|
|
67
80
|
"effection": "^3.6.0",
|
|
68
81
|
"lmdb": "3.5.3",
|
|
69
82
|
"@msgpack/msgpack": "3.1.3",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finite ACDC v2 registry authoring: stage, anchor and update protocol cores.
|
|
3
|
+
*
|
|
4
|
+
* Existing engines own acceptance and receipt authentication; this class only
|
|
5
|
+
* sequences them for one local individual issuer. It reads and writes no
|
|
6
|
+
* credential inventory: embedders that keep issued or held records wrap it
|
|
7
|
+
* (the wallet's `WalletAuthor` adds `issue` and `revoke`). Private derivation
|
|
8
|
+
* requires a `RegistryCustody`, whose coordinate store the embedder supplies.
|
|
9
|
+
*/
|
|
10
|
+
import { type SerderACDC } from "cesr-ts";
|
|
11
|
+
import type { Operation } from "effection";
|
|
12
|
+
import type { Receiptor, WitnessAuthMap } from "../app/witness/receipting.js";
|
|
13
|
+
import type { RegistryCustody } from "./custody.js";
|
|
14
|
+
import { type AcdcMapOptions } from "./messaging.js";
|
|
15
|
+
import { type RegistryDisclosure } from "./regeventing.js";
|
|
16
|
+
import type { Regery, Registry } from "./registraring.js";
|
|
17
|
+
/** Public means deliberate opening publication; private derivation requires supplied custody. */
|
|
18
|
+
export interface AcdcV2UpdateOptions {
|
|
19
|
+
public?: boolean;
|
|
20
|
+
stamp?: string;
|
|
21
|
+
boundEvent?: string;
|
|
22
|
+
/** Transient witness codes for this operation; never retained with registry evidence. */
|
|
23
|
+
auths?: WitnessAuthMap;
|
|
24
|
+
}
|
|
25
|
+
/** Borrow the actual registry environment and receipt collector; acquire no handles or workers. */
|
|
26
|
+
export declare class RegistryAuthor {
|
|
27
|
+
readonly rgy: Regery;
|
|
28
|
+
readonly receiptor: Receiptor;
|
|
29
|
+
readonly custody?: RegistryCustody | undefined;
|
|
30
|
+
constructor(rgy: Regery, receiptor: Receiptor, custody?: RegistryCustody | undefined);
|
|
31
|
+
/** Resolve the actual local registry; staging supports groups while signing methods enforce their owner. */
|
|
32
|
+
registry(name: string, controller: string): Registry;
|
|
33
|
+
/** Signing belongs either to this individual owner or to explicit group approval, never a staging flag. */
|
|
34
|
+
protected individual(reg: Registry): void;
|
|
35
|
+
/** Idempotently stage an alias, then return only its exact accepted inception. */
|
|
36
|
+
incept(name: string, controller: string, auths?: WitnessAuthMap): Operation<SerderACDC>;
|
|
37
|
+
/** Construct the issuer's credential using the existing ACDC v2 finite builder. */
|
|
38
|
+
create(reg: Registry, options: Omit<AcdcMapOptions, "regid">): SerderACDC;
|
|
39
|
+
/** Stage one BUP state advance, preserving an exact pending retry and its opening. Never author historical upd. */
|
|
40
|
+
stage(reg: Registry, acdc: SerderACDC, state: string, options?: AcdcV2UpdateOptions): {
|
|
41
|
+
event: SerderACDC;
|
|
42
|
+
opening: RegistryDisclosure;
|
|
43
|
+
};
|
|
44
|
+
/** Share validation and exact pending-next reuse; only the concrete revocation ensure operation can reuse an accepted head. */
|
|
45
|
+
protected stageState(reg: Registry, acdc: SerderACDC, state: string, options: AcdcV2UpdateOptions, ensureRevoked?: boolean): {
|
|
46
|
+
event: SerderACDC;
|
|
47
|
+
opening: RegistryDisclosure;
|
|
48
|
+
};
|
|
49
|
+
/** Advance one explicit state through real anchoring; staging is never reported as accepted. */
|
|
50
|
+
update(reg: Registry, acdc: SerderACDC, state: string, options?: AcdcV2UpdateOptions): Operation<SerderACDC>;
|
|
51
|
+
/** Reuse the current branch's already signed seal even before receipts; no extra anchor merely to poll. */
|
|
52
|
+
anchor(reg: Registry, event: SerderACDC, auths?: WitnessAuthMap): Operation<void>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=authoring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring.d.ts","sourceRoot":"","sources":["../../src/acdc/authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAA8B,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAW,KAAK,cAAc,EAAY,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAuB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG1D,iGAAiG;AACjG,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,mGAAmG;AACnG,qBAAa,cAAc;IAEvB,QAAQ,CAAC,GAAG,EAAE,MAAM;IACpB,QAAQ,CAAC,SAAS,EAAE,SAAS;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe;gBAFzB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,eAAe,YAAA;IAUpC,4GAA4G;IAC5G,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,QAAQ;IAQpD,2GAA2G;IAC3G,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAMzC,kFAAkF;IACjF,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC;IAYxF,mFAAmF;IACnF,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,UAAU;IAKzE,mHAAmH;IACnH,KAAK,CACH,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,mBAAwB,GAChC;QAAE,KAAK,EAAE,UAAU,CAAC;QAAC,OAAO,EAAE,kBAAkB,CAAA;KAAE;IAIrD,+HAA+H;IAC/H,SAAS,CAAC,UAAU,CAClB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,mBAAmB,EAC5B,aAAa,UAAQ,GACpB;QAAE,KAAK,EAAE,UAAU,CAAC;QAAC,OAAO,EAAE,kBAAkB,CAAA;KAAE;IA2ErD,gGAAgG;IAC/F,MAAM,CACL,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,mBAAwB,GAChC,SAAS,CAAC,UAAU,CAAC;IAOxB,2GAA2G;IAC1G,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC;CA4BnF"}
|