@fedify/vocab-runtime 2.4.0-dev.2056 → 2.4.0-dev.2063
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/deno.json +1 -1
- package/dist/internal/portable-dereference.cjs +176 -1
- package/dist/internal/portable-dereference.d.cts +94 -2
- package/dist/internal/portable-dereference.d.ts +94 -2
- package/dist/internal/portable-dereference.js +171 -3
- package/dist/mod.cjs +1 -1
- package/dist/mod.d.cts +2 -2
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +1 -1
- package/dist/portable--NcyA1R_.d.ts +156 -0
- package/dist/portable-BykOD45s.d.cts +156 -0
- package/dist/tests/{body-wkL-XGhe.mjs → body-BN5x-zDQ.mjs} +1 -1
- package/dist/tests/{body-h9zUR79f.cjs → body-CTGqQhNI.cjs} +1 -1
- package/dist/tests/body.test.cjs +1 -1
- package/dist/tests/body.test.mjs +1 -1
- package/dist/tests/decimal.test.cjs +1 -1
- package/dist/tests/decimal.test.mjs +1 -1
- package/dist/tests/{docloader-DMGssPEX.mjs → docloader-BFxwbqMx.mjs} +2 -2
- package/dist/tests/{docloader-CBLgaVPd.cjs → docloader-JGSpG-3l.cjs} +2 -2
- package/dist/tests/docloader.test.cjs +2 -2
- package/dist/tests/docloader.test.mjs +2 -2
- package/dist/tests/{request-Ytm0xyZH.mjs → request-BT9FBhk6.mjs} +1 -1
- package/dist/tests/{request-ClFs0ePp.cjs → request-jWhPNG9V.cjs} +1 -1
- package/dist/tests/request.test.cjs +1 -1
- package/dist/tests/request.test.mjs +1 -1
- package/package.json +1 -1
- package/src/internal/portable-dereference.ts +251 -2
- package/src/mod.ts +2 -0
- package/src/portable.ts +132 -8
- package/dist/portable-CduElToy.d.ts +0 -52
- package/dist/portable-DxF2Ut-Z.d.cts +0 -52
package/dist/mod.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { a as DocumentLoaderOptions, c as getDocumentLoader, d as FetchError, f as GetUserAgentOptions, h as logRequest, i as DocumentLoaderFactoryOptions, l as getRemoteDocument, m as getUserAgent, n as DocumentLoader, o as GetDocumentLoaderOptions, p as createActivityPubRequest, r as DocumentLoaderFactory, s as RemoteDocument, t as AuthenticatedDocumentLoaderFactory, u as CreateRequestOptions } from "./docloader-Dr8wEkif.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as PortableObjectVerifierOptions, n as PortableObjectVerification, r as PortableObjectVerifier, t as PortableObjectReferrer } from "./portable-BykOD45s.cjs";
|
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/contexts.d.ts
|
|
@@ -547,4 +547,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
|
|
|
547
547
|
declare function isValidPublicIPv6Address(address: string): boolean;
|
|
548
548
|
declare function expandIPv6Address(address: string): string;
|
|
549
549
|
//#endregion
|
|
550
|
-
export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type ParsedDigestMultibase, type ParsedHashlink, type PortableObjectVerifier, type PortableObjectVerifierOptions, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, computeDigestMultibase, createActivityPubRequest, createHashlink, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isGatewayUrl, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseDigestMultibase, parseGatewayUrl, parseHashlink, parseIri, parseJsonLdId, preloadedContexts, toCompatibleEf61Id, validatePublicUrl, verifyDigestMultibase, verifyHashlink };
|
|
550
|
+
export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type ParsedDigestMultibase, type ParsedHashlink, type PortableObjectReferrer, type PortableObjectVerification, type PortableObjectVerifier, type PortableObjectVerifierOptions, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, computeDigestMultibase, createActivityPubRequest, createHashlink, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isGatewayUrl, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseDigestMultibase, parseGatewayUrl, parseHashlink, parseIri, parseJsonLdId, preloadedContexts, toCompatibleEf61Id, validatePublicUrl, verifyDigestMultibase, verifyHashlink };
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { a as DocumentLoaderOptions, c as getDocumentLoader, d as FetchError, f as GetUserAgentOptions, h as logRequest, i as DocumentLoaderFactoryOptions, l as getRemoteDocument, m as getUserAgent, n as DocumentLoader, o as GetDocumentLoaderOptions, p as createActivityPubRequest, r as DocumentLoaderFactory, s as RemoteDocument, t as AuthenticatedDocumentLoaderFactory, u as CreateRequestOptions } from "./docloader-Dr8wEkif.js";
|
|
3
|
-
import {
|
|
3
|
+
import { i as PortableObjectVerifierOptions, n as PortableObjectVerification, r as PortableObjectVerifier, t as PortableObjectReferrer } from "./portable--NcyA1R_.js";
|
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
//#region src/contexts.d.ts
|
|
6
6
|
declare const preloadedContexts: Record<string, unknown>;
|
|
@@ -546,4 +546,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
|
|
|
546
546
|
declare function isValidPublicIPv6Address(address: string): boolean;
|
|
547
547
|
declare function expandIPv6Address(address: string): string;
|
|
548
548
|
//#endregion
|
|
549
|
-
export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type ParsedDigestMultibase, type ParsedHashlink, type PortableObjectVerifier, type PortableObjectVerifierOptions, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, computeDigestMultibase, createActivityPubRequest, createHashlink, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isGatewayUrl, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseDigestMultibase, parseGatewayUrl, parseHashlink, parseIri, parseJsonLdId, preloadedContexts, toCompatibleEf61Id, validatePublicUrl, verifyDigestMultibase, verifyHashlink };
|
|
549
|
+
export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type ParsedDigestMultibase, type ParsedHashlink, type PortableObjectReferrer, type PortableObjectVerification, type PortableObjectVerifier, type PortableObjectVerifierOptions, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, computeDigestMultibase, createActivityPubRequest, createHashlink, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isGatewayUrl, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseDigestMultibase, parseGatewayUrl, parseHashlink, parseIri, parseJsonLdId, preloadedContexts, toCompatibleEf61Id, validatePublicUrl, verifyDigestMultibase, verifyHashlink };
|
package/dist/mod.js
CHANGED
|
@@ -12,7 +12,7 @@ import { PublicKeyInfo } from "pkijs";
|
|
|
12
12
|
import baseX from "@multiformats/base-x";
|
|
13
13
|
//#region deno.json
|
|
14
14
|
var name = "@fedify/vocab-runtime";
|
|
15
|
-
var version = "2.4.0-dev.
|
|
15
|
+
var version = "2.4.0-dev.2063+366c0362";
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/request.ts
|
|
18
18
|
/**
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
import { n as DocumentLoader } from "./docloader-Dr8wEkif.js";
|
|
3
|
+
import { TracerProvider } from "@opentelemetry/api";
|
|
4
|
+
|
|
5
|
+
//#region src/portable.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Options passed to a {@link PortableObjectVerifier}.
|
|
8
|
+
* @since 2.4.0
|
|
9
|
+
*/
|
|
10
|
+
interface PortableObjectVerifierOptions {
|
|
11
|
+
/**
|
|
12
|
+
* The document loader for fetching remote documents, such as verification
|
|
13
|
+
* methods that are not `did:key` URLs.
|
|
14
|
+
*/
|
|
15
|
+
readonly documentLoader?: DocumentLoader;
|
|
16
|
+
/**
|
|
17
|
+
* The document loader for fetching remote JSON-LD contexts. During
|
|
18
|
+
* gateway dereferencing, this loader returns the same context documents
|
|
19
|
+
* that the vocabulary parser sees.
|
|
20
|
+
*/
|
|
21
|
+
readonly contextLoader?: DocumentLoader;
|
|
22
|
+
/**
|
|
23
|
+
* The OpenTelemetry tracer provider.
|
|
24
|
+
*/
|
|
25
|
+
readonly tracerProvider?: TracerProvider;
|
|
26
|
+
/**
|
|
27
|
+
* The URL the document was finally retrieved from, i.e., the `documentUrl`
|
|
28
|
+
* of the document loader's result, which may differ from the requested URL
|
|
29
|
+
* after redirects. Trust decisions such as the [FEP-ef61] gateway trust
|
|
30
|
+
* policy for unsecured collections depend on it, so custom document loaders
|
|
31
|
+
* must report it truthfully.
|
|
32
|
+
*
|
|
33
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
34
|
+
* @since 2.4.0
|
|
35
|
+
*/
|
|
36
|
+
readonly documentUrl?: URL;
|
|
37
|
+
/**
|
|
38
|
+
* The gateways that the caller explicitly passed to the accessor through
|
|
39
|
+
* its `gateways` option, in order. It is `undefined` if the caller did not
|
|
40
|
+
* pass the option, and can be empty.
|
|
41
|
+
* @since 2.4.0
|
|
42
|
+
*/
|
|
43
|
+
readonly gateways?: readonly URL[];
|
|
44
|
+
/**
|
|
45
|
+
* The gateways taken from the `@gateway` location hints of the reference,
|
|
46
|
+
* in order, when the caller did not pass the `gateways` option.
|
|
47
|
+
* @since 2.4.0
|
|
48
|
+
*/
|
|
49
|
+
readonly gatewayHints?: readonly URL[];
|
|
50
|
+
/**
|
|
51
|
+
* The object whose property referred to the document, if the document was
|
|
52
|
+
* dereferenced through a property accessor.
|
|
53
|
+
* @since 2.4.0
|
|
54
|
+
*/
|
|
55
|
+
readonly referrer?: PortableObjectReferrer;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* An object whose property referred to a portable object being verified.
|
|
59
|
+
* Referrers form a chain: {@link PortableObjectReferrer.referrer} is the
|
|
60
|
+
* object through which this referrer itself was obtained, and so on.
|
|
61
|
+
* @since 2.4.0
|
|
62
|
+
*/
|
|
63
|
+
interface PortableObjectReferrer {
|
|
64
|
+
/**
|
|
65
|
+
* The referring vocabulary object.
|
|
66
|
+
*/
|
|
67
|
+
readonly object: unknown;
|
|
68
|
+
/**
|
|
69
|
+
* The `@id` of the referring object, if any.
|
|
70
|
+
*/
|
|
71
|
+
readonly id: URL | null;
|
|
72
|
+
/**
|
|
73
|
+
* The expanded URI of the property through which the referring object
|
|
74
|
+
* referred to the next object in the chain, e.g.,
|
|
75
|
+
* `https://www.w3.org/ns/activitystreams#outbox`.
|
|
76
|
+
*/
|
|
77
|
+
readonly property: string;
|
|
78
|
+
/**
|
|
79
|
+
* How the referring object itself was accepted by a
|
|
80
|
+
* {@link PortableObjectVerifier} when it was dereferenced through gateways:
|
|
81
|
+
*
|
|
82
|
+
* - `"verified"`: accepted as verified, e.g., with a valid integrity proof.
|
|
83
|
+
* - `"unsecured"`: accepted without an integrity proof, e.g., as an
|
|
84
|
+
* unsecured collection served by a trusted gateway.
|
|
85
|
+
*
|
|
86
|
+
* It is `undefined` if the referring object was not dereferenced through
|
|
87
|
+
* gateways, e.g., if it was embedded in another object or constructed by
|
|
88
|
+
* the application.
|
|
89
|
+
*/
|
|
90
|
+
readonly acceptance?: "verified" | "unsecured";
|
|
91
|
+
/**
|
|
92
|
+
* The opaque collection context that a {@link PortableObjectVerifier}
|
|
93
|
+
* attached to the referring object when it accepted it. See
|
|
94
|
+
* {@link PortableObjectVerification}.
|
|
95
|
+
*/
|
|
96
|
+
readonly collectionContext?: unknown;
|
|
97
|
+
/**
|
|
98
|
+
* The referrer of the referring object, if any.
|
|
99
|
+
*/
|
|
100
|
+
readonly referrer?: PortableObjectReferrer;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the chain was cut off here because it was too long. If `true`,
|
|
103
|
+
* the referring object may have a referrer which is not included.
|
|
104
|
+
*/
|
|
105
|
+
readonly truncated?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The result of a {@link PortableObjectVerifier}.
|
|
109
|
+
* @since 2.4.0
|
|
110
|
+
*/
|
|
111
|
+
type PortableObjectVerification = {
|
|
112
|
+
/** Whether the document is accepted. */readonly verified: false;
|
|
113
|
+
} | {
|
|
114
|
+
/** Whether the document is accepted. */readonly verified: true;
|
|
115
|
+
/**
|
|
116
|
+
* Whether the document was accepted without an integrity proof, e.g., as
|
|
117
|
+
* an unsecured [FEP-ef61] collection served by a gateway that its owner
|
|
118
|
+
* lists. Objects embedded in such a document are not trusted because of
|
|
119
|
+
* their origin; property accessors dereference and verify them one by
|
|
120
|
+
* one instead.
|
|
121
|
+
*
|
|
122
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
123
|
+
*/
|
|
124
|
+
readonly unsecured?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* An opaque value that the verifier wants to receive again as
|
|
127
|
+
* {@link PortableObjectReferrer.collectionContext} when objects referred
|
|
128
|
+
* to by this document, such as collection pages, are verified.
|
|
129
|
+
*/
|
|
130
|
+
readonly collectionContext?: unknown;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* A function that applies the [FEP-ef61] trust policy to a portable object
|
|
134
|
+
* fetched through a gateway.
|
|
135
|
+
*
|
|
136
|
+
* It receives the fetched JSON-LD document as is, and resolves to an object
|
|
137
|
+
* whose `verified` property tells whether the document is acceptable, e.g.,
|
|
138
|
+
* whether it carries a valid [FEP-8b32] Object Integrity Proof made by the
|
|
139
|
+
* DID in its portable ID. `verifyPortableObject()` and
|
|
140
|
+
* `verifyPortableObjectProof()` from `@fedify/fedify` satisfy this type, so
|
|
141
|
+
* they can be passed as the `verifyPortableObject` option of generated
|
|
142
|
+
* vocabulary accessors such as `Activity.getObject()`.
|
|
143
|
+
*
|
|
144
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
145
|
+
* [FEP-8b32]: https://w3id.org/fep/8b32
|
|
146
|
+
*
|
|
147
|
+
* @param document The fetched JSON-LD document.
|
|
148
|
+
* @param options Loaders, tracing options, and where the document came from.
|
|
149
|
+
* @returns An object whose `verified` property is `true` if and only if the
|
|
150
|
+
* document satisfies the policy. Other properties, such as
|
|
151
|
+
* a failure reason, are logged when verification fails.
|
|
152
|
+
* @since 2.4.0
|
|
153
|
+
*/
|
|
154
|
+
type PortableObjectVerifier = (document: unknown, options: PortableObjectVerifierOptions) => Promise<PortableObjectVerification>;
|
|
155
|
+
//#endregion
|
|
156
|
+
export { PortableObjectVerifierOptions as i, PortableObjectVerification as n, PortableObjectVerifier as r, PortableObjectReferrer as t };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
import { n as DocumentLoader } from "./docloader-Dr8wEkif.cjs";
|
|
3
|
+
import { TracerProvider } from "@opentelemetry/api";
|
|
4
|
+
|
|
5
|
+
//#region src/portable.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Options passed to a {@link PortableObjectVerifier}.
|
|
8
|
+
* @since 2.4.0
|
|
9
|
+
*/
|
|
10
|
+
interface PortableObjectVerifierOptions {
|
|
11
|
+
/**
|
|
12
|
+
* The document loader for fetching remote documents, such as verification
|
|
13
|
+
* methods that are not `did:key` URLs.
|
|
14
|
+
*/
|
|
15
|
+
readonly documentLoader?: DocumentLoader;
|
|
16
|
+
/**
|
|
17
|
+
* The document loader for fetching remote JSON-LD contexts. During
|
|
18
|
+
* gateway dereferencing, this loader returns the same context documents
|
|
19
|
+
* that the vocabulary parser sees.
|
|
20
|
+
*/
|
|
21
|
+
readonly contextLoader?: DocumentLoader;
|
|
22
|
+
/**
|
|
23
|
+
* The OpenTelemetry tracer provider.
|
|
24
|
+
*/
|
|
25
|
+
readonly tracerProvider?: TracerProvider;
|
|
26
|
+
/**
|
|
27
|
+
* The URL the document was finally retrieved from, i.e., the `documentUrl`
|
|
28
|
+
* of the document loader's result, which may differ from the requested URL
|
|
29
|
+
* after redirects. Trust decisions such as the [FEP-ef61] gateway trust
|
|
30
|
+
* policy for unsecured collections depend on it, so custom document loaders
|
|
31
|
+
* must report it truthfully.
|
|
32
|
+
*
|
|
33
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
34
|
+
* @since 2.4.0
|
|
35
|
+
*/
|
|
36
|
+
readonly documentUrl?: URL;
|
|
37
|
+
/**
|
|
38
|
+
* The gateways that the caller explicitly passed to the accessor through
|
|
39
|
+
* its `gateways` option, in order. It is `undefined` if the caller did not
|
|
40
|
+
* pass the option, and can be empty.
|
|
41
|
+
* @since 2.4.0
|
|
42
|
+
*/
|
|
43
|
+
readonly gateways?: readonly URL[];
|
|
44
|
+
/**
|
|
45
|
+
* The gateways taken from the `@gateway` location hints of the reference,
|
|
46
|
+
* in order, when the caller did not pass the `gateways` option.
|
|
47
|
+
* @since 2.4.0
|
|
48
|
+
*/
|
|
49
|
+
readonly gatewayHints?: readonly URL[];
|
|
50
|
+
/**
|
|
51
|
+
* The object whose property referred to the document, if the document was
|
|
52
|
+
* dereferenced through a property accessor.
|
|
53
|
+
* @since 2.4.0
|
|
54
|
+
*/
|
|
55
|
+
readonly referrer?: PortableObjectReferrer;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* An object whose property referred to a portable object being verified.
|
|
59
|
+
* Referrers form a chain: {@link PortableObjectReferrer.referrer} is the
|
|
60
|
+
* object through which this referrer itself was obtained, and so on.
|
|
61
|
+
* @since 2.4.0
|
|
62
|
+
*/
|
|
63
|
+
interface PortableObjectReferrer {
|
|
64
|
+
/**
|
|
65
|
+
* The referring vocabulary object.
|
|
66
|
+
*/
|
|
67
|
+
readonly object: unknown;
|
|
68
|
+
/**
|
|
69
|
+
* The `@id` of the referring object, if any.
|
|
70
|
+
*/
|
|
71
|
+
readonly id: URL | null;
|
|
72
|
+
/**
|
|
73
|
+
* The expanded URI of the property through which the referring object
|
|
74
|
+
* referred to the next object in the chain, e.g.,
|
|
75
|
+
* `https://www.w3.org/ns/activitystreams#outbox`.
|
|
76
|
+
*/
|
|
77
|
+
readonly property: string;
|
|
78
|
+
/**
|
|
79
|
+
* How the referring object itself was accepted by a
|
|
80
|
+
* {@link PortableObjectVerifier} when it was dereferenced through gateways:
|
|
81
|
+
*
|
|
82
|
+
* - `"verified"`: accepted as verified, e.g., with a valid integrity proof.
|
|
83
|
+
* - `"unsecured"`: accepted without an integrity proof, e.g., as an
|
|
84
|
+
* unsecured collection served by a trusted gateway.
|
|
85
|
+
*
|
|
86
|
+
* It is `undefined` if the referring object was not dereferenced through
|
|
87
|
+
* gateways, e.g., if it was embedded in another object or constructed by
|
|
88
|
+
* the application.
|
|
89
|
+
*/
|
|
90
|
+
readonly acceptance?: "verified" | "unsecured";
|
|
91
|
+
/**
|
|
92
|
+
* The opaque collection context that a {@link PortableObjectVerifier}
|
|
93
|
+
* attached to the referring object when it accepted it. See
|
|
94
|
+
* {@link PortableObjectVerification}.
|
|
95
|
+
*/
|
|
96
|
+
readonly collectionContext?: unknown;
|
|
97
|
+
/**
|
|
98
|
+
* The referrer of the referring object, if any.
|
|
99
|
+
*/
|
|
100
|
+
readonly referrer?: PortableObjectReferrer;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the chain was cut off here because it was too long. If `true`,
|
|
103
|
+
* the referring object may have a referrer which is not included.
|
|
104
|
+
*/
|
|
105
|
+
readonly truncated?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The result of a {@link PortableObjectVerifier}.
|
|
109
|
+
* @since 2.4.0
|
|
110
|
+
*/
|
|
111
|
+
type PortableObjectVerification = {
|
|
112
|
+
/** Whether the document is accepted. */readonly verified: false;
|
|
113
|
+
} | {
|
|
114
|
+
/** Whether the document is accepted. */readonly verified: true;
|
|
115
|
+
/**
|
|
116
|
+
* Whether the document was accepted without an integrity proof, e.g., as
|
|
117
|
+
* an unsecured [FEP-ef61] collection served by a gateway that its owner
|
|
118
|
+
* lists. Objects embedded in such a document are not trusted because of
|
|
119
|
+
* their origin; property accessors dereference and verify them one by
|
|
120
|
+
* one instead.
|
|
121
|
+
*
|
|
122
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
123
|
+
*/
|
|
124
|
+
readonly unsecured?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* An opaque value that the verifier wants to receive again as
|
|
127
|
+
* {@link PortableObjectReferrer.collectionContext} when objects referred
|
|
128
|
+
* to by this document, such as collection pages, are verified.
|
|
129
|
+
*/
|
|
130
|
+
readonly collectionContext?: unknown;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* A function that applies the [FEP-ef61] trust policy to a portable object
|
|
134
|
+
* fetched through a gateway.
|
|
135
|
+
*
|
|
136
|
+
* It receives the fetched JSON-LD document as is, and resolves to an object
|
|
137
|
+
* whose `verified` property tells whether the document is acceptable, e.g.,
|
|
138
|
+
* whether it carries a valid [FEP-8b32] Object Integrity Proof made by the
|
|
139
|
+
* DID in its portable ID. `verifyPortableObject()` and
|
|
140
|
+
* `verifyPortableObjectProof()` from `@fedify/fedify` satisfy this type, so
|
|
141
|
+
* they can be passed as the `verifyPortableObject` option of generated
|
|
142
|
+
* vocabulary accessors such as `Activity.getObject()`.
|
|
143
|
+
*
|
|
144
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
145
|
+
* [FEP-8b32]: https://w3id.org/fep/8b32
|
|
146
|
+
*
|
|
147
|
+
* @param document The fetched JSON-LD document.
|
|
148
|
+
* @param options Loaders, tracing options, and where the document came from.
|
|
149
|
+
* @returns An object whose `verified` property is `true` if and only if the
|
|
150
|
+
* document satisfies the policy. Other properties, such as
|
|
151
|
+
* a failure reason, are logged when verification fails.
|
|
152
|
+
* @since 2.4.0
|
|
153
|
+
*/
|
|
154
|
+
type PortableObjectVerifier = (document: unknown, options: PortableObjectVerifierOptions) => Promise<PortableObjectVerification>;
|
|
155
|
+
//#endregion
|
|
156
|
+
export { PortableObjectVerifierOptions as i, PortableObjectVerification as n, PortableObjectVerifier as r, PortableObjectReferrer as t };
|
package/dist/tests/body.test.cjs
CHANGED
package/dist/tests/body.test.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as readBoundedText, t as BodyTooLargeError } from "./body-
|
|
1
|
+
import { r as readBoundedText, t as BodyTooLargeError } from "./body-BN5x-zDQ.mjs";
|
|
2
2
|
import { deepStrictEqual, ok, rejects } from "node:assert/strict";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import { gunzipSync, gzipSync } from "node:zlib";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-
|
|
2
|
-
import { n as MAX_BODY_SIZE, r as readBoundedText, t as BodyTooLargeError } from "./body-
|
|
1
|
+
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-BT9FBhk6.mjs";
|
|
2
|
+
import { n as MAX_BODY_SIZE, r as readBoundedText, t as BodyTooLargeError } from "./body-BN5x-zDQ.mjs";
|
|
3
3
|
import { t as preloadedContexts } from "./contexts-BBX_qhBL.mjs";
|
|
4
4
|
import { t as HttpHeaderLink } from "./link-Cevmc87v.mjs";
|
|
5
5
|
import { t as UrlError, v as validatePublicUrl } from "./url-DgJM9WJn.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_request = require("./request-
|
|
2
|
-
const require_body = require("./body-
|
|
1
|
+
const require_request = require("./request-jWhPNG9V.cjs");
|
|
2
|
+
const require_body = require("./body-CTGqQhNI.cjs");
|
|
3
3
|
const require_contexts = require("./contexts-Ch3v2Cgu.cjs");
|
|
4
4
|
const require_link = require("./link-DlKm8bEr.cjs");
|
|
5
5
|
const require_url = require("./url-BqlldzT8.cjs");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-jWhPNG9V.cjs");
|
|
3
3
|
const require_contexts = require("./contexts-Ch3v2Cgu.cjs");
|
|
4
4
|
const require_url = require("./url-BqlldzT8.cjs");
|
|
5
|
-
const require_docloader = require("./docloader-
|
|
5
|
+
const require_docloader = require("./docloader-JGSpG-3l.cjs");
|
|
6
6
|
let node_test = require("node:test");
|
|
7
7
|
let node_zlib = require("node:zlib");
|
|
8
8
|
let node_assert = require("node:assert");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as FetchError } from "./request-
|
|
1
|
+
import { t as FetchError } from "./request-BT9FBhk6.mjs";
|
|
2
2
|
import { n as cid_v1_default, t as preloadedContexts } from "./contexts-BBX_qhBL.mjs";
|
|
3
3
|
import { t as UrlError } from "./url-DgJM9WJn.mjs";
|
|
4
|
-
import { n as getRemoteDocument, t as getDocumentLoader } from "./docloader-
|
|
4
|
+
import { n as getRemoteDocument, t as getDocumentLoader } from "./docloader-BFxwbqMx.mjs";
|
|
5
5
|
import { test } from "node:test";
|
|
6
6
|
import { gzipSync } from "node:zlib";
|
|
7
7
|
import { deepStrictEqual, ok, rejects } from "node:assert";
|
|
@@ -3,7 +3,7 @@ let node_process = require("node:process");
|
|
|
3
3
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
4
4
|
//#region deno.json
|
|
5
5
|
var name = "@fedify/vocab-runtime";
|
|
6
|
-
var version = "2.4.0-dev.
|
|
6
|
+
var version = "2.4.0-dev.2063+366c0362";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/request.ts
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-jWhPNG9V.cjs");
|
|
3
3
|
let node_test = require("node:test");
|
|
4
4
|
let node_process = require("node:process");
|
|
5
5
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createActivityPubRequest, o as version, r as getUserAgent } from "./request-
|
|
1
|
+
import { n as createActivityPubRequest, o as version, r as getUserAgent } from "./request-BT9FBhk6.mjs";
|
|
2
2
|
import { test } from "node:test";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { deepStrictEqual } from "node:assert";
|