keri-ts 2.0.1 → 2.2.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 +30 -2
- package/esm/keri/npm/src/acdc/authoring.js +195 -0
- package/esm/keri/npm/src/acdc/chaining.js +223 -89
- package/esm/keri/npm/src/acdc/custody.js +164 -0
- package/esm/keri/npm/src/acdc/dhking.js +244 -32
- package/esm/keri/npm/src/acdc/observing.js +2 -2
- package/esm/keri/npm/src/acdc/regbasing.js +30 -29
- package/esm/keri/npm/src/acdc/regengine.js +4 -6
- package/esm/keri/npm/src/acdc/registering.js +13 -10
- package/esm/keri/npm/src/acdc/registraring.js +4 -9
- package/esm/keri/npm/src/acdc/salting.js +143 -26
- package/esm/keri/npm/src/acdc/scheming.js +93 -54
- package/esm/keri/npm/src/acdc/unblinding.js +120 -99
- 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 +5 -7
- 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 +131 -0
- 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/credentials/verifying.js +12 -3
- package/esm/keri/npm/src/app/delivery/forwarding.js +64 -9
- package/esm/keri/npm/src/app/exchanges/exchanging.js +24 -15
- package/esm/keri/npm/src/app/identity/challenging.js +50 -0
- package/esm/keri/npm/src/app/identity/configing.js +17 -43
- 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 +183 -41
- package/esm/keri/npm/src/app/identity/keeping.js +78 -5
- package/esm/keri/npm/src/app/identity/lmdb-habery.js +12 -0
- package/esm/keri/npm/src/app/ipex/group-ipex.js +327 -0
- package/esm/keri/npm/src/app/ipex/group-issuance.js +902 -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-graph.js +7 -70
- package/esm/keri/npm/src/app/ipex/ipex-grouping.js +42 -16
- package/esm/keri/npm/src/app/ipex/ipex-v2.js +21 -5
- package/esm/keri/npm/src/app/ipex/ipexing.js +1 -1
- package/esm/keri/npm/src/app/ipex/issuance.js +888 -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 +401 -0
- package/esm/keri/npm/src/app/ipex/receive-issuance.js +86 -0
- package/esm/keri/npm/src/app/ipex/unblinding-workflow.js +660 -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 +15 -14
- package/esm/keri/npm/src/app/multisig/counseling.js +482 -0
- package/esm/keri/npm/src/app/multisig/group-members.js +32 -0
- package/esm/keri/npm/src/app/multisig/grouping.js +4 -3
- package/esm/keri/npm/src/app/multisig/multisig-workflows.js +101 -141
- 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/notifying.js +5 -9
- 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 +44 -6
- package/esm/keri/npm/src/app/queries/query-workflows.js +98 -0
- package/esm/keri/npm/src/app/queries/witness-inquisitor.js +2 -2
- package/esm/keri/npm/src/app/runtime/agent-runtime.js +113 -65
- 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/byte-source.js +6 -42
- package/esm/keri/npm/src/app/transport/cesr-egress.js +77 -13
- package/esm/keri/npm/src/app/transport/file-bytes.js +41 -0
- package/esm/keri/npm/src/app/transport/http-client.js +25 -6
- package/esm/keri/npm/src/app/transport/http-messenger.js +14 -9
- package/esm/keri/npm/src/app/transport/message-source.js +1 -1
- package/esm/keri/npm/src/app/transport/messengering.js +3 -4
- package/esm/keri/npm/src/app/transport/node-http-client.js +21 -0
- package/esm/keri/npm/src/app/transport/tcp-dialer.js +14 -0
- package/esm/keri/npm/src/app/witness/http-endpoints.js +4 -4
- package/esm/keri/npm/src/app/witness/receipt-client.js +2 -2
- package/esm/keri/npm/src/cli/common/context.js +2 -2
- package/esm/keri/npm/src/cli/common/event-completion.js +49 -0
- package/esm/keri/npm/src/cli/common/existing.js +3 -5
- package/esm/keri/npm/src/cli/common/runtime-workers.js +23 -0
- package/esm/keri/npm/src/cli/credentials/ipex.js +159 -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-clean.js +4 -3
- package/esm/keri/npm/src/cli/endpoints/oobi.js +12 -15
- package/esm/keri/npm/src/cli/identity/challenge.js +9 -35
- package/esm/keri/npm/src/cli/identity/delegate.js +81 -258
- package/esm/keri/npm/src/cli/identity/incept.js +17 -34
- package/esm/keri/npm/src/cli/identity/init.js +4 -3
- package/esm/keri/npm/src/cli/identity/interact.js +7 -19
- package/esm/keri/npm/src/cli/identity/rotate.js +10 -38
- package/esm/keri/npm/src/cli/index.js +3 -1
- package/esm/keri/npm/src/cli/messaging/exchange.js +2 -2
- package/esm/keri/npm/src/cli/messaging/group-join.js +79 -0
- package/esm/keri/npm/src/cli/messaging/group-wait.js +88 -0
- package/esm/keri/npm/src/cli/messaging/multisig.js +187 -250
- package/esm/keri/npm/src/cli/messaging/root-copy-lines.js +31 -0
- package/esm/keri/npm/src/cli/tools/annotate.js +2 -1
- package/esm/keri/npm/src/cli/tools/benchmark.js +2 -1
- package/esm/keri/npm/src/cli/tools/db-dump.js +1 -4
- package/esm/keri/npm/src/core/bytes.js +9 -0
- package/esm/keri/npm/src/core/kel/delegation-ancestry.js +92 -0
- package/esm/keri/npm/src/core/kel/eventing.js +67 -12
- package/esm/keri/npm/src/core/kel/kever.js +11 -9
- package/esm/keri/npm/src/core/mailbox/kram-policy.js +41 -9
- package/esm/keri/npm/src/core/mailbox/kram-pruning.js +15 -22
- package/esm/keri/npm/src/core/mailbox/kram-staging.js +2 -2
- 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 +15 -2
- package/esm/keri/npm/src/db/basing.js +183 -205
- package/esm/keri/npm/src/db/core/dber.js +1062 -0
- package/esm/keri/npm/src/db/core/index.js +4 -2
- package/esm/keri/npm/src/db/core/indexeddb-persistence.js +221 -0
- package/esm/keri/npm/src/db/core/lmdb-opener.js +30 -0
- package/esm/keri/npm/src/db/core/lmdber.js +199 -1067
- package/esm/keri/npm/src/db/core/memstore.js +532 -0
- package/esm/keri/npm/src/db/core/path-manager.js +109 -223
- package/esm/keri/npm/src/db/core/store-owner.js +104 -0
- package/esm/keri/npm/src/db/core/webdber.js +252 -0
- package/esm/keri/npm/src/db/escrowing.js +2 -2
- package/esm/keri/npm/src/db/exchange/exchange-nests.js +3 -2
- package/esm/keri/npm/src/db/indexeddb.js +98 -0
- package/esm/keri/npm/src/db/keeping.js +38 -123
- package/esm/keri/npm/src/db/koming.js +1 -1
- package/esm/keri/npm/src/db/lmdb-stores.js +68 -0
- package/esm/keri/npm/src/db/lmdb.js +6 -0
- package/esm/keri/npm/src/db/mailbox/mailboxing.js +12 -65
- package/esm/keri/npm/src/db/noting.js +11 -55
- package/esm/keri/npm/src/db/reger.js +43 -105
- package/esm/keri/npm/src/db/replay/witness-replay.js +2 -20
- package/esm/keri/npm/src/db/store-lock.js +150 -0
- package/esm/keri/npm/src/db/subing.js +1 -1
- 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-lmdb.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-node.js +3 -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 +58 -12
- package/esm/keri/npm/src/runtime/node.js +14 -0
- 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/eventing.js +1 -1
- package/esm/keri/npm/src/vdr/tel-publication.js +19 -3
- package/esm/keri/npm/src/version.js +2 -2
- package/package.json +24 -4
- package/types/acdc/authoring.d.ts +54 -0
- package/types/acdc/authoring.d.ts.map +1 -0
- package/types/acdc/chaining.d.ts +56 -6
- package/types/acdc/chaining.d.ts.map +1 -1
- package/types/acdc/custody.d.ts +77 -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 +11 -6
- package/types/acdc/regbasing.d.ts.map +1 -1
- package/types/acdc/regengine.d.ts.map +1 -1
- package/types/acdc/registering.d.ts +8 -4
- package/types/acdc/registering.d.ts.map +1 -1
- package/types/acdc/registraring.d.ts.map +1 -1
- package/types/acdc/salting.d.ts +59 -7
- 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 +97 -0
- package/types/app/credentials/root-replicating.d.ts.map +1 -0
- 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/credentials/verifying.d.ts +2 -1
- package/types/app/credentials/verifying.d.ts.map +1 -1
- package/types/app/delivery/forwarding.d.ts +16 -0
- package/types/app/delivery/forwarding.d.ts.map +1 -1
- package/types/app/exchanges/exchanging.d.ts +2 -0
- 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/configing.d.ts +7 -5
- package/types/app/identity/configing.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 +90 -7
- package/types/app/identity/habbing.d.ts.map +1 -1
- package/types/app/identity/keeping.d.ts +50 -4
- package/types/app/identity/keeping.d.ts.map +1 -1
- package/types/app/identity/lmdb-habery.d.ts +6 -0
- package/types/app/identity/lmdb-habery.d.ts.map +1 -0
- package/types/app/ipex/group-ipex.d.ts +247 -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-graph.d.ts +4 -4
- package/types/app/ipex/ipex-graph.d.ts.map +1 -1
- 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-v2.d.ts +11 -2
- package/types/app/ipex/ipex-v2.d.ts.map +1 -1
- package/types/app/ipex/ipexing.d.ts +3 -0
- package/types/app/ipex/ipexing.d.ts.map +1 -1
- package/types/app/ipex/issuance.d.ts +443 -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 +298 -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 +255 -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 +4 -1
- 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 +20 -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-workflows.d.ts +93 -23
- 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/notifying.d.ts +1 -1
- package/types/app/notifications/notifying.d.ts.map +1 -1
- 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 +16 -1
- package/types/app/protocol/parsering.d.ts.map +1 -1
- package/types/app/protocol/protocol-processing.d.ts +9 -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 +79 -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/byte-source.d.ts +13 -10
- package/types/app/transport/byte-source.d.ts.map +1 -1
- package/types/app/transport/cesr-egress.d.ts +21 -7
- package/types/app/transport/cesr-egress.d.ts.map +1 -1
- package/types/app/transport/file-bytes.d.ts +11 -0
- package/types/app/transport/file-bytes.d.ts.map +1 -0
- package/types/app/transport/http-client.d.ts +3 -0
- package/types/app/transport/http-client.d.ts.map +1 -1
- package/types/app/transport/http-messenger.d.ts +15 -10
- package/types/app/transport/http-messenger.d.ts.map +1 -1
- package/types/app/transport/message-source.d.ts +1 -1
- package/types/app/transport/messengering.d.ts +2 -2
- package/types/app/transport/messengering.d.ts.map +1 -1
- package/types/app/transport/node-http-client.d.ts +10 -0
- package/types/app/transport/node-http-client.d.ts.map +1 -0
- package/types/app/transport/tcp-dialer.d.ts +21 -0
- package/types/app/transport/tcp-dialer.d.ts.map +1 -0
- 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/existing.d.ts.map +1 -1
- 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-clean.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/init.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 +4 -2
- package/types/cli/index.d.ts.map +1 -1
- package/types/cli/messaging/group-join.d.ts +53 -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 +36 -4
- 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/cli/tools/annotate.d.ts.map +1 -1
- package/types/cli/tools/benchmark.d.ts.map +1 -1
- package/types/cli/tools/db-dump.d.ts.map +1 -1
- package/types/core/bytes.d.ts +2 -0
- package/types/core/bytes.d.ts.map +1 -1
- package/types/core/cues.d.ts +11 -0
- package/types/core/cues.d.ts.map +1 -1
- package/types/core/kel/delegation-ancestry.d.ts +41 -0
- package/types/core/kel/delegation-ancestry.d.ts.map +1 -0
- package/types/core/kel/eventing.d.ts.map +1 -1
- package/types/core/kel/kever.d.ts +5 -4
- package/types/core/kel/kever.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/kram-pruning.d.ts +1 -3
- package/types/core/mailbox/kram-pruning.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 +22 -25
- package/types/db/basing.d.ts.map +1 -1
- package/types/db/core/dber.d.ts +505 -0
- package/types/db/core/dber.d.ts.map +1 -0
- package/types/db/core/index.d.ts +4 -2
- package/types/db/core/index.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/core/lmdb-opener.d.ts +17 -0
- package/types/db/core/lmdb-opener.d.ts.map +1 -0
- package/types/db/core/lmdber.d.ts +60 -383
- package/types/db/core/lmdber.d.ts.map +1 -1
- package/types/db/core/memstore.d.ts +129 -0
- package/types/db/core/memstore.d.ts.map +1 -0
- package/types/db/core/path-manager.d.ts +22 -45
- package/types/db/core/path-manager.d.ts.map +1 -1
- package/types/db/core/store-owner.d.ts +59 -0
- package/types/db/core/store-owner.d.ts.map +1 -0
- package/types/db/core/webdber.d.ts +127 -0
- package/types/db/core/webdber.d.ts.map +1 -0
- package/types/db/escrowing.d.ts +3 -3
- package/types/db/escrowing.d.ts.map +1 -1
- package/types/db/exchange/exchange-nests.d.ts.map +1 -1
- package/types/db/indexeddb.d.ts +37 -0
- package/types/db/indexeddb.d.ts.map +1 -0
- package/types/db/keeping.d.ts +14 -25
- package/types/db/keeping.d.ts.map +1 -1
- package/types/db/koming.d.ts +7 -8
- package/types/db/koming.d.ts.map +1 -1
- package/types/db/lmdb-stores.d.ts +45 -0
- package/types/db/lmdb-stores.d.ts.map +1 -0
- package/types/db/lmdb.d.ts +7 -0
- package/types/db/lmdb.d.ts.map +1 -0
- package/types/db/mailbox/mailboxing.d.ts +7 -21
- package/types/db/mailbox/mailboxing.d.ts.map +1 -1
- package/types/db/noting.d.ts +7 -12
- package/types/db/noting.d.ts.map +1 -1
- package/types/db/reger.d.ts +7 -11
- package/types/db/reger.d.ts.map +1 -1
- package/types/db/replay/witness-replay.d.ts +0 -2
- package/types/db/replay/witness-replay.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/db/subing.d.ts +24 -25
- package/types/db/subing.d.ts.map +1 -1
- package/types/npm/db-indexeddb.d.ts +4 -0
- package/types/npm/db-indexeddb.d.ts.map +1 -0
- package/types/npm/db-lmdb.d.ts +4 -0
- package/types/npm/db-lmdb.d.ts.map +1 -0
- package/types/npm/runtime-node.d.ts +4 -0
- package/types/npm/runtime-node.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 +48 -14
- package/types/runtime/index.d.ts.map +1 -1
- package/types/runtime/node.d.ts +15 -0
- package/types/runtime/node.d.ts.map +1 -0
- 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/acdc/relating.js +0 -59
- package/esm/keri/npm/src/cli/common/tel-completion.js +0 -24
- package/esm/keri/npm/src/db/baser-defaults.js +0 -11
- package/types/acdc/relating.d.ts +0 -21
- package/types/acdc/relating.d.ts.map +0 -1
- package/types/cli/common/tel-completion.d.ts +0 -8
- package/types/cli/common/tel-completion.d.ts.map +0 -1
- package/types/db/baser-defaults.d.ts +0 -5
- package/types/db/baser-defaults.d.ts.map +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { dgKey } from "../../db/core/keys.js";
|
|
2
|
+
import { ValidationError } from "../errors.js";
|
|
3
|
+
/** Whether one accepted delegator event carries the exact `{i,s,d}` seal of a delegated inception. */
|
|
4
|
+
function approves(event, dip) {
|
|
5
|
+
return event.eventSeals.some((seal) => seal.i.qb64 === dip.pre && seal.s.numh === dip.snh && seal.d.qb64 === dip.said);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Find the delegator's accepted approval of `dip`.
|
|
9
|
+
*
|
|
10
|
+
* The aess source couple is a fast path only when it names a first-seen event
|
|
11
|
+
* that actually carries the dip seal; protected intake can retain an unverified
|
|
12
|
+
* hint, which neither grants authority nor vetoes a later genuine approval.
|
|
13
|
+
* Otherwise any first-seen delegator event carrying the seal is accepted,
|
|
14
|
+
* including one superseded since, so cached and uncached validators agree.
|
|
15
|
+
*/
|
|
16
|
+
function acceptedApproval(db, delegator, dip) {
|
|
17
|
+
const source = db.aess.get(dgKey(dip.pre, dip.said));
|
|
18
|
+
if (source) {
|
|
19
|
+
const digest = source[1].qb64;
|
|
20
|
+
if (db.fons.get(dgKey(delegator, digest))) {
|
|
21
|
+
const approval = db.getEvtSerder(delegator, digest);
|
|
22
|
+
if (!approval)
|
|
23
|
+
throw new ValidationError(`Missing first-seen delegation event ${delegator}:${digest}.`);
|
|
24
|
+
if (approves(approval, dip))
|
|
25
|
+
return approval;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (const [, , said] of db.fels.getAllItemIter(delegator)) {
|
|
29
|
+
if (!db.fons.get(dgKey(delegator, said)))
|
|
30
|
+
continue;
|
|
31
|
+
const event = db.getEvtSerder(delegator, said);
|
|
32
|
+
if (event && approves(event, dip))
|
|
33
|
+
return event;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolve whether `pre` is an anchored delegated descendant of `ancestor`, at any depth.
|
|
39
|
+
*
|
|
40
|
+
* Every hop requires the delegate's fixed dip, the delegator's inception
|
|
41
|
+
* permission (DND is checked before the anchor) and an accepted delegator
|
|
42
|
+
* approval of that dip. Identity (`pre === ancestor`) is not delegation; the
|
|
43
|
+
* DI2I/DI1I callers own that widening.
|
|
44
|
+
*
|
|
45
|
+
* Security rationale, preserved from KERIpy's `relating.delegationRefusal`:
|
|
46
|
+
* - The delegate's own `di` (Kever.delpre) is a self-assertion. Local, member
|
|
47
|
+
* or witness acceptance can admit a dip whose delegator never anchored it, so
|
|
48
|
+
* only the delegator's anchored approval seal records actual authority.
|
|
49
|
+
* - DND is re-read from the delegator's accepted inception, not mutable state,
|
|
50
|
+
* because that same exemption can admit dips a disinterested validator would
|
|
51
|
+
* refuse; identical bytes must not get opposite verdicts by host topology.
|
|
52
|
+
* - Only the dip anchor matters. A delegation is settled at inception; later
|
|
53
|
+
* delegate rotations, delegator rotations, witness changes and retirement do
|
|
54
|
+
* not renew or revoke it.
|
|
55
|
+
* - No depth bound: a delegated prefix digests its own dip, so a cycle implies
|
|
56
|
+
* a hash cycle. The visited set only terminates corrupt local state.
|
|
57
|
+
*
|
|
58
|
+
* Unlike KERIpy, lookup never repairs aess; accepted KEL intake owns those writes.
|
|
59
|
+
* An aess couple naming a first-seen event that is absent from `evts` is
|
|
60
|
+
* corrupt durable state and throws.
|
|
61
|
+
*/
|
|
62
|
+
export function delegationAncestry(db, pre, ancestor) {
|
|
63
|
+
const seen = new Set();
|
|
64
|
+
while (!seen.has(pre)) {
|
|
65
|
+
seen.add(pre);
|
|
66
|
+
const kever = db.getKever(pre);
|
|
67
|
+
if (!kever)
|
|
68
|
+
return { kind: "pending", reason: `Missing delegate KEL ${pre}.` };
|
|
69
|
+
const parent = kever.delpre;
|
|
70
|
+
if (!parent)
|
|
71
|
+
return { kind: "refused", reason: `Delegation chain ends at ${pre}.` };
|
|
72
|
+
if (!db.getKever(parent))
|
|
73
|
+
return { kind: "pending", reason: `Missing delegator KEL ${parent}.` };
|
|
74
|
+
// Configuration is fixed at inception, including after delegator rotations.
|
|
75
|
+
const inceptionSaid = db.kels.getLast(parent, 0);
|
|
76
|
+
const inception = inceptionSaid ? db.getEvtSerder(parent, inceptionSaid) : null;
|
|
77
|
+
if (!inception)
|
|
78
|
+
return { kind: "pending", reason: `Missing delegator inception ${parent}.` };
|
|
79
|
+
if (inception.traits.includes("DND"))
|
|
80
|
+
return { kind: "refused", reason: `Delegator ${parent} carries DND.` };
|
|
81
|
+
const dip = db.getEvtSerder(pre, pre);
|
|
82
|
+
if (!dip)
|
|
83
|
+
return { kind: "pending", reason: `Missing delegated inception ${pre}.` };
|
|
84
|
+
if (!acceptedApproval(db, parent, dip)) {
|
|
85
|
+
return { kind: "pending", reason: `Missing accepted delegation approval for ${pre} from ${parent}.` };
|
|
86
|
+
}
|
|
87
|
+
if (parent === ancestor)
|
|
88
|
+
return { kind: "valid" };
|
|
89
|
+
pre = parent;
|
|
90
|
+
}
|
|
91
|
+
return { kind: "refused", reason: `Delegation chain cycles at ${pre}.` };
|
|
92
|
+
}
|
|
@@ -126,7 +126,6 @@ export class Kevery {
|
|
|
126
126
|
return this.settleEventDecision(envelope);
|
|
127
127
|
}
|
|
128
128
|
settleEventDecision(input, escrow) {
|
|
129
|
-
const env = this.db.env;
|
|
130
129
|
if (this.db.inWriteTransaction) {
|
|
131
130
|
throw new Error("Kevery must own the KEL transaction; process events outside caller-owned writers");
|
|
132
131
|
}
|
|
@@ -151,7 +150,7 @@ export class Kevery {
|
|
|
151
150
|
this.removeEscrow(escrow.kind, escrow.pre, escrow.on, escrow.said);
|
|
152
151
|
return decision;
|
|
153
152
|
};
|
|
154
|
-
const decision =
|
|
153
|
+
const decision = this.db.transaction(write);
|
|
155
154
|
this.publishEventState(metadata?.accepted);
|
|
156
155
|
if (metadata?.cues.length)
|
|
157
156
|
this.cues.extend(metadata.cues);
|
|
@@ -176,10 +175,10 @@ export class Kevery {
|
|
|
176
175
|
return false;
|
|
177
176
|
const query = envelope.serder.ked?.q;
|
|
178
177
|
const pre = typeof query?.i === "string" ? query.i : null;
|
|
179
|
-
if (!pre
|
|
178
|
+
if (!pre)
|
|
180
179
|
return false;
|
|
181
180
|
const recipient = this.db.getKever(pre, { refresh: true });
|
|
182
|
-
return !!recipient && authenticatesMailboxQuery(envelope, recipient);
|
|
181
|
+
return !!recipient && authenticatesMailboxQuery(envelope, recipient, this.db);
|
|
183
182
|
}
|
|
184
183
|
/**
|
|
185
184
|
* Decide how one live query should be handled without mutating escrow state.
|
|
@@ -281,14 +280,11 @@ export class Kevery {
|
|
|
281
280
|
}]);
|
|
282
281
|
}
|
|
283
282
|
case "mbx": {
|
|
284
|
-
if (dest !== pre) {
|
|
285
|
-
return dropQuery("unauthorizedMailboxRequester");
|
|
286
|
-
}
|
|
287
283
|
const recipient = this.db.getKever(pre, { refresh: true });
|
|
288
284
|
if (!recipient) {
|
|
289
285
|
return escrowQuery("missingKever");
|
|
290
286
|
}
|
|
291
|
-
if (!authenticatesMailboxQuery(envelope, recipient)) {
|
|
287
|
+
if (!authenticatesMailboxQuery(envelope, recipient, this.db)) {
|
|
292
288
|
return dropQuery("unauthorizedMailboxRequester");
|
|
293
289
|
}
|
|
294
290
|
return acceptQuery([{
|
|
@@ -2376,22 +2372,81 @@ function queryRequester(envelope) {
|
|
|
2376
2372
|
* Mailbox reads authorize private recipient bytes, unlike public KEL queries.
|
|
2377
2373
|
* Require the recipient's current signing threshold; merely naming its prefix
|
|
2378
2374
|
* in endorsement material is not authentication. Repeated indices count once.
|
|
2375
|
+
*
|
|
2376
|
+
* Who may read a transferable recipient's mailbox on this host: the recipient itself, and, for a group, any
|
|
2377
|
+
* signing member that signs the poll as itself (the shape KERIpy's `GroupHab.query` emits: `q.i` is the group,
|
|
2378
|
+
* sender and signer are the member) when {@link provesGroupKeyControl} holds. Forwarded mail is plaintext CESR
|
|
2379
|
+
* unless the sender used ESSR, so this check is the read protection. KERIpy hosts are open: they do no read
|
|
2380
|
+
* authorization of `mbx` queries, so a poll KERIpy accepts can be refused here.
|
|
2381
|
+
*
|
|
2382
|
+
* Two refusals are by design. The host must hold the member's KEL: the keri-ts poller and `KelPublisher` submit it
|
|
2383
|
+
* (see `collectKelSubmission`), but a KERIpy member's poller does not, so its KEL has to reach the host by OOBI or
|
|
2384
|
+
* a mailbox add, and until then its poll is refused as unauthorized. And a rotation-only member (named in the
|
|
2385
|
+
* group's `rmids` but not its `smids`) holds no current group key, so it is refused until a rotation makes it a
|
|
2386
|
+
* signing member.
|
|
2379
2387
|
*/
|
|
2380
|
-
function authenticatesMailboxQuery(envelope, recipient) {
|
|
2388
|
+
function authenticatesMailboxQuery(envelope, recipient, db) {
|
|
2381
2389
|
if (!recipient.transferable) {
|
|
2382
2390
|
return (envelope.cigars ?? []).some((cigar) => cigar.verfer?.qb64 === recipient.pre
|
|
2383
2391
|
&& !cigar.verfer.transferable
|
|
2384
2392
|
&& cigar.verfer.verify(cigar.raw, envelope.serder.raw));
|
|
2385
2393
|
}
|
|
2386
|
-
|
|
2394
|
+
const requester = envelope.source?.qb64;
|
|
2395
|
+
if (!requester)
|
|
2396
|
+
return false;
|
|
2397
|
+
if (requester === recipient.pre)
|
|
2398
|
+
return satisfiesThreshold(envelope, recipient);
|
|
2399
|
+
// A group's poll is signed by one of its local members (the poller cannot sign for the group alone). Accept a
|
|
2400
|
+
// member whose own key state this host holds when its signatures meet its own current threshold and it provably
|
|
2401
|
+
// controlled one of the group's current keys.
|
|
2402
|
+
const member = db.getKever(requester, { refresh: true });
|
|
2403
|
+
if (!member?.transferable || !satisfiesThreshold(envelope, member))
|
|
2387
2404
|
return false;
|
|
2405
|
+
return provesGroupKeyControl(envelope, member, recipient, db);
|
|
2406
|
+
}
|
|
2407
|
+
/**
|
|
2408
|
+
* Whether `member` provably controlled a key in `group`'s current key list, by either of two proofs.
|
|
2409
|
+
*
|
|
2410
|
+
* Listing a group key is not control of it: anyone can incept an identifier whose key list names a victim's
|
|
2411
|
+
* public key beside their own, so a key list or an event's `k` field proves nothing. Only a signature by that
|
|
2412
|
+
* key does. The proofs are:
|
|
2413
|
+
* - the poll itself carries a signature that verifies against a key at that index in `member`'s current key list
|
|
2414
|
+
* that is also in the group's current key list; or
|
|
2415
|
+
* - some establishment event in `member`'s KEL, as this host holds it, lists a group-current key at index i and
|
|
2416
|
+
* the host holds a signature by that index-i key on that same event that verifies. That is proof of possession
|
|
2417
|
+
* at the time the member used the key, and the KEL chain ties that event to the member's current keys, so a
|
|
2418
|
+
* member that rotated its own identifier ahead of the group is still recognised.
|
|
2419
|
+
*/
|
|
2420
|
+
function provesGroupKeyControl(envelope, member, group, db) {
|
|
2421
|
+
const groupKeys = new Set(group.verfers.map((verfer) => verfer.qb64));
|
|
2422
|
+
const signedPoll = (envelope.sigers ?? []).some((siger) => {
|
|
2423
|
+
const verfer = member.verfers[siger.index];
|
|
2424
|
+
return !!verfer && groupKeys.has(verfer.qb64) && verfer.verify(siger.raw, envelope.serder.raw);
|
|
2425
|
+
});
|
|
2426
|
+
if (signedPoll)
|
|
2427
|
+
return true;
|
|
2428
|
+
for (const [, said] of db.getKelItemIter(member.pre)) {
|
|
2429
|
+
const event = db.getEvtSerder(member.pre, said);
|
|
2430
|
+
if (!event?.estive)
|
|
2431
|
+
continue;
|
|
2432
|
+
const verfers = event.verfers;
|
|
2433
|
+
for (const siger of db.sigs.get(dgKey(member.pre, said))) {
|
|
2434
|
+
const verfer = verfers[siger.index];
|
|
2435
|
+
if (verfer && groupKeys.has(verfer.qb64) && verfer.verify(siger.raw, event.raw))
|
|
2436
|
+
return true;
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
return false;
|
|
2440
|
+
}
|
|
2441
|
+
/** The indexed signatures on `envelope` that verify against `kever`'s current keys meet its signing threshold. */
|
|
2442
|
+
function satisfiesThreshold(envelope, kever) {
|
|
2388
2443
|
const indices = new Set();
|
|
2389
2444
|
for (const siger of envelope.sigers ?? []) {
|
|
2390
|
-
const verfer =
|
|
2445
|
+
const verfer = kever.verfers[siger.index];
|
|
2391
2446
|
if (verfer && verfer.verify(siger.raw, envelope.serder.raw))
|
|
2392
2447
|
indices.add(siger.index);
|
|
2393
2448
|
}
|
|
2394
|
-
return
|
|
2449
|
+
return kever.tholder?.satisfy([...indices]) ?? false;
|
|
2395
2450
|
}
|
|
2396
2451
|
/** Return the reply destination derived from one normalized query envelope. */
|
|
2397
2452
|
function queryReplyDest(envelope) {
|
|
@@ -551,21 +551,23 @@ export class Kever {
|
|
|
551
551
|
return indices;
|
|
552
552
|
}
|
|
553
553
|
/**
|
|
554
|
-
* Return indices
|
|
554
|
+
* Return indices of keys contributed by this group's local members.
|
|
555
555
|
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
556
|
+
* KERIpy strips its one local member (`habord.mid`). A keri-ts Habery may hold
|
|
557
|
+
* several members of one group, so every locally controlled signing member
|
|
558
|
+
* counts. The group's own prefix is local too and must not: its keys are all
|
|
559
|
+
* of `verfers`.
|
|
559
560
|
*/
|
|
560
561
|
locallyContributedIndices(verfers) {
|
|
562
|
+
const record = this.db.getHab(this.pre);
|
|
561
563
|
const localKeys = new Set();
|
|
562
|
-
for (const
|
|
563
|
-
|
|
564
|
-
if (!kever) {
|
|
564
|
+
for (const mid of new Set([record?.mid, ...(record?.smids ?? [])])) {
|
|
565
|
+
if (!mid || !this.locallyOwned(mid)) {
|
|
565
566
|
continue;
|
|
566
567
|
}
|
|
567
|
-
|
|
568
|
-
|
|
568
|
+
const key = this.db.getKever(mid)?.verfers[0]?.qb64;
|
|
569
|
+
if (key) {
|
|
570
|
+
localKeys.add(key);
|
|
569
571
|
}
|
|
570
572
|
}
|
|
571
573
|
const indices = [];
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
/** KRAM cache selection and safe, receiver-clocked configuration transitions. */
|
|
2
2
|
import { intToB64 } from "cesr-ts";
|
|
3
3
|
import { CacheTypeRecord } from "../records.js";
|
|
4
|
+
/**
|
|
5
|
+
* Windows an enabled policy uses when no caches are configured: one catchall row, in milliseconds
|
|
6
|
+
* `[d, sl, ll, xl, psl, pll, pxl]` (1 s drift, 5 s single-key, 60 s multi-key and 5 min exchange acceptance,
|
|
7
|
+
* pruned no earlier than they expire). KERIpy defines no built-in windows and requires `kram.caches` in
|
|
8
|
+
* configuration; these are the values its own tests and the keri-ts interop suites use, so an unconfigured
|
|
9
|
+
* runtime behaves like a configured KERIpy peer.
|
|
10
|
+
*/
|
|
11
|
+
export const DEFAULT_KRAM_CACHES = Object.freeze({
|
|
12
|
+
"~": Object.freeze([1000, 5000, 60000, 300000, 5000, 60000, 300000]),
|
|
13
|
+
});
|
|
4
14
|
/** Only this key owns the policy transition metadata in the existing settings table. */
|
|
5
15
|
const policyKey = "kram-policy";
|
|
16
|
+
/** The stored cache type for exact route, then message type, then the catchall; null when none is configured. */
|
|
17
|
+
function storedCacheType(db, ilk, route) {
|
|
18
|
+
const record = (route ? db.ctyp.get(`${ilk}.R.${route}`) : null) ?? db.ctyp.get(ilk) ?? db.ctyp.get("~");
|
|
19
|
+
if (!record)
|
|
20
|
+
return null;
|
|
21
|
+
const [d, sl, ll, xl, psl, pll, pxl] = values(record);
|
|
22
|
+
return { d, sl, ll, xl, psl, pll, pxl };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* How long a single-key query on `route` stays timely under the windows this store was configured with, in
|
|
26
|
+
* milliseconds: the single-key lag. A sender uses its own windows as the estimate of its peer's, as KERIpy's
|
|
27
|
+
* `requery` does. Null when this store has no KRAM cache types (KRAM never ran on it).
|
|
28
|
+
*/
|
|
29
|
+
export function singleKeyQueryWindow(db, route) {
|
|
30
|
+
return storedCacheType(db, "qry", route)?.sl ?? null;
|
|
31
|
+
}
|
|
6
32
|
/** Validate caller configuration before any durable policy mutation. */
|
|
7
33
|
function windows(value, transitional = false) {
|
|
8
34
|
if (!Array.isArray(value) || value.length !== 7 || value.some((v) => !Number.isSafeInteger(v) || v < 0)) {
|
|
@@ -148,11 +174,20 @@ export class KramPolicy {
|
|
|
148
174
|
return [intToB64(version[0], 1) + intToB64(version[1], 2), ...(type ? [type] : []), ...(route ? [route] : [])]
|
|
149
175
|
.join(".") + (route ? "" : ".");
|
|
150
176
|
});
|
|
151
|
-
const requested = configuration(config.caches);
|
|
177
|
+
const requested = configuration(config.caches ?? (this.enabled ? DEFAULT_KRAM_CACHES : undefined));
|
|
152
178
|
const stored = db.hbys.get(policyKey);
|
|
153
179
|
this.storedState = stored;
|
|
154
180
|
if (stored !== null) {
|
|
155
181
|
this.state = policyState(stored, db);
|
|
182
|
+
if (!Object.keys(this.state.caches).length && Object.keys(requested).length) {
|
|
183
|
+
// A store first opened without caches (KRAM off) has no rows to protect: install the windows directly.
|
|
184
|
+
this.state = { caches: requested, pending: {} };
|
|
185
|
+
this.commit(() => {
|
|
186
|
+
for (const [key, tuple] of Object.entries(requested))
|
|
187
|
+
db.ctyp.pin(key, cacheRecord(tuple));
|
|
188
|
+
});
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
156
191
|
const identical = sameKeys(Object.keys(requested), Object.keys(this.state.caches))
|
|
157
192
|
&& Object.keys(requested).every((key) => requested[key].every((v, i) => v === this.state.caches[key][i]));
|
|
158
193
|
if (config.caches !== undefined && !identical)
|
|
@@ -173,12 +208,10 @@ export class KramPolicy {
|
|
|
173
208
|
}
|
|
174
209
|
/** Select exact route, message type, then catchall; absence is a configuration failure. */
|
|
175
210
|
cacheType(ilk, route) {
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
if (!record)
|
|
211
|
+
const type = storedCacheType(this.db, ilk, route);
|
|
212
|
+
if (!type)
|
|
179
213
|
throw new Error("No KRAM cache type for message");
|
|
180
|
-
|
|
181
|
-
return { d, sl, ll, xl, psl, pll, pxl };
|
|
214
|
+
return type;
|
|
182
215
|
}
|
|
183
216
|
/** Stage expansions and reject coverage holes before changing interoperable rows. */
|
|
184
217
|
change(caches, override) {
|
|
@@ -298,11 +331,10 @@ export class KramPolicy {
|
|
|
298
331
|
}
|
|
299
332
|
/** Publish policy rows and their restart-safe transition metadata atomically. */
|
|
300
333
|
commit(mutate) {
|
|
301
|
-
|
|
302
|
-
if (!env)
|
|
334
|
+
if (!this.db.opened)
|
|
303
335
|
throw new Error("KRAM policy database is closed");
|
|
304
336
|
const next = JSON.stringify(this.state);
|
|
305
|
-
|
|
337
|
+
this.db.transaction(() => {
|
|
306
338
|
if (this.db.hbys.get(policyKey) !== this.storedState)
|
|
307
339
|
throw new Error("KRAM policy changed during transition");
|
|
308
340
|
mutate();
|
|
@@ -19,7 +19,7 @@ export class KramPruner {
|
|
|
19
19
|
writable: true,
|
|
20
20
|
value: policy
|
|
21
21
|
});
|
|
22
|
-
Object.defineProperty(this, "
|
|
22
|
+
Object.defineProperty(this, "bound", {
|
|
23
23
|
enumerable: true,
|
|
24
24
|
configurable: true,
|
|
25
25
|
writable: true,
|
|
@@ -46,24 +46,18 @@ export class KramPruner {
|
|
|
46
46
|
if (policy.db !== db)
|
|
47
47
|
throw new Error("KRAM pruning policy must use its backing store");
|
|
48
48
|
}
|
|
49
|
-
/** Use committed environment state, never assume transaction IDs increment by one. */
|
|
50
|
-
version() {
|
|
51
|
-
const version = this.db.env.getStats().lastTxnId;
|
|
52
|
-
if (!Number.isSafeInteger(version) || version < 0)
|
|
53
|
-
throw new Error("Invalid KRAM pruning transaction ID");
|
|
54
|
-
return version;
|
|
55
|
-
}
|
|
56
49
|
/** Capture a finite horizon and release each tail/next iterator before returning. */
|
|
57
50
|
next(family, scan) {
|
|
58
51
|
const table = [this.db.msgc, this.db.tmsc, this.db.xdt][family];
|
|
59
52
|
if (!scan.initialized) {
|
|
60
|
-
for (const key of table.sdb
|
|
53
|
+
for (const key of this.db.scanKeys(table.sdb, { reverse: true, limit: 1 }))
|
|
61
54
|
scan.end = this.after(key);
|
|
62
55
|
scan.initialized = true;
|
|
63
56
|
}
|
|
64
57
|
if (scan.end) {
|
|
65
|
-
for (const key of table.sdb
|
|
58
|
+
for (const key of this.db.scanKeys(table.sdb, { start: scan.start, end: scan.end, limit: 1 })) {
|
|
66
59
|
return key.slice();
|
|
60
|
+
}
|
|
67
61
|
}
|
|
68
62
|
}
|
|
69
63
|
/** Qualified cache components contain no NUL, so this seeks strictly after a complete key. */
|
|
@@ -102,17 +96,16 @@ export class KramPruner {
|
|
|
102
96
|
if (!Number.isSafeInteger(maxRows) || maxRows < 1)
|
|
103
97
|
throw new RangeError("Invalid KRAM pruning batch");
|
|
104
98
|
const result = { kind: "pruned", visited: 0, removed: 0, openers: 0, passComplete: false };
|
|
105
|
-
|
|
106
|
-
if (!env)
|
|
99
|
+
if (!this.db.opened)
|
|
107
100
|
throw new Error("KRAM pruning database is closed");
|
|
108
|
-
if (this.
|
|
109
|
-
this.
|
|
101
|
+
if (this.bound !== this.db.msgc.sdb) {
|
|
102
|
+
this.bound = this.db.msgc.sdb;
|
|
110
103
|
this.phase = 0;
|
|
111
104
|
this.scans = [{}, {}, {}];
|
|
112
105
|
this.orphan = undefined;
|
|
113
106
|
}
|
|
114
107
|
this.policy.reconcile();
|
|
115
|
-
|
|
108
|
+
this.db.refreshRead();
|
|
116
109
|
while (result.visited < maxRows) {
|
|
117
110
|
if (this.phase < 2) {
|
|
118
111
|
const scan = this.scans[this.phase], physical = this.next(this.phase, scan);
|
|
@@ -121,7 +114,7 @@ export class KramPruner {
|
|
|
121
114
|
continue;
|
|
122
115
|
}
|
|
123
116
|
const keys = this.keys(physical, this.phase + 2), table = this.phase ? this.db.tmsc : this.db.msgc;
|
|
124
|
-
|
|
117
|
+
this.db.transaction(() => {
|
|
125
118
|
const record = table.get(keys);
|
|
126
119
|
if (!record || !this.expired(record, when))
|
|
127
120
|
return;
|
|
@@ -144,17 +137,17 @@ export class KramPruner {
|
|
|
144
137
|
}
|
|
145
138
|
const [xid] = this.keys(physical, 1);
|
|
146
139
|
this.db.xdt.get(xid); // Deserialization failures remain corruption, not an absent opener.
|
|
147
|
-
this.orphan = { xid, physical, scan: {}, version: this.
|
|
140
|
+
this.orphan = { xid, physical, scan: {}, version: this.db.writeVersion };
|
|
148
141
|
result.visited++;
|
|
149
142
|
continue;
|
|
150
143
|
}
|
|
151
|
-
const candidate = this.orphan, version = this.
|
|
144
|
+
const candidate = this.orphan, version = this.db.writeVersion;
|
|
152
145
|
if (candidate.version !== version) {
|
|
153
146
|
candidate.scan = {};
|
|
154
147
|
candidate.version = version;
|
|
155
148
|
}
|
|
156
149
|
// Capture committed version before opening a fresh read snapshot, including other-process writes.
|
|
157
|
-
|
|
150
|
+
this.db.refreshRead();
|
|
158
151
|
const physical = this.next(1, candidate.scan);
|
|
159
152
|
if (physical) {
|
|
160
153
|
const keys = this.keys(physical, 3);
|
|
@@ -165,8 +158,8 @@ export class KramPruner {
|
|
|
165
158
|
}
|
|
166
159
|
else {
|
|
167
160
|
result.visited++;
|
|
168
|
-
const removed =
|
|
169
|
-
if (candidate.version !== this.
|
|
161
|
+
const removed = this.db.transaction(() => {
|
|
162
|
+
if (candidate.version !== this.db.writeVersion)
|
|
170
163
|
return false;
|
|
171
164
|
if (this.db.xdt.rem(candidate.xid))
|
|
172
165
|
result.openers++;
|
|
@@ -174,7 +167,7 @@ export class KramPruner {
|
|
|
174
167
|
});
|
|
175
168
|
if (!removed) {
|
|
176
169
|
candidate.scan = {};
|
|
177
|
-
candidate.version = this.
|
|
170
|
+
candidate.version = this.db.writeVersion;
|
|
178
171
|
continue;
|
|
179
172
|
}
|
|
180
173
|
}
|
|
@@ -98,9 +98,9 @@ function candidate(db, policy, incoming, receiverTime) {
|
|
|
98
98
|
* borrowed from the current input and are never read or disposed by KRAM.
|
|
99
99
|
*/
|
|
100
100
|
export function stageKram(db, policy, incoming, receiverTime) {
|
|
101
|
-
if (!db.
|
|
101
|
+
if (!db.opened)
|
|
102
102
|
throw new Error("KRAM staging database is closed");
|
|
103
|
-
return db.
|
|
103
|
+
return db.transaction(() => {
|
|
104
104
|
const fresh = candidate(db, policy, incoming, receiverTime);
|
|
105
105
|
if (fresh.kind === "rotated") {
|
|
106
106
|
removeKramFactors(db, fresh.key);
|
|
@@ -3,6 +3,8 @@ import { Deck } from "../deck.js";
|
|
|
3
3
|
import { KramPolicy } from "./kram-policy.js";
|
|
4
4
|
import { KramPruner } from "./kram-pruning.js";
|
|
5
5
|
import { stageKram } from "./kram-staging.js";
|
|
6
|
+
/** Explicit receiver-owned cache and exemption configuration. */
|
|
7
|
+
export { DEFAULT_KRAM_CACHES } from "./kram-policy.js";
|
|
6
8
|
/** Optional receiver intake returns ordinary decisions without owning parser input. */
|
|
7
9
|
export class Kramer {
|
|
8
10
|
constructor(db, { config = {}, cues = new Deck(), now = Date.now } = {}) {
|
|
@@ -350,3 +350,26 @@ export class TxnMsgCacheRecord extends RawRecord {
|
|
|
350
350
|
*/
|
|
351
351
|
export class WellKnownAuthN extends RawRecord {
|
|
352
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* A `/registry/root` copy the Poster reported sent: coordinates only, never the root.
|
|
355
|
+
*
|
|
356
|
+
* keri-ts only. Stored through `Komer` in `Baser.rrsn`, keyed (group, registry, recipient).
|
|
357
|
+
*/
|
|
358
|
+
export class RootSentRecord extends RawRecord {
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* The KEL a mailbox was last given for an identifier: coordinates only. A 2xx is not acceptance (the host may
|
|
362
|
+
* escrow), which is why the poller still repairs a 403.
|
|
363
|
+
*
|
|
364
|
+
* keri-ts only. Stored through `Komer` in `Baser.kpub`, keyed (identifier, mailbox).
|
|
365
|
+
*/
|
|
366
|
+
export class KelPublishedRecord extends RawRecord {
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Public derivation coordinates of one blinded registry update: which credential, state and binding the
|
|
370
|
+
* update's opening is derived for. Never a salt or an opening.
|
|
371
|
+
*
|
|
372
|
+
* keri-ts only. Stored through `Komer` in `Baser.dvus`, keyed by the BUP SAID.
|
|
373
|
+
*/
|
|
374
|
+
export class DerivedUpdateRecord extends RawRecord {
|
|
375
|
+
}
|
|
@@ -321,6 +321,17 @@ export class Revery {
|
|
|
321
321
|
writable: true,
|
|
322
322
|
value: void 0
|
|
323
323
|
});
|
|
324
|
+
/**
|
|
325
|
+
* Told after an `/end/role` reply is accepted, with the controller, role, endpoint and whether the role is
|
|
326
|
+
* allowed. The runtime uses it to have the mailbox poller and KEL publisher look at a controller whose mailbox
|
|
327
|
+
* role just changed, rather than at their next sweep.
|
|
328
|
+
*/
|
|
329
|
+
Object.defineProperty(this, "onEndRole", {
|
|
330
|
+
enumerable: true,
|
|
331
|
+
configurable: true,
|
|
332
|
+
writable: true,
|
|
333
|
+
value: void 0
|
|
334
|
+
});
|
|
324
335
|
this.db = db;
|
|
325
336
|
this.rtr = rtr ?? new Router();
|
|
326
337
|
this.cues = cues ?? new Deck();
|
|
@@ -820,7 +831,7 @@ export class BasicReplyRouteHandler {
|
|
|
820
831
|
throw new Error("Endpoint handler must own the reply transaction; process replies outside caller-owned writers");
|
|
821
832
|
}
|
|
822
833
|
let queryCues = [];
|
|
823
|
-
const decision = this.rvy.db.
|
|
834
|
+
const decision = this.rvy.db.transaction(() => {
|
|
824
835
|
let osaider = this.rvy.db.eans.get(keys);
|
|
825
836
|
if (osaider?.qb64 === args.diger.qb64)
|
|
826
837
|
osaider = null;
|
|
@@ -843,6 +854,8 @@ export class BasicReplyRouteHandler {
|
|
|
843
854
|
});
|
|
844
855
|
if (queryCues.length)
|
|
845
856
|
this.rvy.cues.extend(queryCues);
|
|
857
|
+
if (decision.kind === "accept")
|
|
858
|
+
this.rvy.onEndRole?.(cid, role, eid, allowed);
|
|
846
859
|
return decision;
|
|
847
860
|
}
|
|
848
861
|
/**
|
|
@@ -881,7 +894,7 @@ export class BasicReplyRouteHandler {
|
|
|
881
894
|
throw new Error("Endpoint handler must own the reply transaction; process replies outside caller-owned writers");
|
|
882
895
|
}
|
|
883
896
|
let queryCues = [];
|
|
884
|
-
const decision = this.rvy.db.
|
|
897
|
+
const decision = this.rvy.db.transaction(() => {
|
|
885
898
|
let osaider = this.rvy.db.lans.get(keys);
|
|
886
899
|
if (osaider?.qb64 === args.diger.qb64)
|
|
887
900
|
osaider = null;
|