@fedify/fedify 2.4.0-dev.2056 → 2.4.0-dev.2065

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.
Files changed (71) hide show
  1. package/dist/{builder-D_XU_Fw2.mjs → builder-CMkrnYbY.mjs} +2 -2
  2. package/dist/compat/transformers.test.mjs +1 -1
  3. package/dist/{compound-proof-CwTySDnn.mjs → compound-proof-Dj3DCsoj.mjs} +1 -1
  4. package/dist/{deno-BtpLWN2L.mjs → deno-BuRFI7wk.mjs} +1 -1
  5. package/dist/{docloader-CJADEtqb.mjs → docloader-_aSNLA90.mjs} +2 -2
  6. package/dist/federation/builder.test.mjs +1 -1
  7. package/dist/federation/compound-fanout.test.mjs +3 -3
  8. package/dist/federation/handler-compound-proof.test.mjs +3 -3
  9. package/dist/federation/handler.test.mjs +5 -5
  10. package/dist/federation/hashlink-media.test.mjs +2 -2
  11. package/dist/federation/idempotency.test.mjs +2 -2
  12. package/dist/federation/metrics.test.mjs +1 -1
  13. package/dist/federation/middleware.test.mjs +7 -7
  14. package/dist/federation/mod.cjs +1 -1
  15. package/dist/federation/mod.js +1 -1
  16. package/dist/federation/outgoing-proof.test.mjs +5 -5
  17. package/dist/federation/portable.test.mjs +3 -3
  18. package/dist/federation/send.test.mjs +3 -3
  19. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  20. package/dist/federation/tasks/tasks.test.mjs +2 -2
  21. package/dist/federation/temporal.test.mjs +1 -1
  22. package/dist/federation/webfinger.test.mjs +1 -1
  23. package/dist/{federation-DDwszIrk.cjs → federation-Coi_bg12.cjs} +3 -3
  24. package/dist/{http-DW5mt8FG.cjs → http-BGShIsd6.cjs} +1 -1
  25. package/dist/{http-CotELN-4.mjs → http-f1qaBtOh.mjs} +3 -3
  26. package/dist/{http-iLCx9vk-.js → http-z5n7chWw.js} +1 -1
  27. package/dist/{key-DrCNkH3Y.mjs → key-BxHsA1s9.mjs} +2 -2
  28. package/dist/{kv-cache-a1ghEA4h.mjs → kv-cache-C9IY-FMN.mjs} +1 -1
  29. package/dist/{kv-cache-LOyq_Ty6.cjs → kv-cache-CY6pDNoS.cjs} +1 -1
  30. package/dist/{kv-cache-bXLDSaRu.js → kv-cache-Cgj-kpQS.js} +1 -1
  31. package/dist/{ld-BPG92sC0.mjs → ld-CqJq5erX.mjs} +3 -3
  32. package/dist/{metrics-DxVi0UJD.mjs → metrics-DOqknlZd.mjs} +1 -1
  33. package/dist/{middleware-1nes8_U-.js → middleware-1h_LgwXC.js} +3 -3
  34. package/dist/{middleware-BIPftTly.mjs → middleware-VOCZN3SO.mjs} +1 -1
  35. package/dist/{middleware-DohUu-Tz.mjs → middleware-s-AZzx4r.mjs} +13 -13
  36. package/dist/{mod-CNRAxXEb.d.ts → mod-Dhm7SqyE.d.ts} +150 -2
  37. package/dist/{mod-CVQFWefn.d.cts → mod-pLbeNwcC.d.cts} +150 -2
  38. package/dist/mod.cjs +6 -5
  39. package/dist/mod.d.cts +3 -3
  40. package/dist/mod.d.ts +3 -3
  41. package/dist/mod.js +6 -6
  42. package/dist/nodeinfo/handler.test.mjs +1 -1
  43. package/dist/{owner-SBgt2USF.js → owner-BLBWXCNt.js} +29 -3
  44. package/dist/{owner-C2ER4VD7.cjs → owner-D8ZpRusc.cjs} +34 -2
  45. package/dist/{owner-BN7Mqjso.mjs → owner-D_F22lfM.mjs} +2 -2
  46. package/dist/{proof-BigVZwkl.mjs → proof-B03JXhrk.mjs} +32 -6
  47. package/dist/{send-CvatEhyY.mjs → send-NNkfKtVN.mjs} +3 -3
  48. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  49. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  50. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  51. package/dist/sig/compound-proof.test.mjs +2 -2
  52. package/dist/sig/http.test.mjs +2 -2
  53. package/dist/sig/key.test.mjs +1 -1
  54. package/dist/sig/ld.test.mjs +2 -2
  55. package/dist/sig/mod.cjs +4 -2
  56. package/dist/sig/mod.d.cts +2 -2
  57. package/dist/sig/mod.d.ts +2 -2
  58. package/dist/sig/mod.js +4 -3
  59. package/dist/sig/owner.test.mjs +1 -1
  60. package/dist/sig/portable-collection.test.d.mts +2 -0
  61. package/dist/sig/portable-collection.test.mjs +1044 -0
  62. package/dist/sig/proof.test.mjs +3 -3
  63. package/dist/sig-B1E2uyhQ.cjs +405 -0
  64. package/dist/sig-Bb20Pyrd.js +401 -0
  65. package/dist/{temporal-DV5jeBbR.mjs → temporal-VVVSuruq.mjs} +1 -1
  66. package/dist/testing/kv.test.mjs +1 -1
  67. package/dist/utils/docloader.test.mjs +2 -2
  68. package/dist/utils/kv-cache.test.mjs +1 -1
  69. package/dist/utils/mod.cjs +1 -1
  70. package/dist/utils/mod.js +1 -1
  71. package/package.json +6 -6
@@ -9,11 +9,11 @@ import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
9
9
  import "../std__assert-DvMDRPes.mjs";
10
10
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
11
11
  import { t as assert } from "../assert-D1Eafmd_.mjs";
12
- import { l as verifyRequest } from "../http-CotELN-4.mjs";
12
+ import { l as verifyRequest } from "../http-f1qaBtOh.mjs";
13
13
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
14
- import { t as getAuthenticatedDocumentLoader } from "../docloader-CJADEtqb.mjs";
14
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-_aSNLA90.mjs";
15
15
  import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
16
- import { a as verifyObject, c as verifyProof, n as hasProofLike, o as verifyPortableObjectProof, r as signObject, t as createProof } from "../proof-BigVZwkl.mjs";
16
+ import { a as verifyObject, l as verifyProof, n as hasProofLike, o as verifyPortableObjectProof, r as signObject, t as createProof } from "../proof-B03JXhrk.mjs";
17
17
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place, Translation } from "@fedify/vocab";
18
18
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
19
19
  import { decodeMultibase, encodeMultibase, exportDidKey, exportMultibaseKey, formatIri, importMultibaseKey, parseIri } from "@fedify/vocab-runtime";
@@ -0,0 +1,405 @@
1
+ const { URLPattern } = require("urlpattern-polyfill");
2
+ const require_http = require("./http-BGShIsd6.cjs");
3
+ const require_owner = require("./owner-D8ZpRusc.cjs");
4
+ let _logtape_logtape = require("@logtape/logtape");
5
+ let _fedify_vocab = require("@fedify/vocab");
6
+ let _opentelemetry_api = require("@opentelemetry/api");
7
+ let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
8
+ let _fedify_vocab_runtime_internal_portable_dereference = require("@fedify/vocab-runtime/internal/portable-dereference");
9
+ //#region src/sig/portable-collection.ts
10
+ const logger = (0, _logtape_logtape.getLogger)([
11
+ "fedify",
12
+ "sig",
13
+ "proof"
14
+ ]);
15
+ const AS_NAMESPACE = "https://www.w3.org/ns/activitystreams#";
16
+ const AS_ATTRIBUTED_TO = `${AS_NAMESPACE}attributedTo`;
17
+ const AS_PART_OF = `${AS_NAMESPACE}partOf`;
18
+ /**
19
+ * The properties through which a collection refers to its pages, and a page
20
+ * to other pages of the same collection.
21
+ */
22
+ const PAGING_PROPERTIES = new Set([
23
+ "first",
24
+ "last",
25
+ "current",
26
+ "next",
27
+ "prev"
28
+ ].map((p) => AS_NAMESPACE + p));
29
+ /**
30
+ * The properties through which an actor refers to its own collections.
31
+ */
32
+ const ACTOR_COLLECTION_PROPERTIES = /* @__PURE__ */ new Set([
33
+ "http://www.w3.org/ns/ldp#inbox",
34
+ `${AS_NAMESPACE}outbox`,
35
+ `${AS_NAMESPACE}followers`,
36
+ `${AS_NAMESPACE}following`,
37
+ `${AS_NAMESPACE}liked`
38
+ ]);
39
+ const contextStates = /* @__PURE__ */ new WeakMap();
40
+ function createContext(state) {
41
+ const token = Object.freeze(Object.create(null));
42
+ contextStates.set(token, state);
43
+ return token;
44
+ }
45
+ function getContextState(context) {
46
+ if (context == null || typeof context !== "object") return void 0;
47
+ return contextStates.get(context);
48
+ }
49
+ function canonicalize(id) {
50
+ try {
51
+ return (0, _fedify_vocab_runtime.canonicalizePortableUri)(typeof id === "string" ? id : (0, _fedify_vocab_runtime.formatIri)(id));
52
+ } catch (error) {
53
+ if (error instanceof TypeError) return null;
54
+ throw error;
55
+ }
56
+ }
57
+ function toUrl(canonicalId) {
58
+ return (0, _fedify_vocab_runtime.parseIri)(canonicalId);
59
+ }
60
+ function canonicalizeAll(ids) {
61
+ const result = [];
62
+ for (const id of ids) {
63
+ const canonical = canonicalize(id);
64
+ if (canonical == null) return null;
65
+ result.push(canonical);
66
+ }
67
+ return result;
68
+ }
69
+ function getExpandedIds(node, property) {
70
+ const values = node[property];
71
+ if (values == null) return [];
72
+ if (!Array.isArray(values)) return null;
73
+ const ids = [];
74
+ for (const value of values) {
75
+ if (value == null || typeof value !== "object" || Array.isArray(value) || typeof value["@id"] !== "string") return null;
76
+ ids.push(value["@id"]);
77
+ }
78
+ return ids;
79
+ }
80
+ function parseAll(ids) {
81
+ const result = [];
82
+ for (const id of ids) try {
83
+ result.push((0, _fedify_vocab_runtime.parseIri)(id));
84
+ } catch (error) {
85
+ if (error instanceof TypeError) return null;
86
+ throw error;
87
+ }
88
+ return result;
89
+ }
90
+ function describeRoot(root) {
91
+ const rawId = root["@id"];
92
+ if (typeof rawId !== "string") return null;
93
+ const id = canonicalize(rawId);
94
+ if (id == null) return null;
95
+ const partOf = getExpandedIds(root, AS_PART_OF);
96
+ const attributedTo = getExpandedIds(root, AS_ATTRIBUTED_TO);
97
+ return {
98
+ id,
99
+ url: toUrl(id),
100
+ origin: (0, _fedify_vocab_runtime.getFe34Origin)(id),
101
+ partOf: partOf == null ? null : canonicalizeAll(partOf),
102
+ attributedTo: attributedTo == null ? null : canonicalizeAll(attributedTo),
103
+ attributedToUrls: attributedTo == null ? null : parseAll(attributedTo)
104
+ };
105
+ }
106
+ function describeObject(object) {
107
+ if (!(object instanceof _fedify_vocab.Object) || object.id == null) return null;
108
+ const id = canonicalize(object.id);
109
+ if (id == null) return null;
110
+ const partOfId = object instanceof _fedify_vocab.CollectionPage ? object.partOfId : null;
111
+ return {
112
+ id,
113
+ url: toUrl(id),
114
+ origin: (0, _fedify_vocab_runtime.getFe34Origin)(id),
115
+ partOf: canonicalizeAll(partOfId == null ? [] : [partOfId]),
116
+ attributedTo: canonicalizeAll(object.attributionIds),
117
+ attributedToUrls: object.attributionIds
118
+ };
119
+ }
120
+ function fail(reason) {
121
+ return {
122
+ verified: false,
123
+ reason
124
+ };
125
+ }
126
+ /**
127
+ * Walks the referrer chain of a collection or page to find the root
128
+ * collection and its owner candidate, checking every page on the way.
129
+ */
130
+ function resolveChain(node, referrer) {
131
+ const pages = [];
132
+ let top = node;
133
+ let link = referrer;
134
+ let state;
135
+ while (link != null && PAGING_PROPERTIES.has(link.property)) {
136
+ pages.push(top);
137
+ state = getContextState(link.collectionContext);
138
+ if (state != null) break;
139
+ const parent = describeObject(link.object);
140
+ if (parent == null || link.truncated) return fail({ type: "unknownCollectionOwner" });
141
+ top = parent;
142
+ link = link.referrer;
143
+ }
144
+ let rootId;
145
+ let rootOrigin;
146
+ let candidate;
147
+ if (state != null) {
148
+ rootId = state.rootId;
149
+ rootOrigin = state.rootOrigin;
150
+ const ownerCandidate = state.owner == null ? state.ownerCandidate : { id: canonicalize(state.owner.id) };
151
+ if (ownerCandidate == null) return fail({ type: "unknownCollectionOwner" });
152
+ candidate = ownerCandidate;
153
+ } else {
154
+ rootId = top.id;
155
+ rootOrigin = top.origin;
156
+ const attributedTo = top.attributedTo;
157
+ if (attributedTo == null) return fail({ type: "unknownCollectionOwner" });
158
+ if (link != null && ACTOR_COLLECTION_PROPERTIES.has(link.property)) {
159
+ const id = link.id == null ? null : canonicalize(link.id);
160
+ if (id == null) return fail({ type: "unknownCollectionOwner" });
161
+ candidate = {
162
+ id,
163
+ object: link.object,
164
+ acceptance: link.acceptance
165
+ };
166
+ } else if (attributedTo.length === 1) candidate = {
167
+ id: attributedTo[0],
168
+ url: top.attributedToUrls?.[0]
169
+ };
170
+ else if (attributedTo.length > 1) return fail({
171
+ type: "conflictingCollectionOwners",
172
+ candidates: attributedTo.map(toUrl)
173
+ });
174
+ else return fail({ type: "unknownCollectionOwner" });
175
+ const conflict = attributedTo.find((id) => id !== candidate.id);
176
+ if (conflict != null) return fail({
177
+ type: "conflictingCollectionOwners",
178
+ candidates: [toUrl(candidate.id), toUrl(conflict)]
179
+ });
180
+ }
181
+ if ((0, _fedify_vocab_runtime.getFe34Origin)(candidate.id) !== rootOrigin) return fail({ type: "unknownCollectionOwner" });
182
+ for (const page of pages) {
183
+ if (page.origin !== rootOrigin) return fail({
184
+ type: "collectionPageMismatch",
185
+ pageId: page.url,
186
+ collectionId: toUrl(rootId),
187
+ partOf: null
188
+ });
189
+ if (page.partOf == null) return fail({ type: "unknownCollectionOwner" });
190
+ const partOf = page.partOf.find((id) => id !== rootId);
191
+ if (partOf != null) return fail({
192
+ type: "collectionPageMismatch",
193
+ pageId: page.url,
194
+ collectionId: toUrl(rootId),
195
+ partOf: toUrl(partOf)
196
+ });
197
+ if (page.attributedTo == null) return fail({ type: "unknownCollectionOwner" });
198
+ const conflict = page.attributedTo.find((id) => id !== candidate.id);
199
+ if (conflict != null) return fail({
200
+ type: "conflictingCollectionOwners",
201
+ candidates: [toUrl(candidate.id), toUrl(conflict)]
202
+ });
203
+ }
204
+ return {
205
+ rootId,
206
+ rootOrigin,
207
+ owner: state?.owner ?? null,
208
+ candidate
209
+ };
210
+ }
211
+ function getActorCollectionIds(actor) {
212
+ const ids = [];
213
+ for (const id of [
214
+ actor.inboxId,
215
+ actor.outboxId,
216
+ actor.followersId,
217
+ actor.followingId,
218
+ actor.likedId
219
+ ]) {
220
+ if (id == null) continue;
221
+ const canonical = canonicalize(id);
222
+ if (canonical != null) ids.push(canonical);
223
+ }
224
+ return ids;
225
+ }
226
+ async function fetchOwner(candidate, options) {
227
+ const documentLoader = options.documentLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)();
228
+ const contextLoader = options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)();
229
+ const tracerProvider = options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
230
+ const tracer = tracerProvider.getTracer(require_http.name, require_http.version);
231
+ const gateways = options.gateways ?? ((0, _fedify_vocab_runtime_internal_portable_dereference.getPortableGatewayCandidates)(candidate).length > 0 ? void 0 : options.gatewayHints);
232
+ const span = tracer.startSpan("activitypub.lookup_object");
233
+ try {
234
+ const object = await (0, _fedify_vocab_runtime_internal_portable_dereference.dereferencePortableIri)(candidate, {
235
+ documentLoader,
236
+ contextLoader,
237
+ tracerProvider,
238
+ gateways,
239
+ verifyPortableObject: (document, verifierOptions) => require_owner.verifyPortableObjectProof(document, {
240
+ ...options,
241
+ ...verifierOptions
242
+ }),
243
+ suppressError: true,
244
+ span,
245
+ parse: (document, parseOptions) => _fedify_vocab.Object.fromJsonLd(document, {
246
+ documentLoader,
247
+ contextLoader: parseOptions.contextLoader,
248
+ tracerProvider,
249
+ baseUrl: parseOptions.baseUrl
250
+ })
251
+ });
252
+ return (0, _fedify_vocab.isActor)(object) ? object : null;
253
+ } catch (error) {
254
+ logger.debug("Failed to fetch the owner {owner} of a portable collection: {error}", {
255
+ owner: (0, _fedify_vocab_runtime.formatIri)(candidate),
256
+ error
257
+ });
258
+ return null;
259
+ } finally {
260
+ span.end();
261
+ }
262
+ }
263
+ async function resolveOwner(chain, options) {
264
+ if (chain.owner != null) return chain.owner;
265
+ const { candidate } = chain;
266
+ const candidateUrl = toUrl(candidate.id);
267
+ let actor = null;
268
+ if (candidate.acceptance === "verified" && (0, _fedify_vocab.isActor)(candidate.object) && candidate.object.id != null && canonicalize(candidate.object.id) === candidate.id) actor = candidate.object;
269
+ else actor = await fetchOwner(candidate.url ?? (candidate.object instanceof _fedify_vocab.Object && candidate.object.id != null ? candidate.object.id : candidateUrl), options);
270
+ if (actor == null || actor.id == null) return fail({
271
+ type: "collectionOwnerUnavailable",
272
+ owner: candidateUrl
273
+ });
274
+ const gateways = actor.gateways;
275
+ if (gateways.length < 1) return fail({
276
+ type: "collectionOwnerUnavailable",
277
+ owner: candidateUrl
278
+ });
279
+ if (!getActorCollectionIds(actor).includes(chain.rootId)) return fail({
280
+ type: "collectionNotListedByOwner",
281
+ owner: candidateUrl,
282
+ collectionId: toUrl(chain.rootId)
283
+ });
284
+ return {
285
+ id: candidateUrl,
286
+ gateways
287
+ };
288
+ }
289
+ function getSourceGateway(node, documentUrl) {
290
+ if (documentUrl == null || documentUrl.protocol !== "http:" && documentUrl.protocol !== "https:") return null;
291
+ let portableId;
292
+ try {
293
+ portableId = (0, _fedify_vocab_runtime.fromCompatibleEf61Id)(documentUrl);
294
+ } catch (error) {
295
+ if (error instanceof TypeError) return null;
296
+ throw error;
297
+ }
298
+ if (portableId == null || canonicalize(portableId) !== node.id) return null;
299
+ return new URL(documentUrl.origin);
300
+ }
301
+ /**
302
+ * Applies the [FEP-ef61] trust policy to a portable object fetched through
303
+ * a gateway.
304
+ *
305
+ * Portable actors, activities, objects, and collections with proofs are
306
+ * verified by {@link verifyPortableObjectProof}. A portable collection or
307
+ * collection page without a proof is accepted only if all of the following
308
+ * hold:
309
+ *
310
+ * - It was retrieved from a gateway: its final URL (`documentUrl`) is
311
+ * a compatible identifier for the same portable collection.
312
+ * - Its owner is determined unambiguously: the actor whose `inbox`,
313
+ * `outbox`, `followers`, `following`, or `liked` property referred to
314
+ * the collection, or the single actor in its `attributedTo`. A page
315
+ * inherits the owner of the collection it was reached from through
316
+ * `first`, `last`, `current`, `next`, or `prev`, and must not name
317
+ * another collection in `partOf`.
318
+ * - The owner's actor document is verified by its proof and lists the
319
+ * collection as its `inbox`, `outbox`, `followers`, `following`, or
320
+ * `liked`.
321
+ * - The gateway that served the collection is in the owner's `gateways`.
322
+ *
323
+ * Where the document came from and which object referred to it are passed
324
+ * by property accessors when this function is used as their
325
+ * `verifyPortableObject` option. Objects embedded in an unsecured
326
+ * collection accepted this way are not trusted: accessors dereference and
327
+ * verify them one by one.
328
+ *
329
+ * Note that acceptance through the gateway policy does not verify anything
330
+ * cryptographically; it only means that the owner trusts the gateway.
331
+ *
332
+ * [FEP-ef61]: https://w3id.org/fep/ef61
333
+ *
334
+ * @param jsonLd The JSON-LD document to verify.
335
+ * @param options Additional options. See also
336
+ * {@link VerifyPortableObjectOptions}.
337
+ * @returns The detailed result.
338
+ * @throws {TypeError} If the input is not a single JSON-LD object or has a
339
+ * malformed portable ID.
340
+ * @since 2.4.0
341
+ */
342
+ async function verifyPortableObject(jsonLd, options = {}) {
343
+ const { result, root, objectType } = await require_owner.verifyPortableObjectProofWithRoot(jsonLd, options);
344
+ if (result.verified) {
345
+ const node = objectType === "collection" && root != null ? describeRoot(root) : null;
346
+ const chain = node == null ? null : resolveChain(node, options.referrer);
347
+ if (chain == null || !("rootId" in chain)) return {
348
+ verified: true,
349
+ method: "proof",
350
+ keys: result.keys
351
+ };
352
+ return {
353
+ verified: true,
354
+ method: "proof",
355
+ keys: result.keys,
356
+ collectionContext: createContext({
357
+ rootId: chain.rootId,
358
+ rootOrigin: chain.rootOrigin,
359
+ owner: chain.owner,
360
+ ownerCandidate: chain.candidate
361
+ })
362
+ };
363
+ }
364
+ if (result.reason.type !== "unsecuredCollection") return {
365
+ verified: false,
366
+ reason: result.reason
367
+ };
368
+ const node = root == null ? null : describeRoot(root);
369
+ if (node == null) return fail({ type: "unknownCollectionOwner" });
370
+ const gateway = getSourceGateway(node, options.documentUrl);
371
+ if (gateway == null) return fail({
372
+ type: "unknownCollectionSource",
373
+ documentUrl: options.documentUrl ?? null
374
+ });
375
+ const chain = resolveChain(node, options.referrer);
376
+ if (!("rootId" in chain)) return chain;
377
+ const owner = await resolveOwner(chain, options);
378
+ if (!("gateways" in owner)) return owner;
379
+ if (!owner.gateways.some((g) => g.origin === gateway.origin)) return fail({
380
+ type: "untrustedGateway",
381
+ owner: owner.id,
382
+ gateway,
383
+ gateways: owner.gateways
384
+ });
385
+ return {
386
+ verified: true,
387
+ method: "gateway",
388
+ unsecured: true,
389
+ owner: owner.id,
390
+ gateway,
391
+ collectionContext: createContext({
392
+ rootId: chain.rootId,
393
+ rootOrigin: chain.rootOrigin,
394
+ owner,
395
+ ownerCandidate: null
396
+ })
397
+ };
398
+ }
399
+ //#endregion
400
+ Object.defineProperty(exports, "verifyPortableObject", {
401
+ enumerable: true,
402
+ get: function() {
403
+ return verifyPortableObject;
404
+ }
405
+ });