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
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-owned operations for single-signature v2 IPEX presentation.
|
|
3
|
+
*
|
|
4
|
+
* `present` is the user's one explicit consent: it selects the credential view, signs the Offer, Grant,
|
|
5
|
+
* Apply, Agree or Spurn (a Grant may also anchor its presentation proof under that same consent), takes
|
|
6
|
+
* the signed exchange into local authenticated intake and queues it. It returns after local commit and
|
|
7
|
+
* never waits for the peer. `PresentationOperations.processOnce` is the only worker: it delivers the
|
|
8
|
+
* already signed bytes, retries a failed delivery with a doubling delay until the exchange's deadline
|
|
9
|
+
* and ends the operation at the Grant's original exchange deadline. It never signs.
|
|
10
|
+
*
|
|
11
|
+
* There is no operation store. The signed exchange is itself durable (the accepted exchange and its
|
|
12
|
+
* signatures), and `resendPresentation` rebuilds its wire from those stored factors, signing nothing, so
|
|
13
|
+
* a process that ended before or during delivery can deliver again on the user's explicit request. Nothing
|
|
14
|
+
* is sent after a restart on its own.
|
|
15
|
+
*
|
|
16
|
+
* Status is the live table plus what the stores prove. Delivery itself leaves no protocol record, so
|
|
17
|
+
* only the peer's stored answer proves it:
|
|
18
|
+
*
|
|
19
|
+
* | stores prove | status |
|
|
20
|
+
* | --------------------------------------------------------- | -------------------------------------------- |
|
|
21
|
+
* | the peer's answer is stored (`erpy`) | `done`, with the `response` |
|
|
22
|
+
* | signed exchange accepted, deadline passed, no answer | `expired` |
|
|
23
|
+
* | signed exchange accepted, no answer, not live | `interrupted`: `resendPresentation` delivers |
|
|
24
|
+
*
|
|
25
|
+
* Lost on reload, by design: the delivery attempts and the last transport failure, the `abandoned` and
|
|
26
|
+
* `failed` end states with their reasons, the delivery destinations, and the fact of a delivery nobody
|
|
27
|
+
* answered (it reads `done` in the process that delivered it and `interrupted` after a reload; sending it
|
|
28
|
+
* again is harmless, the peer deduplicates by SAID).
|
|
29
|
+
*
|
|
30
|
+
* Workflow-contract shape (`app/runtime/workflow-contract.ts`): `present` returns after local commit,
|
|
31
|
+
* `presentationStatus` is a pure read, `waitForPresentation` only observes and returns a `WaitResult`, and
|
|
32
|
+
* `abandonPresentation` is local. A host that wants only the signed bytes (a file, a QR code) uses
|
|
33
|
+
* `preparePresentation`, which commits locally and queues nothing.
|
|
34
|
+
*
|
|
35
|
+
* Group identifiers are refused here: a group presents through {@link proposeGroupPresentation}, which hands the
|
|
36
|
+
* frozen Grant to the group IPEX owner (`group-ipex.ts`) for member approval.
|
|
37
|
+
*/
|
|
38
|
+
import { type SerderKERI } from "cesr-ts";
|
|
39
|
+
import { type Operation } from "effection";
|
|
40
|
+
import { type DerivedUpdateStore } from "../../acdc/custody.js";
|
|
41
|
+
import type { Regery } from "../../acdc/registraring.js";
|
|
42
|
+
import type { Exchanger } from "../exchanges/exchanging.js";
|
|
43
|
+
import type { Hab, Habery } from "../identity/habbing.js";
|
|
44
|
+
import { type CounselInputs } from "../multisig/counseling.js";
|
|
45
|
+
import type { ProtocolProcessor } from "../protocol/protocol-processing.js";
|
|
46
|
+
import type { Reactor } from "../protocol/reactor.js";
|
|
47
|
+
import { type DeliveryFailure, DeliveryOutbox } from "../runtime/delivery-outbox.js";
|
|
48
|
+
import type { RetryPolicy } from "../runtime/retry-backoff.js";
|
|
49
|
+
import type { RuntimeClock } from "../runtime/runtime-clock.js";
|
|
50
|
+
import { type ChangeSink, type WaitResult } from "../runtime/workflow-contract.js";
|
|
51
|
+
import type { Receiptor, WitnessAuthMap } from "../witness/receipting.js";
|
|
52
|
+
import { type GroupIpexBegun, type GroupIpexOperations } from "./group-ipex.js";
|
|
53
|
+
import type { IpexV2BodyOptions } from "./ipex-building.js";
|
|
54
|
+
import { type CredentialViews, type DisclosureSelection } from "./ipex-discloser.js";
|
|
55
|
+
import type { IssuanceDelivery } from "./issuance.js";
|
|
56
|
+
/** How long delivery failures may last on an exchange with no deadline (an Apply, an Agree) before it reads `failed`. */
|
|
57
|
+
export declare const PRESENTATION_RETRY_BOUND_MS = 600000;
|
|
58
|
+
/** The signed IPEX message a presentation operation sends. */
|
|
59
|
+
export type PresentationVerb = "apply" | "offer" | "agree" | "spurn" | "grant";
|
|
60
|
+
/** Terminal states that are not delivery; each carries a reason. */
|
|
61
|
+
export type PresentationEndState = "abandoned" | "interrupted" | "expired" | "failed";
|
|
62
|
+
/** The peer's stored answer to a delivered exchange, read from the retained response index. */
|
|
63
|
+
export interface PresentationResponse {
|
|
64
|
+
said: string;
|
|
65
|
+
route: string | null;
|
|
66
|
+
}
|
|
67
|
+
/** Status of one presentation, discriminated on `state`. A pure read. */
|
|
68
|
+
export type PresentationStatus = {
|
|
69
|
+
state: "active";
|
|
70
|
+
verb: PresentationVerb;
|
|
71
|
+
phase: "delivering";
|
|
72
|
+
deadline?: string;
|
|
73
|
+
/** Present while a delivery is failing and being retried with a doubling delay. */
|
|
74
|
+
failure?: DeliveryFailure;
|
|
75
|
+
} | {
|
|
76
|
+
state: "done";
|
|
77
|
+
verb: PresentationVerb;
|
|
78
|
+
phase: "delivered";
|
|
79
|
+
/** Where the transport reached; known only to the process that delivered it. */
|
|
80
|
+
deliveries?: readonly string[];
|
|
81
|
+
response?: PresentationResponse;
|
|
82
|
+
} | {
|
|
83
|
+
state: PresentationEndState;
|
|
84
|
+
verb: PresentationVerb;
|
|
85
|
+
reason: string;
|
|
86
|
+
};
|
|
87
|
+
/** Narrow collaborators of the presentation owner. Hosts adapt their runtime to this once. */
|
|
88
|
+
export interface PresentationDeps {
|
|
89
|
+
readonly hby: Habery;
|
|
90
|
+
/** Registry environment: its public store and the local presentation registries by name. */
|
|
91
|
+
readonly rgy: Pick<Regery, "store" | "registryByName">;
|
|
92
|
+
readonly exc: Exchanger;
|
|
93
|
+
/** Receipt collector for an anchored exchange; its genus selects the witness protocol version. */
|
|
94
|
+
readonly receiptor: Receiptor;
|
|
95
|
+
/** Local intake of what this identifier signs. */
|
|
96
|
+
readonly reactor: Pick<Reactor, "processBytes">;
|
|
97
|
+
readonly protocol: Pick<ProtocolProcessor, "processEscrowsOnce">;
|
|
98
|
+
readonly delivery: IssuanceDelivery;
|
|
99
|
+
/** Delivery retry delays; the production policy when absent. */
|
|
100
|
+
readonly retry?: Readonly<RetryPolicy>;
|
|
101
|
+
/** Same clock the exchanger was composed with. */
|
|
102
|
+
readonly clock: RuntimeClock;
|
|
103
|
+
/** Embedder inventory for selecting an issued credential or a retained Grant. */
|
|
104
|
+
readonly views?: CredentialViews;
|
|
105
|
+
/** Derivation coordinates, needed only for a selection with `derive`. */
|
|
106
|
+
readonly derived?: DerivedUpdateStore;
|
|
107
|
+
readonly changes?: ChangeSink;
|
|
108
|
+
}
|
|
109
|
+
/** Body options of a selecting message, plus the presentation registry that carries a Grant's proof. */
|
|
110
|
+
export interface PresentationOptions extends IpexV2BodyOptions {
|
|
111
|
+
priorSaid?: string;
|
|
112
|
+
auths?: WitnessAuthMap;
|
|
113
|
+
/** Alias of a local registry whose presented-state update this Grant anchors. */
|
|
114
|
+
presentationRegistry?: string;
|
|
115
|
+
}
|
|
116
|
+
/** What the user presents. Selecting verbs name a credential view; replies name the exchange they answer. */
|
|
117
|
+
export type PresentationInput = {
|
|
118
|
+
verb: "offer";
|
|
119
|
+
hab: Hab;
|
|
120
|
+
selection: DisclosureSelection;
|
|
121
|
+
options: PresentationOptions;
|
|
122
|
+
} | {
|
|
123
|
+
verb: "grant";
|
|
124
|
+
hab: Hab;
|
|
125
|
+
selection: DisclosureSelection;
|
|
126
|
+
options: PresentationOptions;
|
|
127
|
+
} | {
|
|
128
|
+
verb: "apply";
|
|
129
|
+
hab: Hab;
|
|
130
|
+
options: IpexV2BodyOptions;
|
|
131
|
+
} | {
|
|
132
|
+
verb: "agree" | "spurn";
|
|
133
|
+
hab: Hab;
|
|
134
|
+
/** SAID of the accepted, authenticated exchange being answered. */
|
|
135
|
+
prior: string;
|
|
136
|
+
message?: string;
|
|
137
|
+
recipient?: string;
|
|
138
|
+
auths?: WitnessAuthMap;
|
|
139
|
+
};
|
|
140
|
+
/** A signed exchange accepted locally, with the bytes in delivery order. */
|
|
141
|
+
export interface PreparedPresentation {
|
|
142
|
+
exn: SerderKERI;
|
|
143
|
+
/** Sender KEL, proof support and the exchange. */
|
|
144
|
+
wire: Uint8Array;
|
|
145
|
+
recipient: string;
|
|
146
|
+
}
|
|
147
|
+
/** What `present` selected. */
|
|
148
|
+
export interface PresentationBegun {
|
|
149
|
+
said: string;
|
|
150
|
+
recipient: string;
|
|
151
|
+
/** The signed bytes, for a host that also wants to file them. */
|
|
152
|
+
wire: Uint8Array;
|
|
153
|
+
}
|
|
154
|
+
/** A signed exchange to deliver: what the sender, the recipient and the transport need. */
|
|
155
|
+
interface QueuedPresentation {
|
|
156
|
+
/** SAID of the signed exchange. */
|
|
157
|
+
readonly said: string;
|
|
158
|
+
readonly verb: PresentationVerb;
|
|
159
|
+
readonly hab: Hab;
|
|
160
|
+
/** The identifier whose endpoint sends it: the sender, or a group's local member. */
|
|
161
|
+
readonly src?: string;
|
|
162
|
+
readonly recipient: string;
|
|
163
|
+
readonly wire: Uint8Array;
|
|
164
|
+
/** The exchange's original deadline (ISO 8601), for an exchange that has one. */
|
|
165
|
+
readonly deadline?: string;
|
|
166
|
+
}
|
|
167
|
+
/** One delivery in progress; exists only while it is live in this process. */
|
|
168
|
+
interface LivePresentation extends QueuedPresentation {
|
|
169
|
+
readonly expires: bigint | null;
|
|
170
|
+
/** The signed bytes, delivered with retry; a failure waits for a later pass instead of ending the delivery. */
|
|
171
|
+
readonly outbox: DeliveryOutbox;
|
|
172
|
+
/** A delivery is running; overlapping `processOnce` calls skip it. */
|
|
173
|
+
busy: boolean;
|
|
174
|
+
}
|
|
175
|
+
/** What a presentation that ended or delivered in this process reports until the process ends. */
|
|
176
|
+
type SettledPresentation = {
|
|
177
|
+
verb: PresentationVerb;
|
|
178
|
+
state: PresentationEndState;
|
|
179
|
+
reason: string;
|
|
180
|
+
} | {
|
|
181
|
+
verb: PresentationVerb;
|
|
182
|
+
state: "done";
|
|
183
|
+
deliveries: readonly string[];
|
|
184
|
+
};
|
|
185
|
+
/** The live deliveries table and its driver. One per host runtime; every identifier may present through it. */
|
|
186
|
+
export declare class PresentationOperations {
|
|
187
|
+
readonly deps: PresentationDeps;
|
|
188
|
+
/** Deliveries live in this process. Internal to this module's functions. */
|
|
189
|
+
readonly live: Map<string, LivePresentation>;
|
|
190
|
+
/** Presentations that delivered or ended in this process; not durable, see the module doc. */
|
|
191
|
+
readonly settled: Map<string, SettledPresentation>;
|
|
192
|
+
constructor(deps: PresentationDeps);
|
|
193
|
+
/** Whether the live presentation `said` still holds a message the transport has not taken. */
|
|
194
|
+
owes(said: string): boolean;
|
|
195
|
+
/** Whether a delivery is live. */
|
|
196
|
+
active(): boolean;
|
|
197
|
+
/** Advance every live delivery by one pass. */
|
|
198
|
+
processOnce(): Operation<void>;
|
|
199
|
+
/** End a live delivery: drop it, remember why until the process ends, tell the sink. */
|
|
200
|
+
end(op: LivePresentation, state: PresentationEndState, reason: string): void;
|
|
201
|
+
/** Resolves only when the deadline passes; never resolves for an exchange without one. */
|
|
202
|
+
private timer;
|
|
203
|
+
/**
|
|
204
|
+
* One attempt: a failure keeps the bytes and is retried after a doubling delay until the exchange's deadline,
|
|
205
|
+
* or, for an exchange with none, until failures have lasted {@link PRESENTATION_RETRY_BOUND_MS}.
|
|
206
|
+
*/
|
|
207
|
+
private deliver;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Sign the selected message and take it into local authenticated intake, without recording an operation or
|
|
211
|
+
* delivering. This is the whole consent: the returned bytes are final.
|
|
212
|
+
*
|
|
213
|
+
* @throws ValidationError for a group identifier, an unknown presentation registry, a selection the discloser
|
|
214
|
+
* refuses, or an exchange that does not reach authenticated intake.
|
|
215
|
+
*/
|
|
216
|
+
export declare function preparePresentation(deps: PresentationDeps, input: PresentationInput): Operation<PreparedPresentation>;
|
|
217
|
+
/** What a group presents and how: the view, the Grant body options and the registry update's counseling. */
|
|
218
|
+
export interface GroupPresentationInput {
|
|
219
|
+
hab: Hab;
|
|
220
|
+
selection: DisclosureSelection;
|
|
221
|
+
options: PresentationOptions;
|
|
222
|
+
/** False when the caller takes the completed Grant itself (a file) and the lead must not send it. */
|
|
223
|
+
deliver?: boolean;
|
|
224
|
+
/** Counseling choices for the registry update's anchor. */
|
|
225
|
+
counsel?: CounselInputs;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* A group's consent to present an accepted Grant or credential view: freezes the Grant body once (selection and
|
|
229
|
+
* authorization) and proposes it as a group-authored message, so the other members list and approve it with
|
|
230
|
+
* `approveGroupIpex` and the elected lead delivers the completed Grant. Returns after local commit.
|
|
231
|
+
*
|
|
232
|
+
* With `options.presentationRegistry` the Grant carries a presented-state proof: this member also proposes the
|
|
233
|
+
* registry update that anchors it (`proposeRegistryEvent`; the other members approve that proposal with
|
|
234
|
+
* `approveGroupProposal`), and the owner signs this member's contribution to the Grant once the group has accepted
|
|
235
|
+
* the update, under this same consent.
|
|
236
|
+
*
|
|
237
|
+
* @throws ValidationError for an identifier that is not a local group, an unknown presentation registry, a
|
|
238
|
+
* selection the discloser refuses, or a message awaiting authenticating dependencies.
|
|
239
|
+
*/
|
|
240
|
+
export declare function proposeGroupPresentation(deps: PresentationDeps, groupIpex: GroupIpexOperations, { hab, selection, options, deliver, counsel }: GroupPresentationInput): Operation<GroupIpexBegun>;
|
|
241
|
+
/** A completed prepared Grant ready for the elected lead to deliver. */
|
|
242
|
+
export interface PreparedGrantDelivery {
|
|
243
|
+
hab: Hab;
|
|
244
|
+
said: string;
|
|
245
|
+
/** Proof support and the completed Grant, in delivery order. */
|
|
246
|
+
delivery: Uint8Array;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Deliver a group's completed prepared Grant ({@link resumePresentationFile}): queues the delivery bytes for
|
|
250
|
+
* `processOnce` when the local member is the elected lead, with the retry and deadline of any presentation. Signs
|
|
251
|
+
* nothing. Returns null for a member that is not the lead.
|
|
252
|
+
*/
|
|
253
|
+
export declare function deliverPreparedGrant(ops: PresentationOperations, { hab, said, delivery }: PreparedGrantDelivery): PresentationBegun | null;
|
|
254
|
+
/**
|
|
255
|
+
* The user's consent to present: signs and takes the message into local intake ({@link preparePresentation}),
|
|
256
|
+
* records the operation and queues the signed bytes for `processOnce` to deliver. Returns after local commit.
|
|
257
|
+
*/
|
|
258
|
+
export declare function present(ops: PresentationOperations, input: PresentationInput): Operation<PresentationBegun>;
|
|
259
|
+
/**
|
|
260
|
+
* Pure read of one presentation: the live table, what ended or delivered in this process, and what the stored
|
|
261
|
+
* exchanges prove (the peer's answer, when one was stored; see the module doc for what a reload loses). A
|
|
262
|
+
* signed exchange no live delivery holds and nobody answered reads `interrupted`, or `expired` past its
|
|
263
|
+
* deadline; that is a statement, not a write.
|
|
264
|
+
*
|
|
265
|
+
* @throws ValidationError when `said` is not a presentation exchange a local identifier signed.
|
|
266
|
+
*/
|
|
267
|
+
export declare function presentationStatus(ops: PresentationOperations, said: string): PresentationStatus;
|
|
268
|
+
/** Options for {@link waitForPresentation}. */
|
|
269
|
+
export interface PresentationWaitOptions {
|
|
270
|
+
/** Wall-clock budget. */
|
|
271
|
+
timeoutMs: number;
|
|
272
|
+
clock?: RuntimeClock;
|
|
273
|
+
/** Settle on this instead of any non-active state. */
|
|
274
|
+
until?: (status: PresentationStatus) => boolean;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Observe until the presentation is delivered or ended, or the budget expires. Starts no worker and drives
|
|
278
|
+
* nothing: someone else must call `processOnce`.
|
|
279
|
+
*/
|
|
280
|
+
export declare function waitForPresentation(ops: PresentationOperations, said: string, { timeoutMs, clock, until }: PresentationWaitOptions): Operation<WaitResult<PresentationStatus>>;
|
|
281
|
+
/**
|
|
282
|
+
* Local abandon: stop delivering and read `abandoned` until the process ends. Does not message the peer and
|
|
283
|
+
* does not retract an exchange already delivered. Does nothing to a presentation that is already delivered
|
|
284
|
+
* or ended.
|
|
285
|
+
*
|
|
286
|
+
* @throws ValidationError when `said` is not a presentation exchange a local identifier signed.
|
|
287
|
+
*/
|
|
288
|
+
export declare function abandonPresentation(ops: PresentationOperations, said: string, reason?: string): void;
|
|
289
|
+
/**
|
|
290
|
+
* Deliver a presentation again after a restart, or after delivery failed or was abandoned: rebuilds the wire
|
|
291
|
+
* of the stored signed exchange from its retained signatures or source seal and nests, so the bytes are the
|
|
292
|
+
* ones first delivered and nothing is signed. Queues them like `present`, with a fresh outbox; return
|
|
293
|
+
* is after the queueing, not after delivery.
|
|
294
|
+
*
|
|
295
|
+
* @throws ValidationError for an exchange no local identifier signed, one the peer already answered, one past
|
|
296
|
+
* its deadline, one already being delivered, or one whose retained factors no longer authenticate.
|
|
297
|
+
*/
|
|
298
|
+
export declare function resendPresentation(ops: PresentationOperations, said: string): Operation<PresentationBegun>;
|
|
299
|
+
export {};
|
|
300
|
+
//# sourceMappingURL=presenting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presenting.d.ts","sourceRoot":"","sources":["../../../src/app/ipex/presenting.ts"],"names":[],"mappings":"AAAA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AC,CAuB9B"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The holder's side of a credential, as workflows a host calls instead of sequencing the library itself.
|
|
3
|
+
*
|
|
4
|
+
* - {@link admitAndDeliver}: the Admit consent, the host's one step between accepting the Admit and sending it
|
|
5
|
+
* (`onAdmitted`: a wallet records its consent in its inventory there), and delivery within a budget. It
|
|
6
|
+
* works for any accepted v2 Grant, so a host that never ran the DH exchange uses it alone.
|
|
7
|
+
* - {@link receiveIssuance}: the whole individual path for a pending Grant: approve the DH exchange, wait for the
|
|
8
|
+
* issuer to finish it, then {@link admitAndDeliver}. Calling it again for a Grant that timed out resumes at
|
|
9
|
+
* the step it reached.
|
|
10
|
+
*
|
|
11
|
+
* Both follow the workflow contract: they may sign (the consents), never wait on a remote without a budget, and
|
|
12
|
+
* return remote and time-driven outcomes as values. Group identifiers use the group paths in `group-issuance.ts`.
|
|
13
|
+
*/
|
|
14
|
+
import type { Versionage } from "cesr-ts";
|
|
15
|
+
import type { Operation } from "effection";
|
|
16
|
+
import type { WitnessAuthMap } from "../witness/receipting.js";
|
|
17
|
+
import { type AdmitDeps, type IssuanceAdmit, type IssuanceEndState, type IssuanceOperations, type IssuanceStatus } from "./issuance.js";
|
|
18
|
+
/** Default budget of delivering an Admit, in milliseconds. */
|
|
19
|
+
export declare const ADMIT_DELIVERY_TIMEOUT_MS = 30000;
|
|
20
|
+
/** The host's step between accepting the Admit locally and delivering it. It runs once, before delivery. */
|
|
21
|
+
export type OnAdmitted = (admitted: IssuanceAdmit) => Operation<void>;
|
|
22
|
+
/** Whether the Admit reached the issuer. The Admit is accepted locally either way. */
|
|
23
|
+
export type AdmitDeliveryOutcome = {
|
|
24
|
+
state: "delivered";
|
|
25
|
+
to: string[];
|
|
26
|
+
} | {
|
|
27
|
+
state: "undelivered";
|
|
28
|
+
reason: string;
|
|
29
|
+
};
|
|
30
|
+
/** Inputs of {@link admitAndDeliver}. */
|
|
31
|
+
export interface AdmitAndDeliverInput {
|
|
32
|
+
/** SAID of the accepted Grant; the holder is its recipient. */
|
|
33
|
+
grant: string;
|
|
34
|
+
message?: string;
|
|
35
|
+
gvrsn?: Versionage;
|
|
36
|
+
auths?: WitnessAuthMap;
|
|
37
|
+
/** False when the caller takes the signed bytes itself (a file) and nothing is sent. Default true. */
|
|
38
|
+
deliver?: boolean;
|
|
39
|
+
/** Budget of the delivery. Default {@link ADMIT_DELIVERY_TIMEOUT_MS}. */
|
|
40
|
+
deliveryTimeoutMs?: number;
|
|
41
|
+
onAdmitted?: OnAdmitted;
|
|
42
|
+
}
|
|
43
|
+
/** What {@link admitAndDeliver} reports: the signed Admit and what delivery did. */
|
|
44
|
+
export interface AdmitAndDeliverOutcome {
|
|
45
|
+
admitted: IssuanceAdmit;
|
|
46
|
+
/** `undelivered` with the reason when delivery was not asked for, failed or ran out of budget. */
|
|
47
|
+
delivery: AdmitDeliveryOutcome;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sign and accept the Admit, run `onAdmitted`, then deliver within the budget. A failed or expired delivery is a
|
|
51
|
+
* value; the Admit stays accepted and `rebuildIssuanceAdmit` can send it again.
|
|
52
|
+
*
|
|
53
|
+
* @throws ValidationError as {@link admitIssuance} does, and whatever `onAdmitted` throws.
|
|
54
|
+
*/
|
|
55
|
+
export declare function admitAndDeliver(deps: AdmitDeps, input: AdmitAndDeliverInput): Operation<AdmitAndDeliverOutcome>;
|
|
56
|
+
/** Inputs of {@link receiveIssuance}. */
|
|
57
|
+
export interface ReceiveIssuanceInput extends AdmitAndDeliverInput {
|
|
58
|
+
/** Budget of the wait for the issuer to finish the exchange. */
|
|
59
|
+
timeoutMs: number;
|
|
60
|
+
}
|
|
61
|
+
/** A terminal state of an issuance other than completion. */
|
|
62
|
+
export type EndedIssuanceStatus = Extract<IssuanceStatus, {
|
|
63
|
+
state: IssuanceEndState;
|
|
64
|
+
}>;
|
|
65
|
+
/** Result of {@link receiveIssuance}. */
|
|
66
|
+
export type ReceiveIssuanceOutcome = AdmittedIssuance | EndedIssuance | TimedOutIssuance;
|
|
67
|
+
/**
|
|
68
|
+
* The credential is admitted. `admit` is the Admit's SAID. `admitted` carries the signed bytes of this call's
|
|
69
|
+
* Admit, and is absent when an earlier call admitted the Grant (then `delivery` is `undelivered` and says so).
|
|
70
|
+
*/
|
|
71
|
+
export interface AdmittedIssuance {
|
|
72
|
+
outcome: "admitted";
|
|
73
|
+
grant: string;
|
|
74
|
+
admit: string;
|
|
75
|
+
admitted?: IssuanceAdmit;
|
|
76
|
+
delivery: AdmitDeliveryOutcome;
|
|
77
|
+
}
|
|
78
|
+
/** The exchange stopped before an Admit. */
|
|
79
|
+
export interface EndedIssuance {
|
|
80
|
+
outcome: "ended";
|
|
81
|
+
grant: string;
|
|
82
|
+
status: EndedIssuanceStatus;
|
|
83
|
+
}
|
|
84
|
+
/** The issuer has not finished within `timeoutMs`; the operation is live and calling again resumes it. */
|
|
85
|
+
export interface TimedOutIssuance {
|
|
86
|
+
outcome: "timed-out";
|
|
87
|
+
grant: string;
|
|
88
|
+
timeoutMs: number;
|
|
89
|
+
status: IssuanceStatus;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The individual holder's whole path for a Grant addressed to a local identifier: approve the DH exchange when it is pending,
|
|
93
|
+
* wait for the issuer to finish it, then admit and deliver ({@link admitAndDeliver}).
|
|
94
|
+
*
|
|
95
|
+
* @throws ValidationError for a Grant that is not addressed to a local identifier, one this runtime issued, or a
|
|
96
|
+
* group identifier.
|
|
97
|
+
*/
|
|
98
|
+
export declare function receiveIssuance(ops: IssuanceOperations, input: ReceiveIssuanceInput): Operation<ReceiveIssuanceOutcome>;
|
|
99
|
+
//# sourceMappingURL=receive-issuance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receive-issuance.d.ts","sourceRoot":"","sources":["../../../src/app/ipex/receive-issuance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OA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