keri-ts 0.10.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -5
- package/esm/keri/npm/src/_dnt.polyfills.js +36 -0
- package/esm/keri/npm/src/_dnt.shims.js +2 -2
- package/esm/keri/npm/src/acdc/messaging.js +5 -0
- package/esm/keri/npm/src/acdc/observing.js +96 -0
- package/esm/keri/npm/src/acdc/regbasing.js +89 -0
- package/esm/keri/npm/src/acdc/regengine.js +355 -0
- package/esm/keri/npm/src/acdc/regeventing.js +273 -0
- package/esm/keri/npm/src/acdc/registering.js +177 -0
- package/esm/keri/npm/src/acdc/registraring.js +300 -0
- package/esm/keri/npm/src/acdc/scheming.js +306 -0
- package/esm/keri/npm/src/app/abortable.js +64 -0
- package/esm/keri/npm/src/app/agent-runtime.js +276 -163
- package/esm/keri/npm/src/app/authenticating.js +6 -3
- package/esm/keri/npm/src/app/byte-source.js +123 -0
- package/esm/keri/npm/src/app/cesr-egress.js +294 -0
- package/esm/keri/npm/src/app/cesr-http.js +63 -76
- package/esm/keri/npm/src/app/challenging.js +13 -8
- package/esm/keri/npm/src/app/cli/annotate.js +12 -92
- package/esm/keri/npm/src/app/cli/benchmark.js +18 -196
- package/esm/keri/npm/src/app/cli/challenge.js +16 -14
- package/esm/keri/npm/src/app/cli/common/context.js +1 -4
- package/esm/keri/npm/src/app/cli/common/existing.js +0 -16
- package/esm/keri/npm/src/app/cli/db-dump.js +3 -17
- package/esm/keri/npm/src/app/cli/delegate.js +37 -55
- package/esm/keri/npm/src/app/cli/did.js +14 -23
- package/esm/keri/npm/src/app/cli/ends.js +3 -5
- package/esm/keri/npm/src/app/cli/exchange.js +0 -2
- package/esm/keri/npm/src/app/cli/incept.js +5 -7
- package/esm/keri/npm/src/app/cli/init.js +3 -9
- package/esm/keri/npm/src/app/cli/ipex.js +140 -61
- package/esm/keri/npm/src/app/cli/loc.js +7 -10
- package/esm/keri/npm/src/app/cli/multisig.js +146 -60
- package/esm/keri/npm/src/app/cli/notifications.js +1 -0
- package/esm/keri/npm/src/app/cli/oobi.js +3 -5
- package/esm/keri/npm/src/app/cli/output.js +22 -0
- package/esm/keri/npm/src/app/cli/query.js +28 -29
- package/esm/keri/npm/src/app/cli/rotate.js +3 -5
- package/esm/keri/npm/src/app/cli/vc.js +3 -4
- package/esm/keri/npm/src/app/cli/verifier.js +7 -17
- package/esm/keri/npm/src/app/credential-workflows.js +25 -47
- package/esm/keri/npm/src/app/cue-runtime.js +24 -56
- package/esm/keri/npm/src/app/delegating.js +30 -12
- package/esm/keri/npm/src/app/endpoint-roleing.js +32 -28
- package/esm/keri/npm/src/app/essr.js +170 -0
- package/esm/keri/npm/src/app/exchanging.js +652 -128
- package/esm/keri/npm/src/app/forwarding.js +274 -438
- package/esm/keri/npm/src/app/grouping.js +333 -97
- package/esm/keri/npm/src/app/habbing.js +123 -306
- package/esm/keri/npm/src/app/httping.js +106 -32
- package/esm/keri/npm/src/app/ipex-credentialing.js +40 -37
- package/esm/keri/npm/src/app/ipex-graph.js +407 -0
- package/esm/keri/npm/src/app/ipex-grouping.js +33 -75
- package/esm/keri/npm/src/app/ipex-node-authentication.js +108 -0
- package/esm/keri/npm/src/app/ipex-v2.js +438 -0
- package/esm/keri/npm/src/app/ipexing.js +5 -9
- package/esm/keri/npm/src/app/keeping.js +8 -0
- package/esm/keri/npm/src/app/mailbox-director.js +285 -179
- package/esm/keri/npm/src/app/mailbox-sse.js +224 -101
- package/esm/keri/npm/src/app/mailboxing.js +19 -21
- package/esm/keri/npm/src/app/multisig-workflows.js +147 -225
- package/esm/keri/npm/src/app/notifying.js +20 -15
- package/esm/keri/npm/src/app/oobi-replies.js +111 -0
- package/esm/keri/npm/src/app/oobiery.js +141 -120
- package/esm/keri/npm/src/app/parsering.js +253 -232
- package/esm/keri/npm/src/app/query-replies.js +100 -0
- package/esm/keri/npm/src/app/querying.js +286 -194
- package/esm/keri/npm/src/app/reactor.js +255 -64
- package/esm/keri/npm/src/app/reply-streams.js +185 -0
- package/esm/keri/npm/src/app/respondant.js +268 -42
- package/esm/keri/npm/src/app/signaling.js +34 -25
- package/esm/keri/npm/src/app/socket-source.js +163 -0
- package/esm/keri/npm/src/app/stored-replies.js +53 -0
- package/esm/keri/npm/src/app/tcp-conversation.js +85 -0
- package/esm/keri/npm/src/app/tcp-egress.js +251 -0
- package/esm/keri/npm/src/app/verifier-agent.js +76 -41
- package/esm/keri/npm/src/app/verifying.js +25 -28
- package/esm/keri/npm/src/app/version.js +2 -2
- package/esm/keri/npm/src/app/witnessing.js +318 -233
- package/esm/keri/npm/src/core/attachment-countering.js +2 -2
- package/esm/keri/npm/src/core/deck.js +9 -9
- package/esm/keri/npm/src/core/dispatch.js +27 -58
- package/esm/keri/npm/src/core/errors.js +5 -10
- package/esm/keri/npm/src/core/eventing.js +246 -356
- package/esm/keri/npm/src/core/exchange-proofing.js +60 -0
- package/esm/keri/npm/src/core/kever-decisions.js +5 -10
- package/esm/keri/npm/src/core/kever.js +85 -164
- package/esm/keri/npm/src/core/kram-auth.js +32 -0
- package/esm/keri/npm/src/core/kram-policy.js +303 -0
- package/esm/keri/npm/src/core/kram-pruning.js +186 -0
- package/esm/keri/npm/src/core/kram-signatures.js +90 -0
- package/esm/keri/npm/src/core/kram-staging.js +149 -0
- package/esm/keri/npm/src/core/kram-time.js +91 -0
- package/esm/keri/npm/src/core/kraming.js +78 -0
- package/esm/keri/npm/src/core/protocol-eventing.js +5 -0
- package/esm/keri/npm/src/core/protocol-exchanging.js +40 -0
- package/esm/keri/npm/src/core/protocol-serialization.js +63 -25
- package/esm/keri/npm/src/core/protocol-vdr-eventing.js +10 -11
- package/esm/keri/npm/src/core/records.js +0 -19
- package/esm/keri/npm/src/core/routing.js +184 -124
- package/esm/keri/npm/src/db/basing.js +575 -87
- package/esm/keri/npm/src/db/core/keys.js +2 -2
- package/esm/keri/npm/src/db/core/lmdber.js +19 -25
- package/esm/keri/npm/src/db/core/path-manager.js +2 -4
- package/esm/keri/npm/src/db/escrowing.js +89 -148
- package/esm/keri/npm/src/db/exchange-nests.js +80 -0
- package/esm/keri/npm/src/db/exchange-records.js +7 -0
- package/esm/keri/npm/src/db/index.js +4 -2
- package/esm/keri/npm/src/db/keeping.js +1 -3
- package/esm/keri/npm/src/db/kel-replay.js +43 -0
- package/esm/keri/npm/src/db/kram-factors.js +160 -0
- package/esm/keri/npm/src/db/mailboxing.js +13 -3
- package/esm/keri/npm/src/db/payload-archive.js +402 -0
- package/esm/keri/npm/src/db/payload-store.js +406 -0
- package/esm/keri/npm/src/db/payload-view.js +23 -0
- package/esm/keri/npm/src/db/reger.js +88 -24
- package/esm/keri/npm/src/db/subing.js +9 -0
- package/esm/keri/npm/src/db/tel-replay.js +55 -0
- package/esm/keri/npm/src/db/witness-replay.js +127 -0
- package/esm/keri/npm/src/did/keri/resolving.js +4 -18
- package/esm/keri/npm/src/did/webs/artifacts.js +24 -14
- package/esm/keri/npm/src/did/webs/designated-aliases.js +16 -44
- package/esm/keri/npm/src/did/webs/documenting.js +8 -8
- package/esm/keri/npm/src/did/webs/resolving.js +58 -48
- package/esm/keri/npm/src/npm/deno-shim.js +17 -0
- package/esm/keri/npm/src/runtime/index.js +71 -58
- package/esm/keri/npm/src/time/mod.js +18 -3
- package/esm/keri/npm/src/vdr/credential-tsn.js +230 -0
- package/esm/keri/npm/src/vdr/credentialing.js +8 -32
- package/esm/keri/npm/src/vdr/eventing.js +101 -43
- package/esm/keri/npm/src/vdr/registry-tsn.js +217 -0
- package/esm/keri/npm/src/vdr/tsn-query.js +39 -0
- package/package.json +9 -26
- package/types/_dnt.polyfills.d.ts +49 -0
- package/types/_dnt.polyfills.d.ts.map +1 -1
- package/types/_dnt.shims.d.ts +3 -2
- package/types/_dnt.shims.d.ts.map +1 -1
- package/types/acdc/messaging.d.ts.map +1 -1
- package/types/acdc/observing.d.ts +31 -0
- package/types/acdc/observing.d.ts.map +1 -0
- package/types/acdc/regbasing.d.ts +35 -0
- package/types/acdc/regbasing.d.ts.map +1 -0
- package/types/acdc/regengine.d.ts +68 -0
- package/types/acdc/regengine.d.ts.map +1 -0
- package/types/acdc/regeventing.d.ts +101 -0
- package/types/acdc/regeventing.d.ts.map +1 -0
- package/types/acdc/registering.d.ts +72 -0
- package/types/acdc/registering.d.ts.map +1 -0
- package/types/acdc/registraring.d.ts +87 -0
- package/types/acdc/registraring.d.ts.map +1 -0
- package/types/acdc/scheming.d.ts +28 -0
- package/types/acdc/scheming.d.ts.map +1 -0
- package/types/app/abortable.d.ts +13 -0
- package/types/app/abortable.d.ts.map +1 -0
- package/types/app/agent-runtime.d.ts +46 -77
- package/types/app/agent-runtime.d.ts.map +1 -1
- package/types/app/authenticating.d.ts.map +1 -1
- package/types/app/byte-source.d.ts +16 -0
- package/types/app/byte-source.d.ts.map +1 -0
- package/types/app/cesr-egress.d.ts +45 -0
- package/types/app/cesr-egress.d.ts.map +1 -0
- package/types/app/cesr-http.d.ts +8 -13
- package/types/app/cesr-http.d.ts.map +1 -1
- package/types/app/challenging.d.ts +6 -0
- package/types/app/challenging.d.ts.map +1 -1
- package/types/app/cli/annotate.d.ts +2 -7
- package/types/app/cli/annotate.d.ts.map +1 -1
- package/types/app/cli/benchmark.d.ts +2 -9
- package/types/app/cli/benchmark.d.ts.map +1 -1
- package/types/app/cli/challenge.d.ts.map +1 -1
- package/types/app/cli/common/context.d.ts +0 -1
- package/types/app/cli/common/context.d.ts.map +1 -1
- package/types/app/cli/common/existing.d.ts +0 -1
- package/types/app/cli/common/existing.d.ts.map +1 -1
- package/types/app/cli/db-dump.d.ts +0 -2
- package/types/app/cli/db-dump.d.ts.map +1 -1
- package/types/app/cli/delegate.d.ts +0 -22
- package/types/app/cli/delegate.d.ts.map +1 -1
- package/types/app/cli/did.d.ts.map +1 -1
- package/types/app/cli/ends.d.ts.map +1 -1
- package/types/app/cli/exchange.d.ts.map +1 -1
- package/types/app/cli/init.d.ts.map +1 -1
- package/types/app/cli/ipex.d.ts +1 -1
- package/types/app/cli/ipex.d.ts.map +1 -1
- package/types/app/cli/loc.d.ts.map +1 -1
- package/types/app/cli/multisig.d.ts.map +1 -1
- package/types/app/cli/notifications.d.ts.map +1 -1
- package/types/app/cli/oobi.d.ts +1 -1
- package/types/app/cli/oobi.d.ts.map +1 -1
- package/types/app/cli/output.d.ts +2 -0
- package/types/app/cli/output.d.ts.map +1 -0
- package/types/app/cli/query.d.ts.map +1 -1
- package/types/app/cli/rotate.d.ts.map +1 -1
- package/types/app/cli/vc.d.ts.map +1 -1
- package/types/app/cli/verifier.d.ts.map +1 -1
- package/types/app/credential-workflows.d.ts +5 -10
- package/types/app/credential-workflows.d.ts.map +1 -1
- package/types/app/cue-runtime.d.ts +3 -29
- package/types/app/cue-runtime.d.ts.map +1 -1
- package/types/app/delegating.d.ts +15 -6
- package/types/app/delegating.d.ts.map +1 -1
- package/types/app/endpoint-roleing.d.ts +7 -5
- package/types/app/endpoint-roleing.d.ts.map +1 -1
- package/types/app/essr.d.ts +58 -0
- package/types/app/essr.d.ts.map +1 -0
- package/types/app/exchanging.d.ts +129 -18
- package/types/app/exchanging.d.ts.map +1 -1
- package/types/app/forwarding.d.ts +91 -93
- package/types/app/forwarding.d.ts.map +1 -1
- package/types/app/grouping.d.ts +92 -9
- package/types/app/grouping.d.ts.map +1 -1
- package/types/app/habbing.d.ts +25 -50
- package/types/app/habbing.d.ts.map +1 -1
- package/types/app/httping.d.ts +10 -1
- package/types/app/httping.d.ts.map +1 -1
- package/types/app/ipex-credentialing.d.ts +11 -5
- package/types/app/ipex-credentialing.d.ts.map +1 -1
- package/types/app/ipex-graph.d.ts +49 -0
- package/types/app/ipex-graph.d.ts.map +1 -0
- package/types/app/ipex-grouping.d.ts +6 -14
- package/types/app/ipex-grouping.d.ts.map +1 -1
- package/types/app/ipex-node-authentication.d.ts +27 -0
- package/types/app/ipex-node-authentication.d.ts.map +1 -0
- package/types/app/ipex-v2.d.ts +46 -0
- package/types/app/ipex-v2.d.ts.map +1 -0
- package/types/app/ipexing.d.ts +5 -2
- package/types/app/ipexing.d.ts.map +1 -1
- package/types/app/keeping.d.ts +2 -0
- package/types/app/keeping.d.ts.map +1 -1
- package/types/app/mailbox-director.d.ts +21 -30
- package/types/app/mailbox-director.d.ts.map +1 -1
- package/types/app/mailbox-sse.d.ts +16 -9
- package/types/app/mailbox-sse.d.ts.map +1 -1
- package/types/app/mailboxing.d.ts +4 -6
- package/types/app/mailboxing.d.ts.map +1 -1
- package/types/app/multisig-workflows.d.ts +9 -21
- package/types/app/multisig-workflows.d.ts.map +1 -1
- package/types/app/notifying.d.ts +4 -1
- package/types/app/notifying.d.ts.map +1 -1
- package/types/app/oobi-replies.d.ts +8 -0
- package/types/app/oobi-replies.d.ts.map +1 -0
- package/types/app/oobiery.d.ts +8 -2
- package/types/app/oobiery.d.ts.map +1 -1
- package/types/app/parsering.d.ts +45 -19
- package/types/app/parsering.d.ts.map +1 -1
- package/types/app/query-replies.d.ts +40 -0
- package/types/app/query-replies.d.ts.map +1 -0
- package/types/app/querying.d.ts +63 -72
- package/types/app/querying.d.ts.map +1 -1
- package/types/app/reactor.d.ts +72 -50
- package/types/app/reactor.d.ts.map +1 -1
- package/types/app/reply-streams.d.ts +20 -0
- package/types/app/reply-streams.d.ts.map +1 -0
- package/types/app/respondant.d.ts +40 -20
- package/types/app/respondant.d.ts.map +1 -1
- package/types/app/signaling.d.ts +11 -7
- package/types/app/signaling.d.ts.map +1 -1
- package/types/app/socket-source.d.ts +16 -0
- package/types/app/socket-source.d.ts.map +1 -0
- package/types/app/stored-replies.d.ts +11 -0
- package/types/app/stored-replies.d.ts.map +1 -0
- package/types/app/tcp-conversation.d.ts +27 -0
- package/types/app/tcp-conversation.d.ts.map +1 -0
- package/types/app/tcp-egress.d.ts +49 -0
- package/types/app/tcp-egress.d.ts.map +1 -0
- package/types/app/verifier-agent.d.ts +13 -3
- package/types/app/verifier-agent.d.ts.map +1 -1
- package/types/app/verifying.d.ts +5 -1
- package/types/app/verifying.d.ts.map +1 -1
- package/types/app/version.d.ts +2 -2
- package/types/app/version.d.ts.map +1 -1
- package/types/app/witnessing.d.ts +64 -20
- package/types/app/witnessing.d.ts.map +1 -1
- package/types/core/attachment-countering.d.ts +3 -3
- package/types/core/attachment-countering.d.ts.map +1 -1
- package/types/core/cues.d.ts +76 -38
- package/types/core/cues.d.ts.map +1 -1
- package/types/core/deck.d.ts +1 -0
- package/types/core/deck.d.ts.map +1 -1
- package/types/core/dispatch.d.ts +20 -35
- package/types/core/dispatch.d.ts.map +1 -1
- package/types/core/errors.d.ts +4 -4
- package/types/core/errors.d.ts.map +1 -1
- package/types/core/eventing.d.ts +60 -54
- package/types/core/eventing.d.ts.map +1 -1
- package/types/core/exchange-proofing.d.ts +31 -0
- package/types/core/exchange-proofing.d.ts.map +1 -0
- package/types/core/kever-decisions.d.ts +18 -18
- package/types/core/kever-decisions.d.ts.map +1 -1
- package/types/core/kever.d.ts +13 -45
- package/types/core/kever.d.ts.map +1 -1
- package/types/core/kram-auth.d.ts +23 -0
- package/types/core/kram-auth.d.ts.map +1 -0
- package/types/core/kram-policy.d.ts +43 -0
- package/types/core/kram-policy.d.ts.map +1 -0
- package/types/core/kram-pruning.d.ts +38 -0
- package/types/core/kram-pruning.d.ts.map +1 -0
- package/types/core/kram-signatures.d.ts +29 -0
- package/types/core/kram-signatures.d.ts.map +1 -0
- package/types/core/kram-staging.d.ts +30 -0
- package/types/core/kram-staging.d.ts.map +1 -0
- package/types/core/kram-time.d.ts +47 -0
- package/types/core/kram-time.d.ts.map +1 -0
- package/types/core/kraming.d.ts +42 -0
- package/types/core/kraming.d.ts.map +1 -0
- package/types/core/protocol-eventing.d.ts +5 -0
- package/types/core/protocol-eventing.d.ts.map +1 -1
- package/types/core/protocol-exchanging.d.ts +12 -0
- package/types/core/protocol-exchanging.d.ts.map +1 -1
- package/types/core/protocol-serialization.d.ts +21 -2
- package/types/core/protocol-serialization.d.ts.map +1 -1
- package/types/core/protocol-vdr-eventing.d.ts +7 -5
- package/types/core/protocol-vdr-eventing.d.ts.map +1 -1
- package/types/core/records.d.ts +18 -51
- package/types/core/records.d.ts.map +1 -1
- package/types/core/routing.d.ts +58 -23
- package/types/core/routing.d.ts.map +1 -1
- package/types/db/basing.d.ts +98 -14
- package/types/db/basing.d.ts.map +1 -1
- package/types/db/core/keys.d.ts.map +1 -1
- package/types/db/core/lmdber.d.ts +3 -1
- package/types/db/core/lmdber.d.ts.map +1 -1
- package/types/db/core/path-manager.d.ts.map +1 -1
- package/types/db/escrowing.d.ts +24 -47
- package/types/db/escrowing.d.ts.map +1 -1
- package/types/db/exchange-nests.d.ts +15 -0
- package/types/db/exchange-nests.d.ts.map +1 -0
- package/types/db/exchange-records.d.ts +33 -0
- package/types/db/exchange-records.d.ts.map +1 -0
- package/types/db/index.d.ts +4 -2
- package/types/db/index.d.ts.map +1 -1
- package/types/db/keeping.d.ts.map +1 -1
- package/types/db/kel-replay.d.ts +14 -0
- package/types/db/kel-replay.d.ts.map +1 -0
- package/types/db/koming.d.ts +1 -1
- package/types/db/koming.d.ts.map +1 -1
- package/types/db/kram-factors.d.ts +11 -0
- package/types/db/kram-factors.d.ts.map +1 -0
- package/types/db/mailboxing.d.ts +2 -1
- package/types/db/mailboxing.d.ts.map +1 -1
- package/types/db/payload-archive.d.ts +70 -0
- package/types/db/payload-archive.d.ts.map +1 -0
- package/types/db/payload-store.d.ts +40 -0
- package/types/db/payload-store.d.ts.map +1 -0
- package/types/db/payload-view.d.ts +4 -0
- package/types/db/payload-view.d.ts.map +1 -0
- package/types/db/reger.d.ts +15 -7
- package/types/db/reger.d.ts.map +1 -1
- package/types/db/subing.d.ts +6 -1
- package/types/db/subing.d.ts.map +1 -1
- package/types/db/tel-replay.d.ts +21 -0
- package/types/db/tel-replay.d.ts.map +1 -0
- package/types/db/witness-replay.d.ts +16 -0
- package/types/db/witness-replay.d.ts.map +1 -0
- package/types/did/keri/resolving.d.ts +5 -10
- package/types/did/keri/resolving.d.ts.map +1 -1
- package/types/did/webs/artifacts.d.ts +5 -1
- package/types/did/webs/artifacts.d.ts.map +1 -1
- package/types/did/webs/designated-aliases.d.ts +5 -3
- package/types/did/webs/designated-aliases.d.ts.map +1 -1
- package/types/did/webs/documenting.d.ts +6 -5
- package/types/did/webs/documenting.d.ts.map +1 -1
- package/types/did/webs/resolving.d.ts.map +1 -1
- package/types/npm/deno-shim.d.ts +3 -0
- package/types/npm/deno-shim.d.ts.map +1 -0
- package/types/runtime/index.d.ts +72 -58
- package/types/runtime/index.d.ts.map +1 -1
- package/types/time/mod.d.ts +4 -2
- package/types/time/mod.d.ts.map +1 -1
- package/types/vdr/credential-tsn.d.ts +23 -0
- package/types/vdr/credential-tsn.d.ts.map +1 -0
- package/types/vdr/credentialing.d.ts +2 -12
- package/types/vdr/credentialing.d.ts.map +1 -1
- package/types/vdr/eventing.d.ts +23 -4
- package/types/vdr/eventing.d.ts.map +1 -1
- package/types/vdr/registry-tsn.d.ts +28 -0
- package/types/vdr/registry-tsn.d.ts.map +1 -0
- package/types/vdr/tsn-query.d.ts +27 -0
- package/types/vdr/tsn-query.d.ts.map +1 -0
- package/esm/keri/npm/src/app/query-transport.js +0 -121
- package/esm/keri/npm/src/db/mailbox-inbox.js +0 -206
- package/esm/keri/npm/src/db/outboxing.js +0 -328
- package/types/app/query-transport.d.ts +0 -13
- package/types/app/query-transport.d.ts.map +0 -1
- package/types/db/mailbox-inbox.d.ts +0 -72
- package/types/db/mailbox-inbox.d.ts.map +0 -1
- package/types/db/outboxing.d.ts +0 -160
- package/types/db/outboxing.d.ts.map +0 -1
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verify supplied ACDC v2 registry evidence against accepted KEL state.
|
|
3
|
+
* Mirrors frozen KERIpy acdc.regeventing.vet/vetBinds. Parsing, KEL acceptance,
|
|
4
|
+
* fetching, escrow persistence, and issuer-side TEL processing belong to callers.
|
|
5
|
+
*/
|
|
6
|
+
import { commitBlindState, commitBoundState, Ilks, } from "cesr-ts";
|
|
7
|
+
import { timestampMicros } from "../time/mod.js";
|
|
8
|
+
/** Sequence numbers retain protocol precision; database KEL lookups remain safe integers. */
|
|
9
|
+
function ordinal(event) {
|
|
10
|
+
return BigInt(`0x${event.sad.n}`);
|
|
11
|
+
}
|
|
12
|
+
/** Registry rules supplement, rather than replace, Serder field/order/SAID validation. */
|
|
13
|
+
function normalizeEvent(event) {
|
|
14
|
+
if (!event.verify() || (event.ilk !== Ilks.rip && event.ilk !== Ilks.bup))
|
|
15
|
+
return { kind: "reject", reason: "event" };
|
|
16
|
+
const sequence = event.sad?.n;
|
|
17
|
+
if (typeof sequence !== "string" || !/^[0-9a-fA-F]+$/.test(sequence) || ordinal(event) >= 2n ** 128n) {
|
|
18
|
+
return { kind: "reject", reason: "sequence" };
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
kind: "valid",
|
|
22
|
+
event: {
|
|
23
|
+
serder: event,
|
|
24
|
+
said: event.said,
|
|
25
|
+
ilk: event.ilk,
|
|
26
|
+
regid: event.ilk === Ilks.rip ? event.said : event.sad.rd,
|
|
27
|
+
sn: ordinal(event),
|
|
28
|
+
prior: event.ilk === Ilks.rip ? null : event.sad.p,
|
|
29
|
+
issuer: event.issuer,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Validate inception fields and, for a local processor, its controlling issuer. */
|
|
34
|
+
export function validateRip(serder, issuer) {
|
|
35
|
+
const result = normalizeEvent(serder);
|
|
36
|
+
if (result.kind === "reject")
|
|
37
|
+
return result;
|
|
38
|
+
const event = result.event;
|
|
39
|
+
if (event.ilk !== Ilks.rip)
|
|
40
|
+
return { kind: "reject", reason: "event" };
|
|
41
|
+
if (event.sn !== 0n)
|
|
42
|
+
return { kind: "reject", reason: "sequence" };
|
|
43
|
+
if (issuer !== undefined && event.issuer !== issuer)
|
|
44
|
+
return { kind: "reject", reason: "issuer" };
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
/** Validate update fields; ordering against an accepted head belongs to the processor. */
|
|
48
|
+
export function validateUpdate(serder, regid, prior) {
|
|
49
|
+
const result = normalizeEvent(serder);
|
|
50
|
+
if (result.kind === "reject")
|
|
51
|
+
return result;
|
|
52
|
+
const event = result.event;
|
|
53
|
+
if (event.ilk !== Ilks.bup)
|
|
54
|
+
return { kind: "reject", reason: "event" };
|
|
55
|
+
if (event.regid !== regid)
|
|
56
|
+
return { kind: "reject", reason: "registry" };
|
|
57
|
+
if (event.sn < 1n)
|
|
58
|
+
return { kind: "reject", reason: "sequence" };
|
|
59
|
+
if (prior !== undefined && event.prior !== prior)
|
|
60
|
+
return { kind: "reject", reason: "prior" };
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Check a local TEL anchor against the last accepted, fully witnessed KEL event.
|
|
65
|
+
* Unlike observer vetting, this requires the full registry/ordinal/digest tuple.
|
|
66
|
+
* Missing or mismatched evidence returns false; database failures propagate.
|
|
67
|
+
*/
|
|
68
|
+
export function verifyRegistryAnchor(event, { db, issuer, number, diger }) {
|
|
69
|
+
if (!number || !diger || number.num > BigInt(Number.MAX_SAFE_INTEGER))
|
|
70
|
+
return false;
|
|
71
|
+
const said = db.kels.getLast(issuer, Number(number.num));
|
|
72
|
+
const anchor = said ? db.getEvtSerder(issuer, said) : null;
|
|
73
|
+
if (!anchor || anchor.said !== diger.qb64 || !db.fullyWitnessed(anchor))
|
|
74
|
+
return false;
|
|
75
|
+
return anchor.seals.some((seal) => !!seal && typeof seal === "object" && !Array.isArray(seal)
|
|
76
|
+
&& "i" in seal && "s" in seal && "d" in seal
|
|
77
|
+
&& seal.i === event.regid && seal.s === event.serder.sad.n && seal.d === event.said);
|
|
78
|
+
}
|
|
79
|
+
/** Verifier anchors match digests; a seal's TEL sequence hint is not authoritative. */
|
|
80
|
+
function sealDigests(event) {
|
|
81
|
+
return event.seals.flatMap((seal) => {
|
|
82
|
+
if (typeof seal === "string")
|
|
83
|
+
return [seal];
|
|
84
|
+
if (seal && typeof seal === "object" && !Array.isArray(seal) && "d" in seal)
|
|
85
|
+
return [seal.d];
|
|
86
|
+
return [];
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/** Scan only the accepted controller's KEL frontier; this does not verify KEL signatures. */
|
|
90
|
+
function scanKel(db, issuer, said) {
|
|
91
|
+
const kever = db.getKever(issuer);
|
|
92
|
+
if (!kever)
|
|
93
|
+
return null;
|
|
94
|
+
for (const [sn, digest] of db.getKelItemIter(issuer)) {
|
|
95
|
+
if (sn > kever.sn)
|
|
96
|
+
break;
|
|
97
|
+
const event = db.getEvtSerder(issuer, digest);
|
|
98
|
+
if (event && sealDigests(event).includes(said))
|
|
99
|
+
return [sn, event.said];
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
/** Match the reference's source-hint fallback and named aggregate-seal refusal. */
|
|
104
|
+
function vetAnchor(event, issuer, db, told, source) {
|
|
105
|
+
const missing = { kind: "missing", reason: "anchor", issuer, said: event.said };
|
|
106
|
+
if (typeof source === "number" && (!Number.isSafeInteger(source) || source < 0)) {
|
|
107
|
+
throw new RangeError("Registry KEL source must be a non-negative safe integer or SAID.");
|
|
108
|
+
}
|
|
109
|
+
if (!db.getKever(issuer))
|
|
110
|
+
return missing;
|
|
111
|
+
if (source !== undefined) {
|
|
112
|
+
const said = typeof source === "string" ? source : db.kels.getLast(issuer, source);
|
|
113
|
+
const anchor = said ? db.getEvtSerder(issuer, said) : null;
|
|
114
|
+
if (anchor) {
|
|
115
|
+
const digests = sealDigests(anchor);
|
|
116
|
+
if (digests.includes(event.said))
|
|
117
|
+
return { kind: "verified", anchor: [anchor.sn, anchor.said] };
|
|
118
|
+
if (digests.length && !digests.some((digest) => typeof digest === "string" && told.has(digest))) {
|
|
119
|
+
return { kind: "reject", reason: "rootSeal" };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const anchor = scanKel(db, issuer, event.said);
|
|
124
|
+
if (anchor)
|
|
125
|
+
return { kind: "verified", anchor };
|
|
126
|
+
for (const pre of db.kevers.keys()) {
|
|
127
|
+
if (pre !== issuer && scanKel(db, pre, event.said))
|
|
128
|
+
return { kind: "reject", reason: "anchor" };
|
|
129
|
+
}
|
|
130
|
+
return missing;
|
|
131
|
+
}
|
|
132
|
+
/** Recompute the disclosed tuple with the reference's default Blake3 commitment. */
|
|
133
|
+
function vetBlind(blinder, blid) {
|
|
134
|
+
const redone = "bn" in blinder ? commitBoundState(blinder, "E") : commitBlindState(blinder, "E");
|
|
135
|
+
return redone.d.nonce === blid;
|
|
136
|
+
}
|
|
137
|
+
/** A registry must bind both the exact credential and its issuer, plus rd when present. */
|
|
138
|
+
function binding(acdc, state) {
|
|
139
|
+
if (!acdc.verify() || state.acdc !== acdc.said || acdc.issuer !== state.issuer)
|
|
140
|
+
return null;
|
|
141
|
+
const regid = acdc.sad.rd;
|
|
142
|
+
return regid ? (regid === state.regid ? "mutual" : null) : "oneway";
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Verify an entire supplied rip/bup chain, accepting unordered exact duplicates.
|
|
146
|
+
* A missing anchor anywhere prevents a partial-head success, including before
|
|
147
|
+
* deciding whether competing events constitute anchored duplicity. No writes occur.
|
|
148
|
+
*/
|
|
149
|
+
export function vet({ rip, updates = [], db, sources = new Map(), acdc, blinder }) {
|
|
150
|
+
const inception = validateRip(rip);
|
|
151
|
+
if (inception.kind === "reject")
|
|
152
|
+
return inception;
|
|
153
|
+
for (const update of updates) {
|
|
154
|
+
const result = validateUpdate(update, inception.event.regid);
|
|
155
|
+
if (result.kind === "reject")
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
const issuer = rip.issuer;
|
|
159
|
+
const told = new Set([rip.said, ...updates.map((event) => event.said)]);
|
|
160
|
+
const first = vetAnchor(rip, issuer, db, told, sources.get(rip.said));
|
|
161
|
+
if (first.kind !== "verified")
|
|
162
|
+
return first;
|
|
163
|
+
const anchors = [first.anchor];
|
|
164
|
+
let remaining = [...updates];
|
|
165
|
+
let head = rip;
|
|
166
|
+
let n = 1n;
|
|
167
|
+
while (remaining.length) {
|
|
168
|
+
const candidates = remaining.filter((event) => ordinal(event) === n);
|
|
169
|
+
if (!candidates.length)
|
|
170
|
+
return { kind: "reject", reason: "sequence" };
|
|
171
|
+
if (candidates.some((event) => event.sad.p !== head.said))
|
|
172
|
+
return { kind: "reject", reason: "prior" };
|
|
173
|
+
const unique = [...new Map(candidates.map((event) => [event.said, event])).values()];
|
|
174
|
+
const couples = [];
|
|
175
|
+
for (const event of unique) {
|
|
176
|
+
const result = vetAnchor(event, issuer, db, told, sources.get(event.said));
|
|
177
|
+
if (result.kind !== "verified")
|
|
178
|
+
return result;
|
|
179
|
+
couples.push(result.anchor);
|
|
180
|
+
}
|
|
181
|
+
if (unique.length > 1)
|
|
182
|
+
return { kind: "reject", reason: "duplicity" };
|
|
183
|
+
head = unique[0];
|
|
184
|
+
anchors.push(couples[0]);
|
|
185
|
+
remaining = remaining.filter((event) => ordinal(event) !== n);
|
|
186
|
+
n++;
|
|
187
|
+
}
|
|
188
|
+
const state = {
|
|
189
|
+
regid: rip.said,
|
|
190
|
+
issuer,
|
|
191
|
+
said: head.said,
|
|
192
|
+
sn: ordinal(head),
|
|
193
|
+
ilk: head.ilk,
|
|
194
|
+
acdc: null,
|
|
195
|
+
state: null,
|
|
196
|
+
stamp: head.sad.dt,
|
|
197
|
+
binding: null,
|
|
198
|
+
anchors,
|
|
199
|
+
};
|
|
200
|
+
if (head.ilk === Ilks.bup && blinder) {
|
|
201
|
+
if (!vetBlind(blinder, head.sad.b))
|
|
202
|
+
return { kind: "reject", reason: "disclosure" };
|
|
203
|
+
state.acdc = blinder.td.nonce || null;
|
|
204
|
+
state.state = blinder.ts.text || null;
|
|
205
|
+
}
|
|
206
|
+
if (acdc) {
|
|
207
|
+
if (head.ilk === Ilks.bup && !blinder)
|
|
208
|
+
return { kind: "reject", reason: "disclosure" };
|
|
209
|
+
state.binding = binding(acdc, state);
|
|
210
|
+
if (!state.binding)
|
|
211
|
+
return { kind: "reject", reason: "binding" };
|
|
212
|
+
}
|
|
213
|
+
return { kind: "verified", state };
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Resolve the latest non-vacuous binding behind a verified (possibly historical)
|
|
217
|
+
* head. Every intervening vacuous update needs exactly one authentic disclosure.
|
|
218
|
+
* The caller supplies a trusted receiver timestamp; this creates no KRAM state.
|
|
219
|
+
*/
|
|
220
|
+
export function vetBinds({ rip, updates = [], db, sources = new Map(), acdc, blinders, target, controller, cutoff, requireSource = false }) {
|
|
221
|
+
if (cutoff !== undefined) {
|
|
222
|
+
const when = timestampMicros(cutoff);
|
|
223
|
+
const inception = timestampMicros(rip.sad?.dt);
|
|
224
|
+
if (when === null || inception === null)
|
|
225
|
+
return { kind: "reject", reason: "timestamp" };
|
|
226
|
+
if (inception > when)
|
|
227
|
+
return { kind: "reject", reason: "binding" };
|
|
228
|
+
const selected = [];
|
|
229
|
+
for (const update of updates) {
|
|
230
|
+
const stamp = timestampMicros(update.sad?.dt);
|
|
231
|
+
if (stamp === null)
|
|
232
|
+
return { kind: "reject", reason: "timestamp" };
|
|
233
|
+
if (stamp <= when)
|
|
234
|
+
selected.push(update);
|
|
235
|
+
}
|
|
236
|
+
updates = selected;
|
|
237
|
+
}
|
|
238
|
+
const result = vet({ rip, updates, db, sources });
|
|
239
|
+
if (result.kind !== "verified")
|
|
240
|
+
return result;
|
|
241
|
+
if (controller !== undefined && result.state.issuer !== controller)
|
|
242
|
+
return { kind: "reject", reason: "binding" };
|
|
243
|
+
const newest = [...updates].sort((a, b) => ordinal(a) > ordinal(b) ? -1 : ordinal(a) < ordinal(b) ? 1 : 0);
|
|
244
|
+
for (const update of newest) {
|
|
245
|
+
const matches = blinders.filter((blinder) => blinder.d.nonce === update.sad.b);
|
|
246
|
+
if (matches.length !== 1 || !vetBlind(matches[0], update.sad.b)) {
|
|
247
|
+
return { kind: "reject", reason: "disclosure" };
|
|
248
|
+
}
|
|
249
|
+
const blinder = matches[0];
|
|
250
|
+
const td = blinder.td.nonce;
|
|
251
|
+
const state = blinder.ts.text;
|
|
252
|
+
if (!td && !state)
|
|
253
|
+
continue;
|
|
254
|
+
if (td !== target)
|
|
255
|
+
return { kind: "reject", reason: "binding" };
|
|
256
|
+
if (requireSource && !sources.has(update.said))
|
|
257
|
+
return { kind: "reject", reason: "anchor" };
|
|
258
|
+
const bound = {
|
|
259
|
+
...result.state,
|
|
260
|
+
acdc: td,
|
|
261
|
+
state,
|
|
262
|
+
stamp: update.sad.dt,
|
|
263
|
+
binding: "presentation",
|
|
264
|
+
};
|
|
265
|
+
if (acdc) {
|
|
266
|
+
bound.binding = binding(acdc, bound);
|
|
267
|
+
if (!bound.binding)
|
|
268
|
+
return { kind: "reject", reason: "binding" };
|
|
269
|
+
}
|
|
270
|
+
return { kind: "verified", state: bound };
|
|
271
|
+
}
|
|
272
|
+
return { kind: "reject", reason: "binding" };
|
|
273
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/** Storage-only facade for public registry evidence and local registry aliases. */
|
|
2
|
+
import { Saider } from "cesr-ts";
|
|
3
|
+
import { DatabaseNotOpenError, DatabaseOperationError, ValidationError } from "../core/errors.js";
|
|
4
|
+
import { RawRecord } from "../core/records.js";
|
|
5
|
+
import { Komer } from "../db/koming.js";
|
|
6
|
+
import { RegBaser } from "./regbasing.js";
|
|
7
|
+
/** Persisted local registry alias, matching frozen registering.RegistryRecord. */
|
|
8
|
+
export class RegistryRecord extends RawRecord {
|
|
9
|
+
}
|
|
10
|
+
/** Acquire one backing owner; failures/cancellation join cleanup before ownership transfers. */
|
|
11
|
+
export function* openRegistry({ web = false, reopen = true, ...options } = {}) {
|
|
12
|
+
if (web)
|
|
13
|
+
throw new ValidationError("web registry backend is not yet supported by V2 Regery");
|
|
14
|
+
const baser = new RegBaser(options);
|
|
15
|
+
let delivered = false;
|
|
16
|
+
try {
|
|
17
|
+
if (reopen && !(yield* baser.reopen()))
|
|
18
|
+
throw new DatabaseNotOpenError("Registry backing store could not open.");
|
|
19
|
+
delivered = true;
|
|
20
|
+
return baser;
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
if (!delivered)
|
|
24
|
+
yield* baser.close(baser.temp);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** The existing database ordinal seam cannot represent negative or unsafe integers. */
|
|
28
|
+
function registryOrdinal(sn) {
|
|
29
|
+
if (!Number.isSafeInteger(sn) || sn < 0) {
|
|
30
|
+
throw new RangeError("Registry ordinal must be a non-negative safe integer.");
|
|
31
|
+
}
|
|
32
|
+
return sn;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Wrap a supplied RegBaser without opening another environment. Reads and writes
|
|
36
|
+
* are storage operations: callers authenticate events/anchors and decide acceptance.
|
|
37
|
+
* Explicit close delegates to the supplied owner; construction adds no lifetime scope.
|
|
38
|
+
* Local aliases are optional; public observer stores need only evidence tables.
|
|
39
|
+
*/
|
|
40
|
+
export class RegistryStore {
|
|
41
|
+
constructor(baser) {
|
|
42
|
+
Object.defineProperty(this, "baser", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true,
|
|
46
|
+
value: baser
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(this, "aliases", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: null
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(this, "aliasEnv", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: null
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/** Local alias mapper is optional; refresh it after the owner's reopen. */
|
|
62
|
+
get records() {
|
|
63
|
+
if (!this.baser.env)
|
|
64
|
+
throw new DatabaseNotOpenError("Registry backing store is closed.");
|
|
65
|
+
if (this.aliasEnv !== this.baser.env) {
|
|
66
|
+
this.aliases = this.baser.hasTable("regs.")
|
|
67
|
+
? new Komer(this.baser, { subkey: "regs.", recordClass: RegistryRecord })
|
|
68
|
+
: null;
|
|
69
|
+
this.aliasEnv = this.baser.env;
|
|
70
|
+
}
|
|
71
|
+
return this.aliases;
|
|
72
|
+
}
|
|
73
|
+
/** Explicit alias write creates regs. only when needed, for local registry management. */
|
|
74
|
+
putRecord(name, record) {
|
|
75
|
+
return this.initializeRecords().pin(name, record);
|
|
76
|
+
}
|
|
77
|
+
/** Bind aliases before a rollback-capable transaction; opening and reads never call this. */
|
|
78
|
+
initializeRecords() {
|
|
79
|
+
let records = this.records;
|
|
80
|
+
if (!records) {
|
|
81
|
+
if (this.baser.readonly)
|
|
82
|
+
throw new DatabaseOperationError("Cannot create readonly registry aliases.");
|
|
83
|
+
records = this.aliases = new Komer(this.baser, { subkey: "regs.", recordClass: RegistryRecord });
|
|
84
|
+
}
|
|
85
|
+
return records;
|
|
86
|
+
}
|
|
87
|
+
/** Report the supplied backing owner's lifecycle state. */
|
|
88
|
+
get opened() {
|
|
89
|
+
return this.baser.opened;
|
|
90
|
+
}
|
|
91
|
+
/** Join explicit closure of the supplied owner, clearing temporary backing paths. */
|
|
92
|
+
*close() {
|
|
93
|
+
yield* this.baser.close(this.baser.temp);
|
|
94
|
+
}
|
|
95
|
+
/** Return the stored event body; membership alone does not establish acceptance. */
|
|
96
|
+
event(said) {
|
|
97
|
+
return this.baser.evts.get(said);
|
|
98
|
+
}
|
|
99
|
+
/** Store an event body without authenticating it or marking it accepted. */
|
|
100
|
+
putEvent(serder) {
|
|
101
|
+
return this.baser.evts.pin(serder.said, serder);
|
|
102
|
+
}
|
|
103
|
+
/** Read a stored source couple. */
|
|
104
|
+
anchor(said) {
|
|
105
|
+
if (!this.baser.opened)
|
|
106
|
+
throw new DatabaseNotOpenError("Registry backing store is closed.");
|
|
107
|
+
return this.baser.ancs.get(said);
|
|
108
|
+
}
|
|
109
|
+
/** Retain the earliest caller-verified anchor; equal/later reseals cannot reorder siblings. */
|
|
110
|
+
putAnchor(said, number, diger) {
|
|
111
|
+
const current = this.anchor(said);
|
|
112
|
+
if (current && current[0].num <= number.num)
|
|
113
|
+
return false;
|
|
114
|
+
return this.baser.ancs.pin(said, [number, diger]);
|
|
115
|
+
}
|
|
116
|
+
/** Read the accepted-head cache without verifying the event. */
|
|
117
|
+
head(regk) {
|
|
118
|
+
return this.baser.heads.get(regk);
|
|
119
|
+
}
|
|
120
|
+
/** Resolve the cached head's body, or null when absent. */
|
|
121
|
+
headEvent(regk) {
|
|
122
|
+
const head = this.head(regk);
|
|
123
|
+
return head ? this.event(head.qb64) : null;
|
|
124
|
+
}
|
|
125
|
+
/** Read an accepted ordinal marker. Database ordinals use the existing safe-number API. */
|
|
126
|
+
seqSaider(regk, sn) {
|
|
127
|
+
return this.baser.tels.getOn(regk, registryOrdinal(sn));
|
|
128
|
+
}
|
|
129
|
+
/** Resolve an accepted ordinal's body, or null when absent. */
|
|
130
|
+
seqEvent(regk, sn) {
|
|
131
|
+
const said = this.seqSaider(regk, sn);
|
|
132
|
+
return said ? this.event(said.qb64) : null;
|
|
133
|
+
}
|
|
134
|
+
/** Publish caller-approved storage markers; validation and duplicate/head policy belong to the engine. */
|
|
135
|
+
accept(regk, sn, serder) {
|
|
136
|
+
sn = registryOrdinal(sn);
|
|
137
|
+
const said = new Saider({ qb64: serder.said });
|
|
138
|
+
this.putEvent(serder);
|
|
139
|
+
this.baser.tels.putOn(regk, sn, said);
|
|
140
|
+
this.baser.heads.pin(regk, said);
|
|
141
|
+
}
|
|
142
|
+
/** Yield stored accepted bodies from the inclusive ordinal; skip missing bodies like the reference. */
|
|
143
|
+
*cloneTelIter(regk, sn = 0) {
|
|
144
|
+
for (const [, , said] of this.baser.tels.getAllItemIter(regk, registryOrdinal(sn))) {
|
|
145
|
+
const event = this.event(said.qb64);
|
|
146
|
+
if (event)
|
|
147
|
+
yield event.raw;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/** Eagerly collect accepted TEL bytes in ordinal order. */
|
|
151
|
+
cloneTel(regk, sn = 0) {
|
|
152
|
+
const chunks = [...this.cloneTelIter(regk, sn)];
|
|
153
|
+
const stream = new Uint8Array(chunks.reduce((size, raw) => size + raw.length, 0));
|
|
154
|
+
let offset = 0;
|
|
155
|
+
for (const raw of chunks) {
|
|
156
|
+
stream.set(raw, offset);
|
|
157
|
+
offset += raw.length;
|
|
158
|
+
}
|
|
159
|
+
return stream;
|
|
160
|
+
}
|
|
161
|
+
/** Add one missing-anchor candidate in insertion order, deduplicating its SAID. */
|
|
162
|
+
escrowMissingAnchor(regk, sn, said) {
|
|
163
|
+
sn = registryOrdinal(sn);
|
|
164
|
+
return this.baser.maes.add(regk, sn, [said]);
|
|
165
|
+
}
|
|
166
|
+
/** Add one out-of-order candidate in insertion order, deduplicating its SAID. */
|
|
167
|
+
escrowOutOfOrder(regk, sn, said) {
|
|
168
|
+
sn = registryOrdinal(sn);
|
|
169
|
+
return this.baser.ooes.add(regk, sn, [said]);
|
|
170
|
+
}
|
|
171
|
+
/** Remove this candidate from both escrow families. */
|
|
172
|
+
clearEscrows(regk, sn, said) {
|
|
173
|
+
sn = registryOrdinal(sn);
|
|
174
|
+
this.baser.maes.rem(regk, sn, [said]);
|
|
175
|
+
this.baser.ooes.rem(regk, sn, [said]);
|
|
176
|
+
}
|
|
177
|
+
}
|