keri-ts 2.2.3 → 2.2.5
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/esm/keri/npm/src/_dnt.polyfills.js +14 -14
- package/esm/keri/npm/src/acdc/registering.js +19 -0
- package/esm/keri/npm/src/acdc/salting.js +4 -0
- package/esm/keri/npm/src/app/bootstrap/authenticating.js +34 -12
- package/esm/keri/npm/src/app/bootstrap/oobiery.js +365 -32
- package/esm/keri/npm/src/app/credentials/credential-importing.js +33 -4
- package/esm/keri/npm/src/app/credentials/root-replicator.js +27 -15
- package/esm/keri/npm/src/app/credentials/schema-resolving.js +5 -1
- package/esm/keri/npm/src/app/credentials/tel-publishing.js +16 -7
- package/esm/keri/npm/src/app/delivery/forwarding.js +188 -47
- package/esm/keri/npm/src/app/delivery/relaying.js +232 -0
- package/esm/keri/npm/src/app/delivery/respondant.js +8 -5
- package/esm/keri/npm/src/app/exchanges/exchange-messaging.js +1 -1
- package/esm/keri/npm/src/app/exchanges/exchanging.js +65 -9
- package/esm/keri/npm/src/app/identity/delegating.js +66 -9
- package/esm/keri/npm/src/app/identity/habbing.js +190 -71
- package/esm/keri/npm/src/app/identity/keeping.js +111 -39
- package/esm/keri/npm/src/app/identity/retire-identifier.js +98 -0
- package/esm/keri/npm/src/app/ipex/disclosure-replaying.js +116 -0
- package/esm/keri/npm/src/app/ipex/group-ipex.js +122 -25
- package/esm/keri/npm/src/app/ipex/group-issuance.js +109 -23
- package/esm/keri/npm/src/app/ipex/ipex-discloser.js +36 -22
- package/esm/keri/npm/src/app/ipex/ipex-grouping.js +53 -3
- package/esm/keri/npm/src/app/ipex/ipex-v2.js +7 -2
- package/esm/keri/npm/src/app/ipex/issuance.js +131 -35
- package/esm/keri/npm/src/app/ipex/pending-presentations.js +4 -2
- package/esm/keri/npm/src/app/ipex/presenting.js +3 -18
- package/esm/keri/npm/src/app/ipex/receive-issuance.js +2 -1
- package/esm/keri/npm/src/app/ipex/unblinding-workflow.js +16 -3
- package/esm/keri/npm/src/app/mailbox/agent-inbox.js +292 -0
- package/esm/keri/npm/src/app/mailbox/forward-handler.js +298 -52
- package/esm/keri/npm/src/app/mailbox/kel-publisher.js +26 -31
- package/esm/keri/npm/src/app/mailbox/mailbox-poller.js +70 -62
- package/esm/keri/npm/src/app/mailbox/mailboxing.js +20 -4
- package/esm/keri/npm/src/app/multisig/counseling.js +75 -27
- package/esm/keri/npm/src/app/multisig/group-members.js +41 -5
- package/esm/keri/npm/src/app/multisig/grouping.js +50 -2
- package/esm/keri/npm/src/app/multisig/multisig-workflows.js +3 -18
- package/esm/keri/npm/src/app/multisig/proposing.js +1 -16
- package/esm/keri/npm/src/app/multisig/rejoin-group.js +99 -0
- package/esm/keri/npm/src/app/multisig/replace-member.js +29 -8
- package/esm/keri/npm/src/app/protocol/parsering.js +45 -17
- package/esm/keri/npm/src/app/protocol/protocol-processing.js +62 -27
- package/esm/keri/npm/src/app/queries/query-replies.js +0 -22
- package/esm/keri/npm/src/app/queries/relay-refresh.js +81 -0
- package/esm/keri/npm/src/app/queries/witness-inquisitor.js +190 -40
- package/esm/keri/npm/src/app/runtime/agent-runtime.js +46 -73
- package/esm/keri/npm/src/app/runtime/cue-runtime.js +45 -5
- package/esm/keri/npm/src/app/runtime/doing.js +25 -0
- package/esm/keri/npm/src/app/runtime/operation-owners.js +26 -56
- package/esm/keri/npm/src/app/runtime/workflow-contract.js +7 -4
- package/esm/keri/npm/src/app/transport/http-client.js +20 -2
- package/esm/keri/npm/src/app/transport/message-source.js +2 -1
- package/esm/keri/npm/src/app/transport/messengering.js +39 -8
- package/esm/keri/npm/src/app/witness/ingress.js +7 -0
- package/esm/keri/npm/src/app/witness/receipt-client.js +43 -16
- package/esm/keri/npm/src/app/witness/receipting.js +62 -20
- package/esm/keri/npm/src/cli/messaging/multisig.js +4 -3
- package/esm/keri/npm/src/core/errors.js +73 -0
- package/esm/keri/npm/src/core/kel/delegation-ancestry.js +11 -2
- package/esm/keri/npm/src/core/kel/eventing.js +25 -28
- package/esm/keri/npm/src/core/kel/kever.js +15 -9
- package/esm/keri/npm/src/core/mailbox/kram-policy.js +8 -0
- package/esm/keri/npm/src/core/mailbox/kram-pruning.js +25 -6
- package/esm/keri/npm/src/core/mailbox/kram-time.js +34 -6
- package/esm/keri/npm/src/core/mailbox/kraming.js +58 -2
- package/esm/keri/npm/src/core/routing.js +18 -25
- package/esm/keri/npm/src/core/scheming.js +12 -5
- package/esm/keri/npm/src/core/wire-fields.js +126 -0
- package/esm/keri/npm/src/db/basing.js +4 -13
- package/esm/keri/npm/src/db/core/indexeddb-persistence.js +3 -2
- package/esm/keri/npm/src/db/core/lmdber.js +25 -6
- package/esm/keri/npm/src/db/core/memstore.js +4 -0
- package/esm/keri/npm/src/db/core/store-owner.js +4 -0
- package/esm/keri/npm/src/db/core/webdber.js +85 -27
- package/esm/keri/npm/src/db/mailbox/mailboxing.js +13 -0
- package/esm/keri/npm/src/db/subing.js +4 -0
- package/esm/keri/npm/src/runtime/index.js +11 -5
- package/esm/keri/npm/src/time/mod.js +5 -0
- package/esm/keri/npm/src/vdr/credential-tsn-record.js +2 -7
- package/esm/keri/npm/src/vdr/eventing.js +28 -19
- package/esm/keri/npm/src/vdr/registry-tsn-record.js +3 -13
- package/esm/keri/npm/src/version.js +2 -2
- package/package.json +1 -1
- package/types/_dnt.polyfills.d.ts +9 -9
- package/types/_dnt.polyfills.d.ts.map +1 -1
- package/types/acdc/registering.d.ts +6 -0
- package/types/acdc/registering.d.ts.map +1 -1
- package/types/acdc/salting.d.ts.map +1 -1
- package/types/app/bootstrap/authenticating.d.ts +12 -2
- package/types/app/bootstrap/authenticating.d.ts.map +1 -1
- package/types/app/bootstrap/oobiery.d.ts +144 -7
- package/types/app/bootstrap/oobiery.d.ts.map +1 -1
- package/types/app/credentials/credential-importing.d.ts +8 -0
- package/types/app/credentials/credential-importing.d.ts.map +1 -1
- package/types/app/credentials/root-replicator.d.ts +19 -8
- package/types/app/credentials/root-replicator.d.ts.map +1 -1
- package/types/app/credentials/schema-resolving.d.ts.map +1 -1
- package/types/app/credentials/tel-publishing.d.ts +4 -2
- package/types/app/credentials/tel-publishing.d.ts.map +1 -1
- package/types/app/delivery/forwarding.d.ts +75 -7
- package/types/app/delivery/forwarding.d.ts.map +1 -1
- package/types/app/delivery/relaying.d.ts +144 -0
- package/types/app/delivery/relaying.d.ts.map +1 -0
- package/types/app/delivery/respondant.d.ts +9 -2
- package/types/app/delivery/respondant.d.ts.map +1 -1
- package/types/app/exchanges/exchanging.d.ts +36 -0
- package/types/app/exchanges/exchanging.d.ts.map +1 -1
- package/types/app/identity/delegating.d.ts +6 -0
- package/types/app/identity/delegating.d.ts.map +1 -1
- package/types/app/identity/habbing.d.ts +106 -19
- package/types/app/identity/habbing.d.ts.map +1 -1
- package/types/app/identity/keeping.d.ts +54 -19
- package/types/app/identity/keeping.d.ts.map +1 -1
- package/types/app/identity/retire-identifier.d.ts +24 -0
- package/types/app/identity/retire-identifier.d.ts.map +1 -0
- package/types/app/ipex/disclosure-replaying.d.ts +61 -0
- package/types/app/ipex/disclosure-replaying.d.ts.map +1 -0
- package/types/app/ipex/group-ipex.d.ts +60 -14
- package/types/app/ipex/group-ipex.d.ts.map +1 -1
- package/types/app/ipex/group-issuance.d.ts +48 -6
- package/types/app/ipex/group-issuance.d.ts.map +1 -1
- package/types/app/ipex/ipex-discloser.d.ts +14 -2
- package/types/app/ipex/ipex-discloser.d.ts.map +1 -1
- package/types/app/ipex/ipex-grouping.d.ts +23 -2
- package/types/app/ipex/ipex-grouping.d.ts.map +1 -1
- package/types/app/ipex/ipex-v2.d.ts +5 -2
- package/types/app/ipex/ipex-v2.d.ts.map +1 -1
- package/types/app/ipex/issuance.d.ts +35 -11
- package/types/app/ipex/issuance.d.ts.map +1 -1
- package/types/app/ipex/pending-presentations.d.ts +4 -2
- package/types/app/ipex/pending-presentations.d.ts.map +1 -1
- package/types/app/ipex/presenting.d.ts.map +1 -1
- package/types/app/ipex/receive-issuance.d.ts +2 -1
- package/types/app/ipex/receive-issuance.d.ts.map +1 -1
- package/types/app/ipex/unblinding-workflow.d.ts +4 -1
- package/types/app/ipex/unblinding-workflow.d.ts.map +1 -1
- package/types/app/mailbox/agent-inbox.d.ts +126 -0
- package/types/app/mailbox/agent-inbox.d.ts.map +1 -0
- package/types/app/mailbox/forward-handler.d.ts +114 -14
- package/types/app/mailbox/forward-handler.d.ts.map +1 -1
- package/types/app/mailbox/kel-publisher.d.ts +12 -22
- package/types/app/mailbox/kel-publisher.d.ts.map +1 -1
- package/types/app/mailbox/mailbox-poller.d.ts +40 -24
- package/types/app/mailbox/mailbox-poller.d.ts.map +1 -1
- package/types/app/mailbox/mailboxing.d.ts +19 -5
- package/types/app/mailbox/mailboxing.d.ts.map +1 -1
- package/types/app/multisig/counseling.d.ts +34 -11
- package/types/app/multisig/counseling.d.ts.map +1 -1
- package/types/app/multisig/group-members.d.ts +17 -1
- package/types/app/multisig/group-members.d.ts.map +1 -1
- package/types/app/multisig/grouping.d.ts +17 -1
- package/types/app/multisig/grouping.d.ts.map +1 -1
- package/types/app/multisig/multisig-workflows.d.ts +0 -8
- package/types/app/multisig/multisig-workflows.d.ts.map +1 -1
- package/types/app/multisig/proposing.d.ts +4 -19
- package/types/app/multisig/proposing.d.ts.map +1 -1
- package/types/app/multisig/rejoin-group.d.ts +119 -0
- package/types/app/multisig/rejoin-group.d.ts.map +1 -0
- package/types/app/multisig/replace-member.d.ts +15 -1
- package/types/app/multisig/replace-member.d.ts.map +1 -1
- package/types/app/protocol/parsering.d.ts +21 -2
- package/types/app/protocol/parsering.d.ts.map +1 -1
- package/types/app/protocol/protocol-processing.d.ts +31 -6
- package/types/app/protocol/protocol-processing.d.ts.map +1 -1
- package/types/app/queries/query-replies.d.ts +4 -8
- package/types/app/queries/query-replies.d.ts.map +1 -1
- package/types/app/queries/relay-refresh.d.ts +26 -0
- package/types/app/queries/relay-refresh.d.ts.map +1 -0
- package/types/app/queries/witness-inquisitor.d.ts +57 -6
- package/types/app/queries/witness-inquisitor.d.ts.map +1 -1
- package/types/app/runtime/agent-runtime.d.ts +34 -3
- package/types/app/runtime/agent-runtime.d.ts.map +1 -1
- package/types/app/runtime/cue-runtime.d.ts +15 -3
- package/types/app/runtime/cue-runtime.d.ts.map +1 -1
- package/types/app/runtime/doing.d.ts +17 -0
- package/types/app/runtime/doing.d.ts.map +1 -1
- package/types/app/runtime/operation-owners.d.ts +16 -26
- package/types/app/runtime/operation-owners.d.ts.map +1 -1
- package/types/app/runtime/workflow-contract.d.ts +21 -6
- package/types/app/runtime/workflow-contract.d.ts.map +1 -1
- package/types/app/transport/http-client.d.ts +9 -0
- package/types/app/transport/http-client.d.ts.map +1 -1
- package/types/app/transport/message-source.d.ts +6 -3
- package/types/app/transport/message-source.d.ts.map +1 -1
- package/types/app/transport/messengering.d.ts +10 -1
- package/types/app/transport/messengering.d.ts.map +1 -1
- package/types/app/witness/ingress.d.ts +1 -0
- package/types/app/witness/ingress.d.ts.map +1 -1
- package/types/app/witness/receipt-client.d.ts +19 -1
- package/types/app/witness/receipt-client.d.ts.map +1 -1
- package/types/app/witness/receipting.d.ts +24 -1
- package/types/app/witness/receipting.d.ts.map +1 -1
- package/types/cli/messaging/multisig.d.ts.map +1 -1
- package/types/core/cues.d.ts +53 -1
- package/types/core/cues.d.ts.map +1 -1
- package/types/core/errors.d.ts +32 -0
- package/types/core/errors.d.ts.map +1 -1
- package/types/core/kel/delegation-ancestry.d.ts.map +1 -1
- package/types/core/kel/eventing.d.ts.map +1 -1
- package/types/core/kel/kever-decisions.d.ts +3 -1
- package/types/core/kel/kever-decisions.d.ts.map +1 -1
- package/types/core/kel/kever.d.ts +7 -1
- package/types/core/kel/kever.d.ts.map +1 -1
- package/types/core/mailbox/kram-policy.d.ts +6 -0
- package/types/core/mailbox/kram-policy.d.ts.map +1 -1
- package/types/core/mailbox/kram-pruning.d.ts +5 -1
- package/types/core/mailbox/kram-pruning.d.ts.map +1 -1
- package/types/core/mailbox/kram-time.d.ts +26 -2
- package/types/core/mailbox/kram-time.d.ts.map +1 -1
- package/types/core/mailbox/kraming.d.ts +14 -1
- package/types/core/mailbox/kraming.d.ts.map +1 -1
- package/types/core/routing.d.ts +3 -7
- package/types/core/routing.d.ts.map +1 -1
- package/types/core/scheming.d.ts.map +1 -1
- package/types/core/wire-fields.d.ts +56 -0
- package/types/core/wire-fields.d.ts.map +1 -0
- package/types/db/basing.d.ts.map +1 -1
- package/types/db/core/dber.d.ts +5 -0
- package/types/db/core/dber.d.ts.map +1 -1
- package/types/db/core/indexeddb-persistence.d.ts +3 -2
- package/types/db/core/indexeddb-persistence.d.ts.map +1 -1
- package/types/db/core/lmdber.d.ts +6 -0
- package/types/db/core/lmdber.d.ts.map +1 -1
- package/types/db/core/memstore.d.ts +2 -0
- package/types/db/core/memstore.d.ts.map +1 -1
- package/types/db/core/store-owner.d.ts +2 -0
- package/types/db/core/store-owner.d.ts.map +1 -1
- package/types/db/core/webdber.d.ts +32 -6
- package/types/db/core/webdber.d.ts.map +1 -1
- package/types/db/exchange/exchange-records.d.ts +4 -0
- package/types/db/exchange/exchange-records.d.ts.map +1 -1
- package/types/db/mailbox/mailboxing.d.ts +10 -1
- package/types/db/mailbox/mailboxing.d.ts.map +1 -1
- package/types/db/subing.d.ts +2 -0
- package/types/db/subing.d.ts.map +1 -1
- package/types/runtime/index.d.ts +20 -14
- package/types/runtime/index.d.ts.map +1 -1
- package/types/time/mod.d.ts +2 -0
- package/types/time/mod.d.ts.map +1 -1
- package/types/vdr/credential-tsn-record.d.ts.map +1 -1
- package/types/vdr/eventing.d.ts.map +1 -1
- package/types/vdr/registry-tsn-record.d.ts.map +1 -1
- package/types/version.d.ts +2 -2
- package/esm/keri/npm/src/app/runtime/signer-conditions.js +0 -51
- package/types/app/runtime/signer-conditions.d.ts +0 -32
- package/types/app/runtime/signer-conditions.d.ts.map +0 -1
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
|
|
2
|
+
if (!Object.hasOwn) {
|
|
3
|
+
Object.defineProperty(Object, "hasOwn", {
|
|
4
|
+
value: function (object, property) {
|
|
5
|
+
if (object == null) {
|
|
6
|
+
throw new TypeError("Cannot convert undefined or null to object");
|
|
7
|
+
}
|
|
8
|
+
return Object.prototype.hasOwnProperty.call(Object(object), property);
|
|
9
|
+
},
|
|
10
|
+
configurable: true,
|
|
11
|
+
enumerable: false,
|
|
12
|
+
writable: true,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
1
15
|
function findLastIndex(self, callbackfn, that) {
|
|
2
16
|
const boundFunc = that === undefined ? callbackfn : callbackfn.bind(that);
|
|
3
17
|
let index = self.length - 1;
|
|
@@ -34,18 +48,4 @@ if (!Uint8Array.prototype.findLast) {
|
|
|
34
48
|
return findLast(this, callbackfn, that);
|
|
35
49
|
};
|
|
36
50
|
}
|
|
37
|
-
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
|
|
38
|
-
if (!Object.hasOwn) {
|
|
39
|
-
Object.defineProperty(Object, "hasOwn", {
|
|
40
|
-
value: function (object, property) {
|
|
41
|
-
if (object == null) {
|
|
42
|
-
throw new TypeError("Cannot convert undefined or null to object");
|
|
43
|
-
}
|
|
44
|
-
return Object.prototype.hasOwnProperty.call(Object(object), property);
|
|
45
|
-
},
|
|
46
|
-
configurable: true,
|
|
47
|
-
enumerable: false,
|
|
48
|
-
writable: true,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
51
|
export {};
|
|
@@ -202,6 +202,25 @@ export class RegistryStore {
|
|
|
202
202
|
const said = this.seqSaider(regk, sn);
|
|
203
203
|
return said ? this.event(said.qb64) : null;
|
|
204
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Registry identifiers with an accepted head, in key order: a scan of `heds.`. With `issuer`, only those whose
|
|
207
|
+
* accepted inception (`rip` at ordinal 0) names that issuer. Local aliases (`regs.`) play no part, so this also
|
|
208
|
+
* lists registries a store learned from others, such as a group registry a co-member incepted.
|
|
209
|
+
*/
|
|
210
|
+
registries(issuer) {
|
|
211
|
+
const found = [];
|
|
212
|
+
for (const [keys] of this.baser.heads.getTopItemIter()) {
|
|
213
|
+
const regk = String(keys[0]);
|
|
214
|
+
if (issuer === undefined) {
|
|
215
|
+
found.push(regk);
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
const rip = this.seqEvent(regk, 0);
|
|
219
|
+
if (rip?.ilk === Ilks.rip && rip.issuer === issuer)
|
|
220
|
+
found.push(regk);
|
|
221
|
+
}
|
|
222
|
+
return found;
|
|
223
|
+
}
|
|
205
224
|
/** Publish caller-approved storage markers; validation and duplicate/head policy belong to the engine. */
|
|
206
225
|
accept(regk, sn, serder) {
|
|
207
226
|
sn = registryOrdinal(sn);
|
|
@@ -641,6 +641,10 @@ export class RegistryRoot {
|
|
|
641
641
|
throw new RootUnverified(error.message, { cause: error });
|
|
642
642
|
throw error;
|
|
643
643
|
}
|
|
644
|
+
// The recipient's key opens the box; without its signer the copy stays pending until the host holds it.
|
|
645
|
+
if (!hab.mgr.hasSigner(hab.kever.verfers[0].qb64)) {
|
|
646
|
+
throw new RootUnverified("the recipient's signer is not held; the copy stays pending until it is");
|
|
647
|
+
}
|
|
644
648
|
let plain;
|
|
645
649
|
try {
|
|
646
650
|
const opened = hab.mgr.open(essr, hab.kever.verfers[0]);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { call, scoped } from "effection";
|
|
2
2
|
import { persistResolvedContact } from "../identity/organizing.js";
|
|
3
|
-
import {
|
|
3
|
+
import { doEveryOnWrite, PROTOCOL_PACING } from "../runtime/doing.js";
|
|
4
4
|
import { systemClock } from "../runtime/runtime-clock.js";
|
|
5
|
-
import {
|
|
5
|
+
import { isRequestableHttpUrl } from "../transport/http-client.js";
|
|
6
|
+
import { isWellKnownOobiUrl, oobiJobFailure, parseOobiUrl } from "./oobiery.js";
|
|
6
7
|
/**
|
|
7
8
|
* Return true when a well-known URL has been authorized into `wkas.`.
|
|
8
9
|
*
|
|
@@ -70,7 +71,7 @@ export class Authenticator {
|
|
|
70
71
|
}
|
|
71
72
|
/** Continuous auth doer for long-lived runtime hosts. */
|
|
72
73
|
*authDo(clock = systemClock, pacing = PROTOCOL_PACING) {
|
|
73
|
-
return yield*
|
|
74
|
+
return yield* doEveryOnWrite(clock, pacing, this.hby.db, () => this.processOnce());
|
|
74
75
|
}
|
|
75
76
|
/** Promote one eligible `woobi.` record into the fetchable `mfa.` queue. */
|
|
76
77
|
promoteQueuedWellKnown() {
|
|
@@ -118,23 +119,20 @@ export class Authenticator {
|
|
|
118
119
|
return null;
|
|
119
120
|
}
|
|
120
121
|
/**
|
|
121
|
-
* Fetch one `mfa.` record and persist the terminal auth result.
|
|
122
|
+
* Fetch one `mfa.` record and persist the terminal auth result. A URL the HTTP client refuses, a refused or failed
|
|
123
|
+
* request, or a non-OK status each end this authentication as failed in `rmfa.` and remove its `mfa.` row, so the
|
|
124
|
+
* next pass takes the next one; any other error is a fault and propagates.
|
|
122
125
|
*
|
|
123
126
|
* @param url Exact pending well-known authentication URL.
|
|
124
127
|
* @param record Durable mfa record retained until response handling and cleanup establish terminal state.
|
|
125
128
|
*/
|
|
126
129
|
*processPendingAuth(url, record) {
|
|
127
|
-
// Only HTTP status is needed; the response owner still joins body cleanup.
|
|
128
130
|
const cid = record.cid
|
|
129
131
|
?? parseOobiUrl(url, record.oobialias ?? undefined).cid
|
|
130
132
|
?? null;
|
|
131
|
-
const
|
|
132
|
-
const response = yield* scoped(function* () {
|
|
133
|
-
const response = yield* http.open(url);
|
|
134
|
-
return { ok: response.ok, status: response.status };
|
|
135
|
-
});
|
|
133
|
+
const state = yield* this.authenticate(url);
|
|
136
134
|
const date = new Date().toISOString();
|
|
137
|
-
const
|
|
135
|
+
const ok = state === "resolved";
|
|
138
136
|
this.hby.db.mfa.rem(url);
|
|
139
137
|
this.hby.db.rmfa.pin(url, {
|
|
140
138
|
...record,
|
|
@@ -142,7 +140,7 @@ export class Authenticator {
|
|
|
142
140
|
state,
|
|
143
141
|
cid,
|
|
144
142
|
});
|
|
145
|
-
if (
|
|
143
|
+
if (ok && cid) {
|
|
146
144
|
this.hby.db.wkas.add(cid, { url, dt: date });
|
|
147
145
|
persistResolvedContact(this.hby, cid, {
|
|
148
146
|
alias: record.oobialias,
|
|
@@ -150,4 +148,28 @@ export class Authenticator {
|
|
|
150
148
|
});
|
|
151
149
|
}
|
|
152
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Request one well-known URL and read only its status; the response owner still joins body cleanup.
|
|
153
|
+
*
|
|
154
|
+
* @param url Pending well-known authentication URL.
|
|
155
|
+
* @returns The terminal state: `resolved` for an OK status, `http-<status>` otherwise, or the
|
|
156
|
+
* {@link OobiJobFailure} of a URL the client refuses or a refused or failed request.
|
|
157
|
+
*/
|
|
158
|
+
*authenticate(url) {
|
|
159
|
+
if (!isRequestableHttpUrl(url))
|
|
160
|
+
return "url-refused";
|
|
161
|
+
const http = this.http;
|
|
162
|
+
try {
|
|
163
|
+
return yield* scoped(function* () {
|
|
164
|
+
const response = yield* http.open(url);
|
|
165
|
+
return response.ok ? "resolved" : `http-${response.status}`;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
const failure = oobiJobFailure(error);
|
|
170
|
+
if (failure === null)
|
|
171
|
+
throw error;
|
|
172
|
+
return failure;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
153
175
|
}
|