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
|
@@ -17,19 +17,20 @@ import { Deck } from "../../core/deck.js";
|
|
|
17
17
|
import { TransIdxSigGroup } from "../../core/dispatch.js";
|
|
18
18
|
import { ValidationError } from "../../core/errors.js";
|
|
19
19
|
import { Kevery } from "../../core/kel/eventing.js";
|
|
20
|
+
import { Kever } from "../../core/kel/kever.js";
|
|
20
21
|
import { incept as inceptEvent, interact as interactEvent, query as queryEvent, receipt as receiptEvent, reply as replyEvent, rotate as rotateEvent, } from "../../core/protocol-eventing.js";
|
|
21
22
|
import { messagize } from "../../core/protocol-serialization.js";
|
|
22
23
|
import { HabitatRecord } from "../../core/records.js";
|
|
23
24
|
import { Roles } from "../../core/roles.js";
|
|
24
25
|
import { BasicReplyRouteHandler, Revery, Router } from "../../core/routing.js";
|
|
25
26
|
import { Schemes } from "../../core/schemes.js";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
27
|
+
import { Baser } from "../../db/basing.js";
|
|
28
|
+
import { openOwner } from "../../db/core/store-owner.js";
|
|
29
|
+
import { Keeper, PreSit } from "../../db/keeping.js";
|
|
28
30
|
import { makeNowIso8601 } from "../../time/mod.js";
|
|
29
31
|
import { oobiReplyMessages } from "../bootstrap/oobi-replies.js";
|
|
30
32
|
import { loadStoredReply } from "../delivery/stored-replies.js";
|
|
31
33
|
import { acceptedGroupMembers, latestGroupContribution } from "../multisig/group-members.js";
|
|
32
|
-
import { createConfiger } from "./configing.js";
|
|
33
34
|
import { branToSaltQb64, encodeHugeNumber, ensureKeeperCryptoReady, Manager, normalizeSaltQb64, saltySigner, } from "./keeping.js";
|
|
34
35
|
/** Reserved alias for the local signatory habitat record. */
|
|
35
36
|
export const SIGNER = "__signatory__";
|
|
@@ -43,13 +44,16 @@ const KERI_V1 = Object.freeze({ major: 1, minor: 0 });
|
|
|
43
44
|
/**
|
|
44
45
|
* Select the KERI version for a new event on an existing identifier.
|
|
45
46
|
*
|
|
46
|
-
* An identifier
|
|
47
|
-
*
|
|
48
|
-
*
|
|
47
|
+
* An identifier follows the KERI version of its latest accepted event. An explicit
|
|
48
|
+
* selection that conflicts with it is refused rather than silently ignored, except
|
|
49
|
+
* for a deliberate upgrade rotation, which is how a v1 identifier moves up to v2.
|
|
50
|
+
* Stricter than KERIpy, whose per-event default can mix versions without being asked.
|
|
49
51
|
*/
|
|
50
|
-
function acceptedKelVersion(kever, requested) {
|
|
52
|
+
function acceptedKelVersion(kever, requested, { allowUpgrade = false } = {}) {
|
|
51
53
|
const accepted = kever.serder.pvrsn.major === 1 ? Vrsn_1_0 : Vrsn_2_0;
|
|
52
54
|
if (requested && (requested.major !== accepted.major || requested.minor !== accepted.minor)) {
|
|
55
|
+
if (allowUpgrade && requested.major > accepted.major)
|
|
56
|
+
return requested;
|
|
53
57
|
throw new ValidationError(`KEL of ${kever.prefixer.qb64} is KERI ${accepted.major}.${accepted.minor}; `
|
|
54
58
|
+ `refusing a KERI ${requested.major}.${requested.minor} event.`);
|
|
55
59
|
}
|
|
@@ -272,6 +276,23 @@ export class Hab {
|
|
|
272
276
|
get accepted() {
|
|
273
277
|
return !!this.pre && this.db.getKever(this.pre) !== null;
|
|
274
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Whether the held or stored signing keys currently allow this habitat to sign.
|
|
281
|
+
* False for a keyless habitat (`makeSignedHab`) until the host holds its signer.
|
|
282
|
+
*/
|
|
283
|
+
canSign() {
|
|
284
|
+
try {
|
|
285
|
+
const probe = new Uint8Array(1);
|
|
286
|
+
if (this.kever?.transferable === false)
|
|
287
|
+
this.sign(probe, false);
|
|
288
|
+
else
|
|
289
|
+
this.sign(probe, true);
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
275
296
|
/** Return the live accepted-state `Kever` for this habitat when available. */
|
|
276
297
|
get kever() {
|
|
277
298
|
return this.pre ? this.db.getKever(this.pre) : null;
|
|
@@ -433,8 +454,24 @@ export class Hab {
|
|
|
433
454
|
if (!pre || !serder.said) {
|
|
434
455
|
throw new Error("Expected inception serder to provide string pre and said.");
|
|
435
456
|
}
|
|
436
|
-
const
|
|
437
|
-
this.mgr.move(
|
|
457
|
+
const sigs = this.mgr.sign(serder.raw, keys, true);
|
|
458
|
+
this.mgr.move(verfers[0].qb64, pre);
|
|
459
|
+
this.admitInception(serder, sigs, hidden);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Admit one signed inception as this habitat's first event: bind `pre`,
|
|
463
|
+
* register the name and habitat records unless `hidden`, and accept the event
|
|
464
|
+
* into the local KEL.
|
|
465
|
+
*
|
|
466
|
+
* Shared tail of `make()` and `makeSigned()`. It writes no keeper state and
|
|
467
|
+
* never signs. On rejection the `prefixes` entry is withdrawn and the error
|
|
468
|
+
* propagates; callers decide what else to undo.
|
|
469
|
+
*/
|
|
470
|
+
admitInception(serder, sigers, hidden) {
|
|
471
|
+
const pre = serder.pre;
|
|
472
|
+
if (!pre || !serder.said) {
|
|
473
|
+
throw new Error("Expected inception serder to provide string pre and said.");
|
|
474
|
+
}
|
|
438
475
|
this.pre = pre;
|
|
439
476
|
if (!hidden) {
|
|
440
477
|
const habord = new HabitatRecord({
|
|
@@ -446,9 +483,8 @@ export class Hab {
|
|
|
446
483
|
this.db.pinName(this.ns ?? "", this.name, pre);
|
|
447
484
|
this.db.prefixes.add(pre);
|
|
448
485
|
}
|
|
449
|
-
const sigs = this.mgr.sign(serder.raw, keys, true);
|
|
450
486
|
try {
|
|
451
|
-
this.acceptLocally(serder,
|
|
487
|
+
this.acceptLocally(serder, sigers);
|
|
452
488
|
}
|
|
453
489
|
catch (error) {
|
|
454
490
|
if (!hidden) {
|
|
@@ -457,6 +493,50 @@ export class Hab {
|
|
|
457
493
|
throw error;
|
|
458
494
|
}
|
|
459
495
|
}
|
|
496
|
+
/**
|
|
497
|
+
* Adopt a pre-signed inception this `Habery` did not generate, with no
|
|
498
|
+
* keeper key state for it (KERIpy `SignifyHab.incept` / `makeSignifyHab`).
|
|
499
|
+
*
|
|
500
|
+
* The inception is evaluated first, without mutation, by the same `Kever`
|
|
501
|
+
* decision local acceptance uses: SAID, prefix derivation, key and threshold
|
|
502
|
+
* material, and the signatures against the event's own keys. Anything but an
|
|
503
|
+
* accept (including an escrow for missing signatures) is refused before any
|
|
504
|
+
* record is written. A name or prefix already in use is refused too.
|
|
505
|
+
*
|
|
506
|
+
* Differences from KERIpy: verification precedes persistence instead of
|
|
507
|
+
* following it, a taken name is refused before anything is written (KERIpy
|
|
508
|
+
* pins the habitat record first), and `sign` is not disabled; it succeeds
|
|
509
|
+
* once the host holds the matching signer (`Manager.hold`).
|
|
510
|
+
*/
|
|
511
|
+
makeSigned(args) {
|
|
512
|
+
const { serder, sigers, hidden = false } = args;
|
|
513
|
+
const pre = serder.pre;
|
|
514
|
+
if (!pre || !serder.said) {
|
|
515
|
+
throw new ValidationError("Pre-signed inception must provide a prefix and SAID.");
|
|
516
|
+
}
|
|
517
|
+
if (this.db.getHab(pre) || this.db.getKever(pre) || this.db.prefixes.has(pre)) {
|
|
518
|
+
throw new ValidationError(`Habitat prefix ${pre} already exists.`);
|
|
519
|
+
}
|
|
520
|
+
if (!hidden && this.db.getName(this.ns ?? "", this.name) !== null) {
|
|
521
|
+
throw new ValidationError(`Habitat name ${this.name} already exists.`);
|
|
522
|
+
}
|
|
523
|
+
const decision = Kever.evaluateInception({ db: this.db, serder, sigers, local: true });
|
|
524
|
+
if (decision.kind !== "accept") {
|
|
525
|
+
const detail = decision.kind === "duplicate" ? decision.duplicate : decision.message;
|
|
526
|
+
throw new ValidationError(`Pre-signed inception ${serder.said} refused: ${detail}`);
|
|
527
|
+
}
|
|
528
|
+
try {
|
|
529
|
+
this.admitInception(serder, sigers, hidden);
|
|
530
|
+
}
|
|
531
|
+
catch (error) {
|
|
532
|
+
if (!hidden) {
|
|
533
|
+
this.db.habs.rem(pre);
|
|
534
|
+
this.db.names.rem([this.ns ?? "", this.name]);
|
|
535
|
+
}
|
|
536
|
+
this.pre = "";
|
|
537
|
+
throw error;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
460
540
|
/**
|
|
461
541
|
* Rotate this habitat through the shared accepted-state path.
|
|
462
542
|
*
|
|
@@ -473,7 +553,7 @@ export class Hab {
|
|
|
473
553
|
if (!kever) {
|
|
474
554
|
throw new ValidationError(`Missing accepted key state for ${this.pre}.`);
|
|
475
555
|
}
|
|
476
|
-
const version = acceptedKelVersion(kever, args.version);
|
|
556
|
+
const version = acceptedKelVersion(kever, args.version, { allowUpgrade: true });
|
|
477
557
|
const priorSit = this.ks.getSits(this.pre);
|
|
478
558
|
if (!priorSit) {
|
|
479
559
|
throw new ValidationError(`Missing keeper state for ${this.pre}.`);
|
|
@@ -1077,7 +1157,7 @@ export class Signator {
|
|
|
1077
1157
|
*/
|
|
1078
1158
|
export class Habery {
|
|
1079
1159
|
/** Compose one habery from already-opened storage, manager, and config surfaces. */
|
|
1080
|
-
constructor(name, base, temp, headDirPath, compat, readonly, db, ks, mgr, cf, skipSignator = false) {
|
|
1160
|
+
constructor(name, base, temp, headDirPath, compat, readonly, db, ks, mgr, cf, skipSignator = false, opener, borrowsStores = false) {
|
|
1081
1161
|
Object.defineProperty(this, "name", {
|
|
1082
1162
|
enumerable: true,
|
|
1083
1163
|
configurable: true,
|
|
@@ -1114,6 +1194,19 @@ export class Habery {
|
|
|
1114
1194
|
writable: true,
|
|
1115
1195
|
value: void 0
|
|
1116
1196
|
});
|
|
1197
|
+
Object.defineProperty(this, "storeOpener", {
|
|
1198
|
+
enumerable: true,
|
|
1199
|
+
configurable: true,
|
|
1200
|
+
writable: true,
|
|
1201
|
+
value: void 0
|
|
1202
|
+
});
|
|
1203
|
+
/** True when `db` and `ks` were borrowed; their owner closes them. */
|
|
1204
|
+
Object.defineProperty(this, "borrowsStores", {
|
|
1205
|
+
enumerable: true,
|
|
1206
|
+
configurable: true,
|
|
1207
|
+
writable: true,
|
|
1208
|
+
value: void 0
|
|
1209
|
+
});
|
|
1117
1210
|
Object.defineProperty(this, "db", {
|
|
1118
1211
|
enumerable: true,
|
|
1119
1212
|
configurable: true,
|
|
@@ -1174,6 +1267,19 @@ export class Habery {
|
|
|
1174
1267
|
writable: true,
|
|
1175
1268
|
value: void 0
|
|
1176
1269
|
});
|
|
1270
|
+
/**
|
|
1271
|
+
* Prefixes of habitats whose alias config was not applied at open because they
|
|
1272
|
+
* could not sign yet (a keyless habitat before the host holds its signer). The
|
|
1273
|
+
* host calls `hab.reconfigure()` after holding; applying config is retried then.
|
|
1274
|
+
*/
|
|
1275
|
+
Object.defineProperty(this, "deferredReconfigure", {
|
|
1276
|
+
enumerable: true,
|
|
1277
|
+
configurable: true,
|
|
1278
|
+
writable: true,
|
|
1279
|
+
value: []
|
|
1280
|
+
});
|
|
1281
|
+
this.storeOpener = opener;
|
|
1282
|
+
this.borrowsStores = borrowsStores;
|
|
1177
1283
|
this.name = name;
|
|
1178
1284
|
this.base = base;
|
|
1179
1285
|
this.temp = temp;
|
|
@@ -1219,8 +1325,10 @@ export class Habery {
|
|
|
1219
1325
|
/**
|
|
1220
1326
|
* Populate the in-memory habitat cache from durable `habs.` + `states.` data.
|
|
1221
1327
|
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1328
|
+
* Like KERIpy `loadHabs`, a local group record is held even while its
|
|
1329
|
+
* inception is unaccepted: the `Hab` reads accepted state on demand, so it
|
|
1330
|
+
* becomes usable the moment the event is accepted. A non-group record without
|
|
1331
|
+
* accepted state is an orphan; `Baser.reloadKevers` already dropped it.
|
|
1224
1332
|
*/
|
|
1225
1333
|
loadHabs() {
|
|
1226
1334
|
this.reconfigure();
|
|
@@ -1233,13 +1341,20 @@ export class Habery {
|
|
|
1233
1341
|
const hab = new Hab(habord.name, this.db, this.ks, this.mgr, this.cf, this.rtr, this.rvy, this.kevery, habord.domain, hid);
|
|
1234
1342
|
if (!hab.accepted) {
|
|
1235
1343
|
if (habord.mid) {
|
|
1344
|
+
this.habs.set(hab.pre, hab);
|
|
1236
1345
|
continue;
|
|
1237
1346
|
}
|
|
1238
1347
|
throw new ValidationError(`Problem loading Hab pre=${hid} name=${habord.name} from db.`);
|
|
1239
1348
|
}
|
|
1240
1349
|
this.habs.set(hab.pre, hab);
|
|
1241
1350
|
}
|
|
1351
|
+
this.deferredReconfigure.length = 0;
|
|
1242
1352
|
for (const hab of this.habs.values()) {
|
|
1353
|
+
// Config replies are signed. A habitat that cannot sign yet applies them once its signer is held.
|
|
1354
|
+
if (hab.accepted && hab.configuredSection() && !hab.canSign()) {
|
|
1355
|
+
this.deferredReconfigure.push(hab.pre);
|
|
1356
|
+
continue;
|
|
1357
|
+
}
|
|
1243
1358
|
hab.reconfigure();
|
|
1244
1359
|
}
|
|
1245
1360
|
// Restart recovery: commit members of an accepted establishment event
|
|
@@ -1309,6 +1424,32 @@ export class Habery {
|
|
|
1309
1424
|
}
|
|
1310
1425
|
}
|
|
1311
1426
|
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Adopt an inception the caller built and signed, creating a habitat with no
|
|
1429
|
+
* keeper key state (KERIpy `makeSignifyHab`).
|
|
1430
|
+
*
|
|
1431
|
+
* Contract:
|
|
1432
|
+
* - the inception and its signatures are verified before anything is
|
|
1433
|
+
* persisted; a bad, under-signed or duplicate inception is refused and
|
|
1434
|
+
* leaves no record behind
|
|
1435
|
+
* - nothing is written to the keeper, so the hab cannot sign until the host
|
|
1436
|
+
* calls `mgr.hold()` with the matching signer(s), cannot rotate, and after
|
|
1437
|
+
* reopen is present again with signing unavailable until re-held
|
|
1438
|
+
* - hold signers with the encoding the inception's keys use (`D...` for
|
|
1439
|
+
* transferable, `B...` for non-transferable)
|
|
1440
|
+
* - unlike `makeHab`, bootstrap config replies are not applied, since they
|
|
1441
|
+
* need a signing key; the host reconfigures after holding
|
|
1442
|
+
*/
|
|
1443
|
+
makeSignedHab(name, ns, args) {
|
|
1444
|
+
const pre = args.serder.pre;
|
|
1445
|
+
if (pre && this.habs.has(pre)) {
|
|
1446
|
+
throw new ValidationError(`Habitat prefix ${pre} already exists.`);
|
|
1447
|
+
}
|
|
1448
|
+
const hab = new Hab(name, this.db, this.ks, this.mgr, this.cf, this.rtr, this.rvy, this.kevery, ns, "");
|
|
1449
|
+
hab.makeSigned(args);
|
|
1450
|
+
this.habs.set(hab.pre, hab);
|
|
1451
|
+
return hab;
|
|
1452
|
+
}
|
|
1312
1453
|
/** Creates and caches a new habitat under this habery. */
|
|
1313
1454
|
makeHab(name, ns, args = {}) {
|
|
1314
1455
|
const hab = new Hab(name, this.db, this.ks, this.mgr, this.cf, this.rtr, this.rvy, this.kevery, ns, "");
|
|
@@ -1688,10 +1829,20 @@ export class Habery {
|
|
|
1688
1829
|
this.habs.set(pre, hab);
|
|
1689
1830
|
return hab;
|
|
1690
1831
|
}
|
|
1691
|
-
/**
|
|
1832
|
+
/** Creates this Habery's sidecar stores. */
|
|
1833
|
+
get opener() {
|
|
1834
|
+
if (!this.storeOpener)
|
|
1835
|
+
throw new ValidationError("This Habery was given stores without an opener for sidecars.");
|
|
1836
|
+
return this.storeOpener;
|
|
1837
|
+
}
|
|
1838
|
+
/** Identity shared by this Habery's stores and sidecars. */
|
|
1839
|
+
storeIdentity() {
|
|
1840
|
+
return { name: this.name, base: this.base, temp: this.temp, reopen: true, readonly: this.readonly };
|
|
1841
|
+
}
|
|
1842
|
+
/** Closes owned backing databases and optionally clears temp storage. */
|
|
1692
1843
|
*close(clear = false) {
|
|
1693
1844
|
const failures = [];
|
|
1694
|
-
const closing = [this.db.close(clear), this.ks.close(clear)];
|
|
1845
|
+
const closing = this.borrowsStores ? [] : [this.db.close(clear), this.ks.close(clear)];
|
|
1695
1846
|
if (this.cf)
|
|
1696
1847
|
closing.push(this.cf.close(clear && this.temp));
|
|
1697
1848
|
for (const operation of closing) {
|
|
@@ -1726,38 +1877,29 @@ export function branToSeedAeid(bran) {
|
|
|
1726
1877
|
* The returned `Habery` immediately reconstructs its local habitat cache from
|
|
1727
1878
|
* durable DB state rather than depending on process-local creation history.
|
|
1728
1879
|
*/
|
|
1729
|
-
export function*
|
|
1730
|
-
const { name, base = "", temp = false, headDirPath, compat = false, readonly = false, cf: providedCf, skipConfig = false, skipSignator = false, bran, seed, aeid, salt, algo, } = args;
|
|
1880
|
+
export function* openHabery(args) {
|
|
1881
|
+
const { name, base = "", temp = false, headDirPath, compat = false, readonly = false, cf: providedCf, createConfig, skipConfig = false, skipSignator = false, opener, stores, bran, seed, aeid, salt, algo, } = args;
|
|
1731
1882
|
let db;
|
|
1732
1883
|
let ks;
|
|
1733
1884
|
let cf;
|
|
1734
1885
|
let delivered = false;
|
|
1735
1886
|
let failure;
|
|
1736
1887
|
try {
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
});
|
|
1746
|
-
ks = yield* createKeeper({
|
|
1747
|
-
name,
|
|
1748
|
-
base,
|
|
1749
|
-
temp,
|
|
1750
|
-
headDirPath,
|
|
1751
|
-
compat,
|
|
1752
|
-
reopen: true,
|
|
1753
|
-
readonly,
|
|
1754
|
-
});
|
|
1888
|
+
if (!opener && !stores)
|
|
1889
|
+
throw new ValidationError("A Habery needs a store opener or borrowed stores.");
|
|
1890
|
+
if (!providedCf && !skipConfig && !createConfig) {
|
|
1891
|
+
throw new ValidationError("A Habery needs a Configer, a Configer factory or skipConfig.");
|
|
1892
|
+
}
|
|
1893
|
+
const identity = { name, base, temp, reopen: true, readonly };
|
|
1894
|
+
db = stores?.db ?? (yield* openOwner(new Baser(opener.create(Baser.Family, identity)), "Baser", identity));
|
|
1895
|
+
ks = stores?.ks ?? (yield* openOwner(new Keeper(opener.create(Keeper.Family, identity)), "Keeper", identity));
|
|
1755
1896
|
cf = providedCf
|
|
1756
|
-
?? (skipConfig ? undefined : (yield*
|
|
1897
|
+
?? (skipConfig ? undefined : (yield* createConfig({
|
|
1757
1898
|
name,
|
|
1758
1899
|
base,
|
|
1759
1900
|
temp,
|
|
1760
1901
|
headDirPath,
|
|
1902
|
+
compat,
|
|
1761
1903
|
reopen: true,
|
|
1762
1904
|
clear: false,
|
|
1763
1905
|
})));
|
|
@@ -1779,7 +1921,7 @@ export function* createHabery(args) {
|
|
|
1779
1921
|
algo,
|
|
1780
1922
|
salt: normalizeSaltQb64(salt),
|
|
1781
1923
|
});
|
|
1782
|
-
const hby = new Habery(name, base, temp, headDirPath, compat, readonly, db, ks, mgr, cf, skipSignator);
|
|
1924
|
+
const hby = new Habery(name, base, temp, headDirPath, compat, readonly, db, ks, mgr, cf, skipSignator, opener, !!stores);
|
|
1783
1925
|
delivered = true;
|
|
1784
1926
|
return hby;
|
|
1785
1927
|
}
|
|
@@ -1796,9 +1938,9 @@ export function* createHabery(args) {
|
|
|
1796
1938
|
const closing = [];
|
|
1797
1939
|
if (cf && cf !== providedCf)
|
|
1798
1940
|
closing.push(cf.close());
|
|
1799
|
-
if (ks)
|
|
1941
|
+
if (ks && !stores)
|
|
1800
1942
|
closing.push(ks.close());
|
|
1801
|
-
if (db)
|
|
1943
|
+
if (db && !stores)
|
|
1802
1944
|
closing.push(db.close());
|
|
1803
1945
|
for (const operation of closing) {
|
|
1804
1946
|
try {
|
|
@@ -241,6 +241,16 @@ export class Manager {
|
|
|
241
241
|
writable: true,
|
|
242
242
|
value: null
|
|
243
243
|
});
|
|
244
|
+
/**
|
|
245
|
+
* Borrowed, volatile signers keyed by qualified public key (`hold()`).
|
|
246
|
+
* Never written to the Keeper and never consulted by `Keeper` rows.
|
|
247
|
+
*/
|
|
248
|
+
Object.defineProperty(this, "held", {
|
|
249
|
+
enumerable: true,
|
|
250
|
+
configurable: true,
|
|
251
|
+
writable: true,
|
|
252
|
+
value: new Map()
|
|
253
|
+
});
|
|
244
254
|
const { ks, seed = "", aeid = "", pidx = 0, algo = Algos.salty, salt = randomSaltQb64(), tier = Tiers.low, } = args;
|
|
245
255
|
this._ks = ks;
|
|
246
256
|
this._seed = seed;
|
|
@@ -428,13 +438,21 @@ export class Manager {
|
|
|
428
438
|
}
|
|
429
439
|
return root;
|
|
430
440
|
}
|
|
431
|
-
/**
|
|
432
|
-
|
|
441
|
+
/**
|
|
442
|
+
* Retain once, returning false for the identical root without replacing ciphertext. `overwrite` replaces a
|
|
443
|
+
* different held root; only a caller that has shown that root was never used (no update staged or accepted
|
|
444
|
+
* for its registry) may set it.
|
|
445
|
+
*/
|
|
446
|
+
putRegistryRoot(aid, regid, root, overwrite = false) {
|
|
433
447
|
const keys = this.registryRootKeys(aid, regid);
|
|
434
448
|
if (!(root instanceof Salter) || root.code !== MtrDex.Salt_128)
|
|
435
449
|
throw new Error("Registry root must be Salt128");
|
|
436
450
|
const { aeid, encrypter, decrypter } = this.registryRootCrypto();
|
|
437
|
-
return this.ks.retainRegistryRoot(keys, root, aeid, encrypter, decrypter);
|
|
451
|
+
return this.ks.retainRegistryRoot(keys, root, aeid, encrypter, decrypter, overwrite);
|
|
452
|
+
}
|
|
453
|
+
/** Whether a root is retained for `aid` and `regid`; reads no ciphertext and needs no unlocked Keeper. */
|
|
454
|
+
hasRegistryRoot(aid, regid) {
|
|
455
|
+
return !!this.ks.rroots.get(this.registryRootKeys(aid, regid));
|
|
438
456
|
}
|
|
439
457
|
signerDecrypter() {
|
|
440
458
|
if (this.aeid && !this.decrypter) {
|
|
@@ -442,8 +460,63 @@ export class Manager {
|
|
|
442
460
|
}
|
|
443
461
|
return this.decrypter ?? undefined;
|
|
444
462
|
}
|
|
445
|
-
/**
|
|
463
|
+
/**
|
|
464
|
+
* Borrow live signers for signing, decryption and ESSR opening without
|
|
465
|
+
* persisting them.
|
|
466
|
+
*
|
|
467
|
+
* Held signers are consulted before stored keys by the one private lookup
|
|
468
|
+
* every `sign`, `decrypt`, `open`, group-member and endpoint-role path
|
|
469
|
+
* resolves through. They live only in this `Manager` instance's memory:
|
|
470
|
+
* nothing is written to any Keeper table, re-encryption by `updateAeid()`
|
|
471
|
+
* neither reads nor changes them, and a new `Manager` over the same Keeper
|
|
472
|
+
* starts with none.
|
|
473
|
+
*
|
|
474
|
+
* Contract:
|
|
475
|
+
* - The table is keyed by `signer.verfer.qb64`. The same raw key encodes
|
|
476
|
+
* differently when transferable (`D...`) and non-transferable (`B...`), so
|
|
477
|
+
* build each `Signer` with the transferability the key list or prefix uses,
|
|
478
|
+
* and hold that encoding. A request for the other encoding does not match.
|
|
479
|
+
* - The host owns each `Signer` and its seed bytes, including zeroing them.
|
|
480
|
+
* This keeps the reference only; it never copies seed bytes and never
|
|
481
|
+
* erases them. Dropping a reference with `release()` does not zero memory.
|
|
482
|
+
* - Holding a pub that is already held replaces the earlier signer. A held
|
|
483
|
+
* signer shadows a stored key with the same public key.
|
|
484
|
+
* - The `pre/path` branch of `sign()` re-derives salty keys from the stored
|
|
485
|
+
* prefix salt and never consults held signers.
|
|
486
|
+
*
|
|
487
|
+
* @param signers Signers to borrow; all are validated before any is held.
|
|
488
|
+
*/
|
|
489
|
+
hold(signers) {
|
|
490
|
+
const batch = new Map();
|
|
491
|
+
for (const signer of signers) {
|
|
492
|
+
if (!(signer instanceof Signer)) {
|
|
493
|
+
throw new ValidationError("Held signers must be Signer instances");
|
|
494
|
+
}
|
|
495
|
+
batch.set(signer.verfer.qb64, signer);
|
|
496
|
+
}
|
|
497
|
+
for (const [pub, signer] of batch)
|
|
498
|
+
this.held.set(pub, signer);
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Drop held signer references: all of them, or only those for `pubs`.
|
|
502
|
+
*
|
|
503
|
+
* Unheld pubs are ignored. Afterwards a request for a released key resolves
|
|
504
|
+
* from stored keys only and fails as any missing key does. This drops
|
|
505
|
+
* references; zeroing a signer's seed stays the host's job.
|
|
506
|
+
*/
|
|
507
|
+
release(pubs) {
|
|
508
|
+
if (pubs === undefined) {
|
|
509
|
+
this.held.clear();
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
for (const pub of pubs)
|
|
513
|
+
this.held.delete(pub);
|
|
514
|
+
}
|
|
515
|
+
/** Resolve one signer by qualified public key: held first, then the Keeper's `pris.`. */
|
|
446
516
|
getSignerByPub(pub) {
|
|
517
|
+
const held = this.held.get(pub);
|
|
518
|
+
if (held)
|
|
519
|
+
return held;
|
|
447
520
|
const signer = this.ks.pris.get(pub, this.signerDecrypter());
|
|
448
521
|
if (!signer) {
|
|
449
522
|
throw new Error(`Missing prikey in db for pubkey=${pub}`);
|
|
@@ -1195,7 +1268,7 @@ export function b64DecodeUrl(text) {
|
|
|
1195
1268
|
/**
|
|
1196
1269
|
* Backward-compatibility no-op for older app-layer startup seams.
|
|
1197
1270
|
*
|
|
1198
|
-
* CESR primitives now own
|
|
1271
|
+
* CESR primitives now own crypto backend readiness through their own module
|
|
1199
1272
|
* initialization, so higher layers no longer need an explicit keeper-crypto
|
|
1200
1273
|
* readiness step.
|
|
1201
1274
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Default LMDB-backed `Habery` construction, kept apart so `openHabery` stays backend-neutral. */
|
|
2
|
+
import { LmdbStoreOpener } from "../../db/core/lmdb-opener.js";
|
|
3
|
+
import { createConfiger } from "./configing.js";
|
|
4
|
+
import { openHabery } from "./habbing.js";
|
|
5
|
+
/** Open a `Habery` on LMDB at its established paths, unless the caller supplies stores or an opener. */
|
|
6
|
+
export function* createHabery(args) {
|
|
7
|
+
return yield* openHabery({
|
|
8
|
+
opener: new LmdbStoreOpener({ headDirPath: args.headDirPath, compat: args.compat }),
|
|
9
|
+
createConfig: createConfiger,
|
|
10
|
+
...args,
|
|
11
|
+
});
|
|
12
|
+
}
|