@fedify/fedify 0.10.0-dev.190 → 0.10.0-dev.195
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGES.md +41 -1
- package/esm/deps/jsr.io/@std/encoding/0.224.3/base64url.js +83 -0
- package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/mod.js +1 -1
- package/esm/federation/handler.js +1 -1
- package/esm/federation/middleware.js +435 -347
- package/esm/nodeinfo/types.js +1 -1
- package/esm/runtime/key.js +82 -0
- package/esm/testing/fixtures/w3id.org/security/multikey/v1 +35 -0
- package/esm/testing/fixtures/www.w3.org/ns/did/v1 +58 -0
- package/esm/vocab/application.yaml +15 -1
- package/esm/vocab/group.yaml +15 -1
- package/esm/vocab/multikey.yaml +33 -0
- package/esm/vocab/organization.yaml +15 -1
- package/esm/vocab/person.yaml +15 -1
- package/esm/vocab/service.yaml +15 -1
- package/esm/vocab/vocab.js +986 -13
- package/package.json +4 -1
- package/types/codegen/type.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/async/{0.224.1 → 0.224.2}/delay.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/encoding/0.224.3/base64url.d.ts +38 -0
- package/types/deps/jsr.io/@std/encoding/0.224.3/base64url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/common.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/encoding.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/language.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/media_type.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/negotiation.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/assert_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/normalize_string.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/strip_trailing_separators.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/_util.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.3/_constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_shared.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_test_comparator_set.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/can_parse.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/compare.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/constants.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/difference.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/equals.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format_range.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_or_equal.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than_range.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/increment.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_range.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_semver.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_or_equal.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than_range.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/max_satisfying.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/min_satisfying.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/mod.d.ts +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/not_equals.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse_range.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_intersects.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_max.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_min.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/satisfies.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/test_range.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse_range.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/types.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/_util.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/case.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/closest_string.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/compare_similarity.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/levenshtein_distance.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/0.224.3/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/word_similarity_sort.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/url/{0.224.0 → 0.224.1}/_strip.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/url/0.224.1/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/url/0.224.1/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/url/0.224.1/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/url/0.224.1/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/url/0.224.1/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/url/0.224.1/normalize.d.ts.map +1 -0
- package/types/federation/context.d.ts +6 -1
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/nodeinfo/types.d.ts +1 -1
- package/types/runtime/key.d.ts +20 -0
- package/types/runtime/key.d.ts.map +1 -1
- package/types/vocab/vocab.d.ts +249 -0
- package/types/vocab/vocab.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/assert/0.226.0/assert.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/assert/0.226.0/assertion_error.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.2/_constants.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/text/0.224.2/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.224.0/basename.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.224.0/dirname.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.224.0/extname.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.224.0/join.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.224.0/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.224.0/normalize.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/common.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/encoding.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/language.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/media_type.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/negotiation.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_constants.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_shared.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_test_comparator_set.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/can_parse.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/compare.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/constants.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/difference.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/equals.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format_range.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_or_equal.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than_range.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/increment.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_range.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_semver.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_or_equal.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than_range.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/max_satisfying.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/min_satisfying.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/not_equals.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse_range.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_intersects.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_max.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_min.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/satisfies.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/test_range.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse_range.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/types.js +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/common.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/encoding.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/language.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/media_type.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/negotiation.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_constants.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_shared.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_test_comparator_set.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/can_parse.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/compare.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/constants.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/difference.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/equals.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format_range.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_or_equal.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than_range.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/increment.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_range.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_semver.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_or_equal.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than_range.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/max_satisfying.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/min_satisfying.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/not_equals.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse_range.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_intersects.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_max.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_min.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/satisfies.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/test_range.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse_range.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/types.d.ts +0 -0
package/esm/vocab/vocab.js
CHANGED
@@ -5,7 +5,7 @@ import * as dntShim from "../_dnt.shims.js";
|
|
5
5
|
import jsonld from "jsonld";
|
6
6
|
import { parseLanguageTag } from "@phensley/language-tag";
|
7
7
|
import { fetchDocumentLoader, } from "../runtime/docloader.js";
|
8
|
-
import { exportSpki, importSpki } from "../runtime/key.js";
|
8
|
+
import { exportMultibaseKey, exportSpki, importMultibaseKey, importSpki, } from "../runtime/key.js";
|
9
9
|
import { LanguageString } from "../runtime/langstr.js";
|
10
10
|
/** Describes an object of any kind. The Object type serves as the base type for
|
11
11
|
* most of the other kinds of objects defined in the Activity Vocabulary,
|
@@ -3934,6 +3934,319 @@ export class CryptographicKey {
|
|
3934
3934
|
return "CryptographicKey " + inspect(proxy, options);
|
3935
3935
|
}
|
3936
3936
|
}
|
3937
|
+
/** Represents a key owned by an actor according to [FEP-521a: Representing
|
3938
|
+
* actor's public keys.][1]
|
3939
|
+
*
|
3940
|
+
* [1]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
3941
|
+
*/
|
3942
|
+
export class Multikey {
|
3943
|
+
#documentLoader;
|
3944
|
+
#contextLoader;
|
3945
|
+
id;
|
3946
|
+
get _documentLoader() {
|
3947
|
+
return this.#documentLoader;
|
3948
|
+
}
|
3949
|
+
get _contextLoader() {
|
3950
|
+
return this.#contextLoader;
|
3951
|
+
}
|
3952
|
+
/**
|
3953
|
+
* The type URI of {@link Multikey}: `https://w3id.org/security#Multikey`.
|
3954
|
+
*/
|
3955
|
+
static get typeId() {
|
3956
|
+
return new URL("https://w3id.org/security#Multikey");
|
3957
|
+
}
|
3958
|
+
#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN = [];
|
3959
|
+
#_4XLHbsR2gLVWU3NpEqKt9wANzn4F = [];
|
3960
|
+
/**
|
3961
|
+
* Constructs a new instance of Multikey with the given values.
|
3962
|
+
* @param values The values to initialize the instance with.
|
3963
|
+
* @param options The options to use for initialization.
|
3964
|
+
*/
|
3965
|
+
constructor(values, { documentLoader, contextLoader, } = {}) {
|
3966
|
+
this.#documentLoader = documentLoader;
|
3967
|
+
this.#contextLoader = contextLoader;
|
3968
|
+
this.id = values.id ?? null;
|
3969
|
+
if ("controller" in values && values.controller != null) {
|
3970
|
+
this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN = [values.controller];
|
3971
|
+
}
|
3972
|
+
if ("publicKey" in values && values.publicKey != null) {
|
3973
|
+
this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F = [values.publicKey];
|
3974
|
+
}
|
3975
|
+
}
|
3976
|
+
/**
|
3977
|
+
* Clones this instance, optionally updating it with the given values.
|
3978
|
+
* @param values The values to update the clone with.
|
3979
|
+
* @options The options to use for cloning.
|
3980
|
+
* @returns The cloned instance.
|
3981
|
+
*/
|
3982
|
+
clone(values = {}, options = {}) {
|
3983
|
+
// @ts-ignore: this.constructor is not recognized as a constructor, but it is.
|
3984
|
+
const clone = new this.constructor({ id: values.id }, options);
|
3985
|
+
clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN;
|
3986
|
+
if ("controller" in values && values.controller != null) {
|
3987
|
+
clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN = [values.controller];
|
3988
|
+
}
|
3989
|
+
clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F = this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F;
|
3990
|
+
if ("publicKey" in values && values.publicKey != null) {
|
3991
|
+
clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F = [values.publicKey];
|
3992
|
+
}
|
3993
|
+
return clone;
|
3994
|
+
}
|
3995
|
+
async #fetchController(url, options = {}) {
|
3996
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
3997
|
+
fetchDocumentLoader;
|
3998
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
3999
|
+
fetchDocumentLoader;
|
4000
|
+
const { document } = await documentLoader(url.href);
|
4001
|
+
try {
|
4002
|
+
return await Application.fromJsonLd(document, { documentLoader, contextLoader });
|
4003
|
+
}
|
4004
|
+
catch (e) {
|
4005
|
+
if (!(e instanceof TypeError))
|
4006
|
+
throw e;
|
4007
|
+
}
|
4008
|
+
try {
|
4009
|
+
return await Group.fromJsonLd(document, { documentLoader, contextLoader });
|
4010
|
+
}
|
4011
|
+
catch (e) {
|
4012
|
+
if (!(e instanceof TypeError))
|
4013
|
+
throw e;
|
4014
|
+
}
|
4015
|
+
try {
|
4016
|
+
return await Organization.fromJsonLd(document, { documentLoader, contextLoader });
|
4017
|
+
}
|
4018
|
+
catch (e) {
|
4019
|
+
if (!(e instanceof TypeError))
|
4020
|
+
throw e;
|
4021
|
+
}
|
4022
|
+
try {
|
4023
|
+
return await Person.fromJsonLd(document, { documentLoader, contextLoader });
|
4024
|
+
}
|
4025
|
+
catch (e) {
|
4026
|
+
if (!(e instanceof TypeError))
|
4027
|
+
throw e;
|
4028
|
+
}
|
4029
|
+
try {
|
4030
|
+
return await Service.fromJsonLd(document, { documentLoader, contextLoader });
|
4031
|
+
}
|
4032
|
+
catch (e) {
|
4033
|
+
if (!(e instanceof TypeError))
|
4034
|
+
throw e;
|
4035
|
+
}
|
4036
|
+
throw new TypeError("Expected an object of any type of: " +
|
4037
|
+
[
|
4038
|
+
"https://www.w3.org/ns/activitystreams#Application",
|
4039
|
+
"https://www.w3.org/ns/activitystreams#Group",
|
4040
|
+
"https://www.w3.org/ns/activitystreams#Organization",
|
4041
|
+
"https://www.w3.org/ns/activitystreams#Person",
|
4042
|
+
"https://www.w3.org/ns/activitystreams#Service",
|
4043
|
+
].join(", "));
|
4044
|
+
}
|
4045
|
+
/**
|
4046
|
+
* Similar to
|
4047
|
+
* {@link Multikey.getController},
|
4048
|
+
* but returns its `@id` URL instead of the object itself.
|
4049
|
+
*/
|
4050
|
+
get controllerId() {
|
4051
|
+
if (this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN.length < 1)
|
4052
|
+
return null;
|
4053
|
+
const v = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN[0];
|
4054
|
+
if (v instanceof URL)
|
4055
|
+
return v;
|
4056
|
+
return v.id;
|
4057
|
+
}
|
4058
|
+
/** An actor who owns this key.
|
4059
|
+
*/
|
4060
|
+
async getController(options = {}) {
|
4061
|
+
if (this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN.length < 1)
|
4062
|
+
return null;
|
4063
|
+
const v = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN[0];
|
4064
|
+
if (v instanceof URL) {
|
4065
|
+
const fetched = await this.#fetchController(v, options);
|
4066
|
+
this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN[0] = fetched;
|
4067
|
+
return fetched;
|
4068
|
+
}
|
4069
|
+
return v;
|
4070
|
+
}
|
4071
|
+
/** A [Multibase]-encoded value of a [Multicodec] prefix and the key.
|
4072
|
+
*
|
4073
|
+
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
|
4074
|
+
* [Multicodec]: https://github.com/multiformats/multicodec/
|
4075
|
+
*/
|
4076
|
+
get publicKey() {
|
4077
|
+
if (this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F.length < 1)
|
4078
|
+
return null;
|
4079
|
+
return this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F[0];
|
4080
|
+
}
|
4081
|
+
/**
|
4082
|
+
* Converts this object to a JSON-LD structure.
|
4083
|
+
* @returns The JSON-LD representation of this object.
|
4084
|
+
*/
|
4085
|
+
async toJsonLd(options = {}) {
|
4086
|
+
options = {
|
4087
|
+
...options,
|
4088
|
+
contextLoader: options.contextLoader ?? fetchDocumentLoader,
|
4089
|
+
};
|
4090
|
+
// deno-lint-ignore no-unused-vars prefer-const
|
4091
|
+
let array;
|
4092
|
+
const values = {};
|
4093
|
+
array = [];
|
4094
|
+
for (const v of this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN) {
|
4095
|
+
array.push(v instanceof URL
|
4096
|
+
? { "@id": v.href }
|
4097
|
+
: v instanceof Application
|
4098
|
+
? await v.toJsonLd(options)
|
4099
|
+
: v instanceof Group
|
4100
|
+
? await v.toJsonLd(options)
|
4101
|
+
: v instanceof Organization
|
4102
|
+
? await v.toJsonLd(options)
|
4103
|
+
: v instanceof Person
|
4104
|
+
? await v.toJsonLd(options)
|
4105
|
+
: await v.toJsonLd(options));
|
4106
|
+
}
|
4107
|
+
if (array.length > 0) {
|
4108
|
+
values["https://w3id.org/security#controller"] = array;
|
4109
|
+
}
|
4110
|
+
array = [];
|
4111
|
+
for (const v of this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F) {
|
4112
|
+
array.push({
|
4113
|
+
"@type": "https://w3id.org/security#multibase",
|
4114
|
+
"@value": await exportMultibaseKey(v),
|
4115
|
+
});
|
4116
|
+
}
|
4117
|
+
if (array.length > 0) {
|
4118
|
+
values["https://w3id.org/security#publicKeyMultibase"] = array;
|
4119
|
+
}
|
4120
|
+
values["@type"] = ["https://w3id.org/security#Multikey"];
|
4121
|
+
if (this.id)
|
4122
|
+
values["@id"] = this.id.href;
|
4123
|
+
if (options.expand) {
|
4124
|
+
return await jsonld.expand(values, { documentLoader: options.contextLoader });
|
4125
|
+
}
|
4126
|
+
return await jsonld.compact(values, "https://w3id.org/security/multikey/v1", { documentLoader: options.contextLoader });
|
4127
|
+
}
|
4128
|
+
/**
|
4129
|
+
* Converts a JSON-LD structure to an object of this type.
|
4130
|
+
* @param json The JSON-LD structure to convert.
|
4131
|
+
* @returns The object of this type.
|
4132
|
+
* @throws {TypeError} If the given `json` is invalid.
|
4133
|
+
*/
|
4134
|
+
static async fromJsonLd(json, options = {}) {
|
4135
|
+
if (typeof json === "undefined") {
|
4136
|
+
throw new TypeError("Invalid JSON-LD: undefined.");
|
4137
|
+
}
|
4138
|
+
else if (json === null)
|
4139
|
+
throw new TypeError("Invalid JSON-LD: null.");
|
4140
|
+
options = {
|
4141
|
+
...options,
|
4142
|
+
documentLoader: options.documentLoader ?? fetchDocumentLoader,
|
4143
|
+
contextLoader: options.contextLoader ?? fetchDocumentLoader,
|
4144
|
+
};
|
4145
|
+
// deno-lint-ignore no-explicit-any
|
4146
|
+
let values;
|
4147
|
+
if (globalThis.Object.keys(json).length == 0) {
|
4148
|
+
values = {};
|
4149
|
+
}
|
4150
|
+
else {
|
4151
|
+
const expanded = await jsonld.expand(json, {
|
4152
|
+
documentLoader: options.contextLoader,
|
4153
|
+
keepFreeFloatingNodes: true,
|
4154
|
+
});
|
4155
|
+
values =
|
4156
|
+
// deno-lint-ignore no-explicit-any
|
4157
|
+
(expanded[0] ?? {});
|
4158
|
+
}
|
4159
|
+
if ("@type" in values) {
|
4160
|
+
if (!values["@type"].includes("https://w3id.org/security#Multikey")) {
|
4161
|
+
throw new TypeError("Invalid type: " + values["@type"]);
|
4162
|
+
}
|
4163
|
+
}
|
4164
|
+
const instance = new this({ id: "@id" in values ? new URL(values["@id"]) : undefined }, options);
|
4165
|
+
const _2yr3eUBTP6cNcyaxKzAXWjFsnGzN = [];
|
4166
|
+
for (const v of values["https://w3id.org/security#controller"] ?? []) {
|
4167
|
+
if (v == null)
|
4168
|
+
continue;
|
4169
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
4170
|
+
globalThis.Object.keys(v).length === 1) {
|
4171
|
+
_2yr3eUBTP6cNcyaxKzAXWjFsnGzN.push(new URL(v["@id"]));
|
4172
|
+
continue;
|
4173
|
+
}
|
4174
|
+
const decoded = typeof v === "object" && "@type" in v &&
|
4175
|
+
Array.isArray(v["@type"]) &&
|
4176
|
+
v["@type"].includes("https://www.w3.org/ns/activitystreams#Application")
|
4177
|
+
? await Application.fromJsonLd(v, options)
|
4178
|
+
: typeof v === "object" && "@type" in v &&
|
4179
|
+
Array.isArray(v["@type"]) &&
|
4180
|
+
v["@type"].includes("https://www.w3.org/ns/activitystreams#Group")
|
4181
|
+
? await Group.fromJsonLd(v, options)
|
4182
|
+
: typeof v === "object" && "@type" in v &&
|
4183
|
+
Array.isArray(v["@type"]) &&
|
4184
|
+
v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization")
|
4185
|
+
? await Organization.fromJsonLd(v, options)
|
4186
|
+
: typeof v === "object" && "@type" in v &&
|
4187
|
+
Array.isArray(v["@type"]) &&
|
4188
|
+
v["@type"].includes("https://www.w3.org/ns/activitystreams#Person")
|
4189
|
+
? await Person.fromJsonLd(v, options)
|
4190
|
+
: typeof v === "object" && "@type" in v &&
|
4191
|
+
Array.isArray(v["@type"]) &&
|
4192
|
+
v["@type"].includes("https://www.w3.org/ns/activitystreams#Service")
|
4193
|
+
? await Service.fromJsonLd(v, options)
|
4194
|
+
: undefined;
|
4195
|
+
if (typeof decoded === "undefined")
|
4196
|
+
continue;
|
4197
|
+
_2yr3eUBTP6cNcyaxKzAXWjFsnGzN.push(decoded);
|
4198
|
+
}
|
4199
|
+
instance.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN = _2yr3eUBTP6cNcyaxKzAXWjFsnGzN;
|
4200
|
+
const _4XLHbsR2gLVWU3NpEqKt9wANzn4F = [];
|
4201
|
+
for (const v of values["https://w3id.org/security#publicKeyMultibase"] ?? []) {
|
4202
|
+
if (v == null)
|
4203
|
+
continue;
|
4204
|
+
_4XLHbsR2gLVWU3NpEqKt9wANzn4F.push(await importMultibaseKey(v["@value"]));
|
4205
|
+
}
|
4206
|
+
instance.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F = _4XLHbsR2gLVWU3NpEqKt9wANzn4F;
|
4207
|
+
return instance;
|
4208
|
+
}
|
4209
|
+
_getCustomInspectProxy() {
|
4210
|
+
const proxy = {};
|
4211
|
+
if (this.id != null) {
|
4212
|
+
proxy.id = {
|
4213
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(this.id.href, options),
|
4214
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(this.id.href, options),
|
4215
|
+
};
|
4216
|
+
}
|
4217
|
+
const _2yr3eUBTP6cNcyaxKzAXWjFsnGzN = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN
|
4218
|
+
// deno-lint-ignore no-explicit-any
|
4219
|
+
.map((v) => v instanceof URL
|
4220
|
+
? {
|
4221
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
4222
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
4223
|
+
}
|
4224
|
+
: v);
|
4225
|
+
if (_2yr3eUBTP6cNcyaxKzAXWjFsnGzN.length == 1) {
|
4226
|
+
proxy.controller = _2yr3eUBTP6cNcyaxKzAXWjFsnGzN[0];
|
4227
|
+
}
|
4228
|
+
const _4XLHbsR2gLVWU3NpEqKt9wANzn4F = this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F
|
4229
|
+
// deno-lint-ignore no-explicit-any
|
4230
|
+
.map((v) => v instanceof URL
|
4231
|
+
? {
|
4232
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
4233
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
4234
|
+
}
|
4235
|
+
: v);
|
4236
|
+
if (_4XLHbsR2gLVWU3NpEqKt9wANzn4F.length == 1) {
|
4237
|
+
proxy.publicKey = _4XLHbsR2gLVWU3NpEqKt9wANzn4F[0];
|
4238
|
+
}
|
4239
|
+
return proxy;
|
4240
|
+
}
|
4241
|
+
[Symbol.for("Deno.customInspect")](inspect, options) {
|
4242
|
+
const proxy = this._getCustomInspectProxy();
|
4243
|
+
return "Multikey " + inspect(proxy, options);
|
4244
|
+
}
|
4245
|
+
[Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
|
4246
|
+
const proxy = this._getCustomInspectProxy();
|
4247
|
+
return "Multikey " + inspect(proxy, options);
|
4248
|
+
}
|
4249
|
+
}
|
3937
4250
|
/** An Activity is a subtype of {@link Object} that describes some form of action
|
3938
4251
|
* that may happen, is currently happening, or has already happened.
|
3939
4252
|
* The {@link Activity} type itself serves as an abstract base type for all types
|
@@ -4772,6 +5085,7 @@ export class Application extends Object {
|
|
4772
5085
|
}
|
4773
5086
|
#_3isuDgRAKSntq9XdbjiNxjwyPZAf = [];
|
4774
5087
|
#_axq166E2eZADq34V4MYUc8KMZdC = [];
|
5088
|
+
#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [];
|
4775
5089
|
#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [];
|
4776
5090
|
#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = [];
|
4777
5091
|
#_41QwhqJouoLg3h8dRPKat21brynC = [];
|
@@ -4813,6 +5127,17 @@ export class Application extends Object {
|
|
4813
5127
|
}
|
4814
5128
|
this.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys;
|
4815
5129
|
}
|
5130
|
+
if ("assertionMethod" in values && values.assertionMethod != null) {
|
5131
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [values.assertionMethod];
|
5132
|
+
}
|
5133
|
+
if ("assertionMethods" in values && values.assertionMethods != null) {
|
5134
|
+
if ("assertionMethod" in values &&
|
5135
|
+
values.assertionMethod != null) {
|
5136
|
+
throw new TypeError("Cannot initialize both assertionMethod and " +
|
5137
|
+
"assertionMethods at the same time.");
|
5138
|
+
}
|
5139
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = values.assertionMethods;
|
5140
|
+
}
|
4816
5141
|
if ("manuallyApprovesFollowers" in values &&
|
4817
5142
|
values.manuallyApprovesFollowers != null) {
|
4818
5143
|
this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [values.manuallyApprovesFollowers];
|
@@ -4883,6 +5208,18 @@ export class Application extends Object {
|
|
4883
5208
|
}
|
4884
5209
|
clone.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys;
|
4885
5210
|
}
|
5211
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
5212
|
+
if ("assertionMethod" in values && values.assertionMethod != null) {
|
5213
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [values.assertionMethod];
|
5214
|
+
}
|
5215
|
+
if ("assertionMethods" in values && values.assertionMethods != null) {
|
5216
|
+
if ("assertionMethod" in values &&
|
5217
|
+
values.assertionMethod != null) {
|
5218
|
+
throw new TypeError("Cannot update both assertionMethod and " +
|
5219
|
+
"assertionMethods at the same time.");
|
5220
|
+
}
|
5221
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = values.assertionMethods;
|
5222
|
+
}
|
4886
5223
|
clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA;
|
4887
5224
|
if ("manuallyApprovesFollowers" in values &&
|
4888
5225
|
values.manuallyApprovesFollowers != null) {
|
@@ -5013,6 +5350,77 @@ export class Application extends Object {
|
|
5013
5350
|
yield v;
|
5014
5351
|
}
|
5015
5352
|
}
|
5353
|
+
async #fetchAssertionMethod(url, options = {}) {
|
5354
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
5355
|
+
fetchDocumentLoader;
|
5356
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
5357
|
+
fetchDocumentLoader;
|
5358
|
+
const { document } = await documentLoader(url.href);
|
5359
|
+
try {
|
5360
|
+
return await Multikey.fromJsonLd(document, { documentLoader, contextLoader });
|
5361
|
+
}
|
5362
|
+
catch (e) {
|
5363
|
+
if (!(e instanceof TypeError))
|
5364
|
+
throw e;
|
5365
|
+
}
|
5366
|
+
throw new TypeError("Expected an object of any type of: " +
|
5367
|
+
["https://w3id.org/security#Multikey"].join(", "));
|
5368
|
+
}
|
5369
|
+
/**
|
5370
|
+
* Similar to
|
5371
|
+
* {@link Application.getAssertionMethod},
|
5372
|
+
* but returns its `@id` URL instead of the object itself.
|
5373
|
+
*/
|
5374
|
+
get assertionMethodId() {
|
5375
|
+
if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length < 1)
|
5376
|
+
return null;
|
5377
|
+
const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
5378
|
+
if (v instanceof URL)
|
5379
|
+
return v;
|
5380
|
+
return v.id;
|
5381
|
+
}
|
5382
|
+
/** Represents this actor's public keys. It serves as equivalent to
|
5383
|
+
* the `publicKeys` property, but is used for [FEP-521a] compliance.
|
5384
|
+
*
|
5385
|
+
* [FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
5386
|
+
*/
|
5387
|
+
async getAssertionMethod(options = {}) {
|
5388
|
+
if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length < 1)
|
5389
|
+
return null;
|
5390
|
+
const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
5391
|
+
if (v instanceof URL) {
|
5392
|
+
const fetched = await this.#fetchAssertionMethod(v, options);
|
5393
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0] = fetched;
|
5394
|
+
return fetched;
|
5395
|
+
}
|
5396
|
+
return v;
|
5397
|
+
}
|
5398
|
+
/**
|
5399
|
+
* Similar to
|
5400
|
+
* {@link Application.getAssertionMethods},
|
5401
|
+
* but returns their `@id`s instead of the objects themselves.
|
5402
|
+
*/
|
5403
|
+
get assertionMethodIds() {
|
5404
|
+
return this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
5405
|
+
}
|
5406
|
+
/** Represents this actor's public keys. It serves as equivalent to
|
5407
|
+
* the `publicKeys` property, but is used for [FEP-521a] compliance.
|
5408
|
+
*
|
5409
|
+
* [FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
5410
|
+
*/
|
5411
|
+
async *getAssertionMethods(options = {}) {
|
5412
|
+
const vs = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
5413
|
+
for (let i = 0; i < vs.length; i++) {
|
5414
|
+
const v = vs[i];
|
5415
|
+
if (v instanceof URL) {
|
5416
|
+
const fetched = await this.#fetchAssertionMethod(v, options);
|
5417
|
+
vs[i] = fetched;
|
5418
|
+
yield fetched;
|
5419
|
+
continue;
|
5420
|
+
}
|
5421
|
+
yield v;
|
5422
|
+
}
|
5423
|
+
}
|
5016
5424
|
/** When `true`, conveys that for this actor, follow requests are not usually
|
5017
5425
|
* automatically approved, but instead are examined by a person who may accept
|
5018
5426
|
* or reject the request, at some time in the future. Setting of `false`
|
@@ -5386,6 +5794,13 @@ export class Application extends Object {
|
|
5386
5794
|
if (array.length > 0)
|
5387
5795
|
values["https://w3id.org/security#publicKey"] = array;
|
5388
5796
|
array = [];
|
5797
|
+
for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3) {
|
5798
|
+
array.push(v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options));
|
5799
|
+
}
|
5800
|
+
if (array.length > 0) {
|
5801
|
+
values["https://w3id.org/security#assertionMethod"] = array;
|
5802
|
+
}
|
5803
|
+
array = [];
|
5389
5804
|
for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA) {
|
5390
5805
|
array.push({ "@value": v });
|
5391
5806
|
}
|
@@ -5476,6 +5891,8 @@ export class Application extends Object {
|
|
5476
5891
|
return await jsonld.compact(values, [
|
5477
5892
|
"https://www.w3.org/ns/activitystreams",
|
5478
5893
|
"https://w3id.org/security/v1",
|
5894
|
+
"https://www.w3.org/ns/did/v1",
|
5895
|
+
"https://w3id.org/security/multikey/v1",
|
5479
5896
|
{
|
5480
5897
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
5481
5898
|
"toot": "http://joinmastodon.org/ns#",
|
@@ -5559,6 +5976,18 @@ export class Application extends Object {
|
|
5559
5976
|
_axq166E2eZADq34V4MYUc8KMZdC.push(await CryptographicKey.fromJsonLd(v, options));
|
5560
5977
|
}
|
5561
5978
|
instance.#_axq166E2eZADq34V4MYUc8KMZdC = _axq166E2eZADq34V4MYUc8KMZdC;
|
5979
|
+
const _4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [];
|
5980
|
+
for (const v of values["https://w3id.org/security#assertionMethod"] ?? []) {
|
5981
|
+
if (v == null)
|
5982
|
+
continue;
|
5983
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
5984
|
+
globalThis.Object.keys(v).length === 1) {
|
5985
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.push(new URL(v["@id"]));
|
5986
|
+
continue;
|
5987
|
+
}
|
5988
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.push(await Multikey.fromJsonLd(v, options));
|
5989
|
+
}
|
5990
|
+
instance.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = _4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
5562
5991
|
const _36QNc9MxfkKf6h8sEUQSHnV9NZA = [];
|
5563
5992
|
for (const v of values["https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers"] ?? []) {
|
5564
5993
|
if (v == null)
|
@@ -5709,6 +6138,22 @@ export class Application extends Object {
|
|
5709
6138
|
_axq166E2eZADq34V4MYUc8KMZdC.length > 0) {
|
5710
6139
|
proxy.publicKeys = _axq166E2eZADq34V4MYUc8KMZdC;
|
5711
6140
|
}
|
6141
|
+
const _4EHQFWZSz1k1d4LmPrQiMba2GbP3 = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3
|
6142
|
+
// deno-lint-ignore no-explicit-any
|
6143
|
+
.map((v) => v instanceof URL
|
6144
|
+
? {
|
6145
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
6146
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
6147
|
+
}
|
6148
|
+
: v);
|
6149
|
+
if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length == 1) {
|
6150
|
+
proxy.assertionMethod = _4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
6151
|
+
}
|
6152
|
+
if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length > 1 ||
|
6153
|
+
!("assertionMethod" in proxy) &&
|
6154
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length > 0) {
|
6155
|
+
proxy.assertionMethods = _4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
6156
|
+
}
|
5712
6157
|
const _36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA
|
5713
6158
|
// deno-lint-ignore no-explicit-any
|
5714
6159
|
.map((v) => v instanceof URL
|
@@ -8656,6 +9101,7 @@ export class Group extends Object {
|
|
8656
9101
|
}
|
8657
9102
|
#_3isuDgRAKSntq9XdbjiNxjwyPZAf = [];
|
8658
9103
|
#_axq166E2eZADq34V4MYUc8KMZdC = [];
|
9104
|
+
#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [];
|
8659
9105
|
#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [];
|
8660
9106
|
#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = [];
|
8661
9107
|
#_41QwhqJouoLg3h8dRPKat21brynC = [];
|
@@ -8697,6 +9143,17 @@ export class Group extends Object {
|
|
8697
9143
|
}
|
8698
9144
|
this.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys;
|
8699
9145
|
}
|
9146
|
+
if ("assertionMethod" in values && values.assertionMethod != null) {
|
9147
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [values.assertionMethod];
|
9148
|
+
}
|
9149
|
+
if ("assertionMethods" in values && values.assertionMethods != null) {
|
9150
|
+
if ("assertionMethod" in values &&
|
9151
|
+
values.assertionMethod != null) {
|
9152
|
+
throw new TypeError("Cannot initialize both assertionMethod and " +
|
9153
|
+
"assertionMethods at the same time.");
|
9154
|
+
}
|
9155
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = values.assertionMethods;
|
9156
|
+
}
|
8700
9157
|
if ("manuallyApprovesFollowers" in values &&
|
8701
9158
|
values.manuallyApprovesFollowers != null) {
|
8702
9159
|
this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [values.manuallyApprovesFollowers];
|
@@ -8767,6 +9224,18 @@ export class Group extends Object {
|
|
8767
9224
|
}
|
8768
9225
|
clone.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys;
|
8769
9226
|
}
|
9227
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
9228
|
+
if ("assertionMethod" in values && values.assertionMethod != null) {
|
9229
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [values.assertionMethod];
|
9230
|
+
}
|
9231
|
+
if ("assertionMethods" in values && values.assertionMethods != null) {
|
9232
|
+
if ("assertionMethod" in values &&
|
9233
|
+
values.assertionMethod != null) {
|
9234
|
+
throw new TypeError("Cannot update both assertionMethod and " +
|
9235
|
+
"assertionMethods at the same time.");
|
9236
|
+
}
|
9237
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = values.assertionMethods;
|
9238
|
+
}
|
8770
9239
|
clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA;
|
8771
9240
|
if ("manuallyApprovesFollowers" in values &&
|
8772
9241
|
values.manuallyApprovesFollowers != null) {
|
@@ -8863,33 +9332,104 @@ export class Group extends Object {
|
|
8863
9332
|
}
|
8864
9333
|
/** A public part of the key pair owned by this actor.
|
8865
9334
|
*/
|
8866
|
-
async getPublicKey(options = {}) {
|
8867
|
-
if (this.#_axq166E2eZADq34V4MYUc8KMZdC.length < 1)
|
9335
|
+
async getPublicKey(options = {}) {
|
9336
|
+
if (this.#_axq166E2eZADq34V4MYUc8KMZdC.length < 1)
|
9337
|
+
return null;
|
9338
|
+
const v = this.#_axq166E2eZADq34V4MYUc8KMZdC[0];
|
9339
|
+
if (v instanceof URL) {
|
9340
|
+
const fetched = await this.#fetchPublicKey(v, options);
|
9341
|
+
this.#_axq166E2eZADq34V4MYUc8KMZdC[0] = fetched;
|
9342
|
+
return fetched;
|
9343
|
+
}
|
9344
|
+
return v;
|
9345
|
+
}
|
9346
|
+
/**
|
9347
|
+
* Similar to
|
9348
|
+
* {@link Group.getPublicKeys},
|
9349
|
+
* but returns their `@id`s instead of the objects themselves.
|
9350
|
+
*/
|
9351
|
+
get publicKeyIds() {
|
9352
|
+
return this.#_axq166E2eZADq34V4MYUc8KMZdC.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
9353
|
+
}
|
9354
|
+
/** A public part of the key pair owned by this actor.
|
9355
|
+
*/
|
9356
|
+
async *getPublicKeys(options = {}) {
|
9357
|
+
const vs = this.#_axq166E2eZADq34V4MYUc8KMZdC;
|
9358
|
+
for (let i = 0; i < vs.length; i++) {
|
9359
|
+
const v = vs[i];
|
9360
|
+
if (v instanceof URL) {
|
9361
|
+
const fetched = await this.#fetchPublicKey(v, options);
|
9362
|
+
vs[i] = fetched;
|
9363
|
+
yield fetched;
|
9364
|
+
continue;
|
9365
|
+
}
|
9366
|
+
yield v;
|
9367
|
+
}
|
9368
|
+
}
|
9369
|
+
async #fetchAssertionMethod(url, options = {}) {
|
9370
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
9371
|
+
fetchDocumentLoader;
|
9372
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
9373
|
+
fetchDocumentLoader;
|
9374
|
+
const { document } = await documentLoader(url.href);
|
9375
|
+
try {
|
9376
|
+
return await Multikey.fromJsonLd(document, { documentLoader, contextLoader });
|
9377
|
+
}
|
9378
|
+
catch (e) {
|
9379
|
+
if (!(e instanceof TypeError))
|
9380
|
+
throw e;
|
9381
|
+
}
|
9382
|
+
throw new TypeError("Expected an object of any type of: " +
|
9383
|
+
["https://w3id.org/security#Multikey"].join(", "));
|
9384
|
+
}
|
9385
|
+
/**
|
9386
|
+
* Similar to
|
9387
|
+
* {@link Group.getAssertionMethod},
|
9388
|
+
* but returns its `@id` URL instead of the object itself.
|
9389
|
+
*/
|
9390
|
+
get assertionMethodId() {
|
9391
|
+
if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length < 1)
|
9392
|
+
return null;
|
9393
|
+
const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
9394
|
+
if (v instanceof URL)
|
9395
|
+
return v;
|
9396
|
+
return v.id;
|
9397
|
+
}
|
9398
|
+
/** Represents this actor's public keys. It serves as equivalent to
|
9399
|
+
* the `publicKeys` property, but is used for [FEP-521a] compliance.
|
9400
|
+
*
|
9401
|
+
* [FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
9402
|
+
*/
|
9403
|
+
async getAssertionMethod(options = {}) {
|
9404
|
+
if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length < 1)
|
8868
9405
|
return null;
|
8869
|
-
const v = this.#
|
9406
|
+
const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
8870
9407
|
if (v instanceof URL) {
|
8871
|
-
const fetched = await this.#
|
8872
|
-
this.#
|
9408
|
+
const fetched = await this.#fetchAssertionMethod(v, options);
|
9409
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0] = fetched;
|
8873
9410
|
return fetched;
|
8874
9411
|
}
|
8875
9412
|
return v;
|
8876
9413
|
}
|
8877
9414
|
/**
|
8878
9415
|
* Similar to
|
8879
|
-
* {@link Group.
|
9416
|
+
* {@link Group.getAssertionMethods},
|
8880
9417
|
* but returns their `@id`s instead of the objects themselves.
|
8881
9418
|
*/
|
8882
|
-
get
|
8883
|
-
return this.#
|
9419
|
+
get assertionMethodIds() {
|
9420
|
+
return this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
8884
9421
|
}
|
8885
|
-
/**
|
9422
|
+
/** Represents this actor's public keys. It serves as equivalent to
|
9423
|
+
* the `publicKeys` property, but is used for [FEP-521a] compliance.
|
9424
|
+
*
|
9425
|
+
* [FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
8886
9426
|
*/
|
8887
|
-
async *
|
8888
|
-
const vs = this.#
|
9427
|
+
async *getAssertionMethods(options = {}) {
|
9428
|
+
const vs = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
8889
9429
|
for (let i = 0; i < vs.length; i++) {
|
8890
9430
|
const v = vs[i];
|
8891
9431
|
if (v instanceof URL) {
|
8892
|
-
const fetched = await this.#
|
9432
|
+
const fetched = await this.#fetchAssertionMethod(v, options);
|
8893
9433
|
vs[i] = fetched;
|
8894
9434
|
yield fetched;
|
8895
9435
|
continue;
|
@@ -9270,6 +9810,13 @@ export class Group extends Object {
|
|
9270
9810
|
if (array.length > 0)
|
9271
9811
|
values["https://w3id.org/security#publicKey"] = array;
|
9272
9812
|
array = [];
|
9813
|
+
for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3) {
|
9814
|
+
array.push(v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options));
|
9815
|
+
}
|
9816
|
+
if (array.length > 0) {
|
9817
|
+
values["https://w3id.org/security#assertionMethod"] = array;
|
9818
|
+
}
|
9819
|
+
array = [];
|
9273
9820
|
for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA) {
|
9274
9821
|
array.push({ "@value": v });
|
9275
9822
|
}
|
@@ -9360,6 +9907,8 @@ export class Group extends Object {
|
|
9360
9907
|
return await jsonld.compact(values, [
|
9361
9908
|
"https://www.w3.org/ns/activitystreams",
|
9362
9909
|
"https://w3id.org/security/v1",
|
9910
|
+
"https://www.w3.org/ns/did/v1",
|
9911
|
+
"https://w3id.org/security/multikey/v1",
|
9363
9912
|
{
|
9364
9913
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
9365
9914
|
"toot": "http://joinmastodon.org/ns#",
|
@@ -9443,6 +9992,18 @@ export class Group extends Object {
|
|
9443
9992
|
_axq166E2eZADq34V4MYUc8KMZdC.push(await CryptographicKey.fromJsonLd(v, options));
|
9444
9993
|
}
|
9445
9994
|
instance.#_axq166E2eZADq34V4MYUc8KMZdC = _axq166E2eZADq34V4MYUc8KMZdC;
|
9995
|
+
const _4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [];
|
9996
|
+
for (const v of values["https://w3id.org/security#assertionMethod"] ?? []) {
|
9997
|
+
if (v == null)
|
9998
|
+
continue;
|
9999
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
10000
|
+
globalThis.Object.keys(v).length === 1) {
|
10001
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.push(new URL(v["@id"]));
|
10002
|
+
continue;
|
10003
|
+
}
|
10004
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.push(await Multikey.fromJsonLd(v, options));
|
10005
|
+
}
|
10006
|
+
instance.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = _4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
9446
10007
|
const _36QNc9MxfkKf6h8sEUQSHnV9NZA = [];
|
9447
10008
|
for (const v of values["https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers"] ?? []) {
|
9448
10009
|
if (v == null)
|
@@ -9593,6 +10154,22 @@ export class Group extends Object {
|
|
9593
10154
|
_axq166E2eZADq34V4MYUc8KMZdC.length > 0) {
|
9594
10155
|
proxy.publicKeys = _axq166E2eZADq34V4MYUc8KMZdC;
|
9595
10156
|
}
|
10157
|
+
const _4EHQFWZSz1k1d4LmPrQiMba2GbP3 = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3
|
10158
|
+
// deno-lint-ignore no-explicit-any
|
10159
|
+
.map((v) => v instanceof URL
|
10160
|
+
? {
|
10161
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
10162
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
10163
|
+
}
|
10164
|
+
: v);
|
10165
|
+
if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length == 1) {
|
10166
|
+
proxy.assertionMethod = _4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
10167
|
+
}
|
10168
|
+
if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length > 1 ||
|
10169
|
+
!("assertionMethod" in proxy) &&
|
10170
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length > 0) {
|
10171
|
+
proxy.assertionMethods = _4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
10172
|
+
}
|
9596
10173
|
const _36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA
|
9597
10174
|
// deno-lint-ignore no-explicit-any
|
9598
10175
|
.map((v) => v instanceof URL
|
@@ -11313,6 +11890,7 @@ export class Organization extends Object {
|
|
11313
11890
|
}
|
11314
11891
|
#_3isuDgRAKSntq9XdbjiNxjwyPZAf = [];
|
11315
11892
|
#_axq166E2eZADq34V4MYUc8KMZdC = [];
|
11893
|
+
#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [];
|
11316
11894
|
#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [];
|
11317
11895
|
#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = [];
|
11318
11896
|
#_41QwhqJouoLg3h8dRPKat21brynC = [];
|
@@ -11354,6 +11932,17 @@ export class Organization extends Object {
|
|
11354
11932
|
}
|
11355
11933
|
this.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys;
|
11356
11934
|
}
|
11935
|
+
if ("assertionMethod" in values && values.assertionMethod != null) {
|
11936
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [values.assertionMethod];
|
11937
|
+
}
|
11938
|
+
if ("assertionMethods" in values && values.assertionMethods != null) {
|
11939
|
+
if ("assertionMethod" in values &&
|
11940
|
+
values.assertionMethod != null) {
|
11941
|
+
throw new TypeError("Cannot initialize both assertionMethod and " +
|
11942
|
+
"assertionMethods at the same time.");
|
11943
|
+
}
|
11944
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = values.assertionMethods;
|
11945
|
+
}
|
11357
11946
|
if ("manuallyApprovesFollowers" in values &&
|
11358
11947
|
values.manuallyApprovesFollowers != null) {
|
11359
11948
|
this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [values.manuallyApprovesFollowers];
|
@@ -11424,6 +12013,18 @@ export class Organization extends Object {
|
|
11424
12013
|
}
|
11425
12014
|
clone.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys;
|
11426
12015
|
}
|
12016
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
12017
|
+
if ("assertionMethod" in values && values.assertionMethod != null) {
|
12018
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [values.assertionMethod];
|
12019
|
+
}
|
12020
|
+
if ("assertionMethods" in values && values.assertionMethods != null) {
|
12021
|
+
if ("assertionMethod" in values &&
|
12022
|
+
values.assertionMethod != null) {
|
12023
|
+
throw new TypeError("Cannot update both assertionMethod and " +
|
12024
|
+
"assertionMethods at the same time.");
|
12025
|
+
}
|
12026
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = values.assertionMethods;
|
12027
|
+
}
|
11427
12028
|
clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA;
|
11428
12029
|
if ("manuallyApprovesFollowers" in values &&
|
11429
12030
|
values.manuallyApprovesFollowers != null) {
|
@@ -11554,6 +12155,77 @@ export class Organization extends Object {
|
|
11554
12155
|
yield v;
|
11555
12156
|
}
|
11556
12157
|
}
|
12158
|
+
async #fetchAssertionMethod(url, options = {}) {
|
12159
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
12160
|
+
fetchDocumentLoader;
|
12161
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
12162
|
+
fetchDocumentLoader;
|
12163
|
+
const { document } = await documentLoader(url.href);
|
12164
|
+
try {
|
12165
|
+
return await Multikey.fromJsonLd(document, { documentLoader, contextLoader });
|
12166
|
+
}
|
12167
|
+
catch (e) {
|
12168
|
+
if (!(e instanceof TypeError))
|
12169
|
+
throw e;
|
12170
|
+
}
|
12171
|
+
throw new TypeError("Expected an object of any type of: " +
|
12172
|
+
["https://w3id.org/security#Multikey"].join(", "));
|
12173
|
+
}
|
12174
|
+
/**
|
12175
|
+
* Similar to
|
12176
|
+
* {@link Organization.getAssertionMethod},
|
12177
|
+
* but returns its `@id` URL instead of the object itself.
|
12178
|
+
*/
|
12179
|
+
get assertionMethodId() {
|
12180
|
+
if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length < 1)
|
12181
|
+
return null;
|
12182
|
+
const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
12183
|
+
if (v instanceof URL)
|
12184
|
+
return v;
|
12185
|
+
return v.id;
|
12186
|
+
}
|
12187
|
+
/** Represents this actor's public keys. It serves as equivalent to
|
12188
|
+
* the `publicKeys` property, but is used for [FEP-521a] compliance.
|
12189
|
+
*
|
12190
|
+
* [FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
12191
|
+
*/
|
12192
|
+
async getAssertionMethod(options = {}) {
|
12193
|
+
if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length < 1)
|
12194
|
+
return null;
|
12195
|
+
const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
12196
|
+
if (v instanceof URL) {
|
12197
|
+
const fetched = await this.#fetchAssertionMethod(v, options);
|
12198
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0] = fetched;
|
12199
|
+
return fetched;
|
12200
|
+
}
|
12201
|
+
return v;
|
12202
|
+
}
|
12203
|
+
/**
|
12204
|
+
* Similar to
|
12205
|
+
* {@link Organization.getAssertionMethods},
|
12206
|
+
* but returns their `@id`s instead of the objects themselves.
|
12207
|
+
*/
|
12208
|
+
get assertionMethodIds() {
|
12209
|
+
return this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
12210
|
+
}
|
12211
|
+
/** Represents this actor's public keys. It serves as equivalent to
|
12212
|
+
* the `publicKeys` property, but is used for [FEP-521a] compliance.
|
12213
|
+
*
|
12214
|
+
* [FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
12215
|
+
*/
|
12216
|
+
async *getAssertionMethods(options = {}) {
|
12217
|
+
const vs = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
12218
|
+
for (let i = 0; i < vs.length; i++) {
|
12219
|
+
const v = vs[i];
|
12220
|
+
if (v instanceof URL) {
|
12221
|
+
const fetched = await this.#fetchAssertionMethod(v, options);
|
12222
|
+
vs[i] = fetched;
|
12223
|
+
yield fetched;
|
12224
|
+
continue;
|
12225
|
+
}
|
12226
|
+
yield v;
|
12227
|
+
}
|
12228
|
+
}
|
11557
12229
|
/** When `true`, conveys that for this actor, follow requests are not usually
|
11558
12230
|
* automatically approved, but instead are examined by a person who may accept
|
11559
12231
|
* or reject the request, at some time in the future. Setting of `false`
|
@@ -11927,6 +12599,13 @@ export class Organization extends Object {
|
|
11927
12599
|
if (array.length > 0)
|
11928
12600
|
values["https://w3id.org/security#publicKey"] = array;
|
11929
12601
|
array = [];
|
12602
|
+
for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3) {
|
12603
|
+
array.push(v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options));
|
12604
|
+
}
|
12605
|
+
if (array.length > 0) {
|
12606
|
+
values["https://w3id.org/security#assertionMethod"] = array;
|
12607
|
+
}
|
12608
|
+
array = [];
|
11930
12609
|
for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA) {
|
11931
12610
|
array.push({ "@value": v });
|
11932
12611
|
}
|
@@ -12017,6 +12696,8 @@ export class Organization extends Object {
|
|
12017
12696
|
return await jsonld.compact(values, [
|
12018
12697
|
"https://www.w3.org/ns/activitystreams",
|
12019
12698
|
"https://w3id.org/security/v1",
|
12699
|
+
"https://www.w3.org/ns/did/v1",
|
12700
|
+
"https://w3id.org/security/multikey/v1",
|
12020
12701
|
{
|
12021
12702
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
12022
12703
|
"toot": "http://joinmastodon.org/ns#",
|
@@ -12100,6 +12781,18 @@ export class Organization extends Object {
|
|
12100
12781
|
_axq166E2eZADq34V4MYUc8KMZdC.push(await CryptographicKey.fromJsonLd(v, options));
|
12101
12782
|
}
|
12102
12783
|
instance.#_axq166E2eZADq34V4MYUc8KMZdC = _axq166E2eZADq34V4MYUc8KMZdC;
|
12784
|
+
const _4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [];
|
12785
|
+
for (const v of values["https://w3id.org/security#assertionMethod"] ?? []) {
|
12786
|
+
if (v == null)
|
12787
|
+
continue;
|
12788
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
12789
|
+
globalThis.Object.keys(v).length === 1) {
|
12790
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.push(new URL(v["@id"]));
|
12791
|
+
continue;
|
12792
|
+
}
|
12793
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.push(await Multikey.fromJsonLd(v, options));
|
12794
|
+
}
|
12795
|
+
instance.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = _4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
12103
12796
|
const _36QNc9MxfkKf6h8sEUQSHnV9NZA = [];
|
12104
12797
|
for (const v of values["https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers"] ?? []) {
|
12105
12798
|
if (v == null)
|
@@ -12250,6 +12943,22 @@ export class Organization extends Object {
|
|
12250
12943
|
_axq166E2eZADq34V4MYUc8KMZdC.length > 0) {
|
12251
12944
|
proxy.publicKeys = _axq166E2eZADq34V4MYUc8KMZdC;
|
12252
12945
|
}
|
12946
|
+
const _4EHQFWZSz1k1d4LmPrQiMba2GbP3 = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3
|
12947
|
+
// deno-lint-ignore no-explicit-any
|
12948
|
+
.map((v) => v instanceof URL
|
12949
|
+
? {
|
12950
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
12951
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
12952
|
+
}
|
12953
|
+
: v);
|
12954
|
+
if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length == 1) {
|
12955
|
+
proxy.assertionMethod = _4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
12956
|
+
}
|
12957
|
+
if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length > 1 ||
|
12958
|
+
!("assertionMethod" in proxy) &&
|
12959
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length > 0) {
|
12960
|
+
proxy.assertionMethods = _4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
12961
|
+
}
|
12253
12962
|
const _36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA
|
12254
12963
|
// deno-lint-ignore no-explicit-any
|
12255
12964
|
.map((v) => v instanceof URL
|
@@ -12512,6 +13221,7 @@ export class Person extends Object {
|
|
12512
13221
|
}
|
12513
13222
|
#_3isuDgRAKSntq9XdbjiNxjwyPZAf = [];
|
12514
13223
|
#_axq166E2eZADq34V4MYUc8KMZdC = [];
|
13224
|
+
#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [];
|
12515
13225
|
#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [];
|
12516
13226
|
#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = [];
|
12517
13227
|
#_41QwhqJouoLg3h8dRPKat21brynC = [];
|
@@ -12553,6 +13263,17 @@ export class Person extends Object {
|
|
12553
13263
|
}
|
12554
13264
|
this.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys;
|
12555
13265
|
}
|
13266
|
+
if ("assertionMethod" in values && values.assertionMethod != null) {
|
13267
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [values.assertionMethod];
|
13268
|
+
}
|
13269
|
+
if ("assertionMethods" in values && values.assertionMethods != null) {
|
13270
|
+
if ("assertionMethod" in values &&
|
13271
|
+
values.assertionMethod != null) {
|
13272
|
+
throw new TypeError("Cannot initialize both assertionMethod and " +
|
13273
|
+
"assertionMethods at the same time.");
|
13274
|
+
}
|
13275
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = values.assertionMethods;
|
13276
|
+
}
|
12556
13277
|
if ("manuallyApprovesFollowers" in values &&
|
12557
13278
|
values.manuallyApprovesFollowers != null) {
|
12558
13279
|
this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [values.manuallyApprovesFollowers];
|
@@ -12623,6 +13344,18 @@ export class Person extends Object {
|
|
12623
13344
|
}
|
12624
13345
|
clone.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys;
|
12625
13346
|
}
|
13347
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
13348
|
+
if ("assertionMethod" in values && values.assertionMethod != null) {
|
13349
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [values.assertionMethod];
|
13350
|
+
}
|
13351
|
+
if ("assertionMethods" in values && values.assertionMethods != null) {
|
13352
|
+
if ("assertionMethod" in values &&
|
13353
|
+
values.assertionMethod != null) {
|
13354
|
+
throw new TypeError("Cannot update both assertionMethod and " +
|
13355
|
+
"assertionMethods at the same time.");
|
13356
|
+
}
|
13357
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = values.assertionMethods;
|
13358
|
+
}
|
12626
13359
|
clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA;
|
12627
13360
|
if ("manuallyApprovesFollowers" in values &&
|
12628
13361
|
values.manuallyApprovesFollowers != null) {
|
@@ -12753,6 +13486,77 @@ export class Person extends Object {
|
|
12753
13486
|
yield v;
|
12754
13487
|
}
|
12755
13488
|
}
|
13489
|
+
async #fetchAssertionMethod(url, options = {}) {
|
13490
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
13491
|
+
fetchDocumentLoader;
|
13492
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
13493
|
+
fetchDocumentLoader;
|
13494
|
+
const { document } = await documentLoader(url.href);
|
13495
|
+
try {
|
13496
|
+
return await Multikey.fromJsonLd(document, { documentLoader, contextLoader });
|
13497
|
+
}
|
13498
|
+
catch (e) {
|
13499
|
+
if (!(e instanceof TypeError))
|
13500
|
+
throw e;
|
13501
|
+
}
|
13502
|
+
throw new TypeError("Expected an object of any type of: " +
|
13503
|
+
["https://w3id.org/security#Multikey"].join(", "));
|
13504
|
+
}
|
13505
|
+
/**
|
13506
|
+
* Similar to
|
13507
|
+
* {@link Person.getAssertionMethod},
|
13508
|
+
* but returns its `@id` URL instead of the object itself.
|
13509
|
+
*/
|
13510
|
+
get assertionMethodId() {
|
13511
|
+
if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length < 1)
|
13512
|
+
return null;
|
13513
|
+
const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
13514
|
+
if (v instanceof URL)
|
13515
|
+
return v;
|
13516
|
+
return v.id;
|
13517
|
+
}
|
13518
|
+
/** Represents this actor's public keys. It serves as equivalent to
|
13519
|
+
* the `publicKeys` property, but is used for [FEP-521a] compliance.
|
13520
|
+
*
|
13521
|
+
* [FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
13522
|
+
*/
|
13523
|
+
async getAssertionMethod(options = {}) {
|
13524
|
+
if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length < 1)
|
13525
|
+
return null;
|
13526
|
+
const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
13527
|
+
if (v instanceof URL) {
|
13528
|
+
const fetched = await this.#fetchAssertionMethod(v, options);
|
13529
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0] = fetched;
|
13530
|
+
return fetched;
|
13531
|
+
}
|
13532
|
+
return v;
|
13533
|
+
}
|
13534
|
+
/**
|
13535
|
+
* Similar to
|
13536
|
+
* {@link Person.getAssertionMethods},
|
13537
|
+
* but returns their `@id`s instead of the objects themselves.
|
13538
|
+
*/
|
13539
|
+
get assertionMethodIds() {
|
13540
|
+
return this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
13541
|
+
}
|
13542
|
+
/** Represents this actor's public keys. It serves as equivalent to
|
13543
|
+
* the `publicKeys` property, but is used for [FEP-521a] compliance.
|
13544
|
+
*
|
13545
|
+
* [FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
13546
|
+
*/
|
13547
|
+
async *getAssertionMethods(options = {}) {
|
13548
|
+
const vs = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
13549
|
+
for (let i = 0; i < vs.length; i++) {
|
13550
|
+
const v = vs[i];
|
13551
|
+
if (v instanceof URL) {
|
13552
|
+
const fetched = await this.#fetchAssertionMethod(v, options);
|
13553
|
+
vs[i] = fetched;
|
13554
|
+
yield fetched;
|
13555
|
+
continue;
|
13556
|
+
}
|
13557
|
+
yield v;
|
13558
|
+
}
|
13559
|
+
}
|
12756
13560
|
/** When `true`, conveys that for this actor, follow requests are not usually
|
12757
13561
|
* automatically approved, but instead are examined by a person who may accept
|
12758
13562
|
* or reject the request, at some time in the future. Setting of `false`
|
@@ -13126,6 +13930,13 @@ export class Person extends Object {
|
|
13126
13930
|
if (array.length > 0)
|
13127
13931
|
values["https://w3id.org/security#publicKey"] = array;
|
13128
13932
|
array = [];
|
13933
|
+
for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3) {
|
13934
|
+
array.push(v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options));
|
13935
|
+
}
|
13936
|
+
if (array.length > 0) {
|
13937
|
+
values["https://w3id.org/security#assertionMethod"] = array;
|
13938
|
+
}
|
13939
|
+
array = [];
|
13129
13940
|
for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA) {
|
13130
13941
|
array.push({ "@value": v });
|
13131
13942
|
}
|
@@ -13216,6 +14027,8 @@ export class Person extends Object {
|
|
13216
14027
|
return await jsonld.compact(values, [
|
13217
14028
|
"https://www.w3.org/ns/activitystreams",
|
13218
14029
|
"https://w3id.org/security/v1",
|
14030
|
+
"https://www.w3.org/ns/did/v1",
|
14031
|
+
"https://w3id.org/security/multikey/v1",
|
13219
14032
|
{
|
13220
14033
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
13221
14034
|
"toot": "http://joinmastodon.org/ns#",
|
@@ -13299,6 +14112,18 @@ export class Person extends Object {
|
|
13299
14112
|
_axq166E2eZADq34V4MYUc8KMZdC.push(await CryptographicKey.fromJsonLd(v, options));
|
13300
14113
|
}
|
13301
14114
|
instance.#_axq166E2eZADq34V4MYUc8KMZdC = _axq166E2eZADq34V4MYUc8KMZdC;
|
14115
|
+
const _4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [];
|
14116
|
+
for (const v of values["https://w3id.org/security#assertionMethod"] ?? []) {
|
14117
|
+
if (v == null)
|
14118
|
+
continue;
|
14119
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
14120
|
+
globalThis.Object.keys(v).length === 1) {
|
14121
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.push(new URL(v["@id"]));
|
14122
|
+
continue;
|
14123
|
+
}
|
14124
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.push(await Multikey.fromJsonLd(v, options));
|
14125
|
+
}
|
14126
|
+
instance.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = _4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
13302
14127
|
const _36QNc9MxfkKf6h8sEUQSHnV9NZA = [];
|
13303
14128
|
for (const v of values["https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers"] ?? []) {
|
13304
14129
|
if (v == null)
|
@@ -13449,6 +14274,22 @@ export class Person extends Object {
|
|
13449
14274
|
_axq166E2eZADq34V4MYUc8KMZdC.length > 0) {
|
13450
14275
|
proxy.publicKeys = _axq166E2eZADq34V4MYUc8KMZdC;
|
13451
14276
|
}
|
14277
|
+
const _4EHQFWZSz1k1d4LmPrQiMba2GbP3 = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3
|
14278
|
+
// deno-lint-ignore no-explicit-any
|
14279
|
+
.map((v) => v instanceof URL
|
14280
|
+
? {
|
14281
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
14282
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
14283
|
+
}
|
14284
|
+
: v);
|
14285
|
+
if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length == 1) {
|
14286
|
+
proxy.assertionMethod = _4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
14287
|
+
}
|
14288
|
+
if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length > 1 ||
|
14289
|
+
!("assertionMethod" in proxy) &&
|
14290
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length > 0) {
|
14291
|
+
proxy.assertionMethods = _4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
14292
|
+
}
|
13452
14293
|
const _36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA
|
13453
14294
|
// deno-lint-ignore no-explicit-any
|
13454
14295
|
.map((v) => v instanceof URL
|
@@ -14843,6 +15684,7 @@ export class Service extends Object {
|
|
14843
15684
|
}
|
14844
15685
|
#_3isuDgRAKSntq9XdbjiNxjwyPZAf = [];
|
14845
15686
|
#_axq166E2eZADq34V4MYUc8KMZdC = [];
|
15687
|
+
#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [];
|
14846
15688
|
#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [];
|
14847
15689
|
#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = [];
|
14848
15690
|
#_41QwhqJouoLg3h8dRPKat21brynC = [];
|
@@ -14884,6 +15726,17 @@ export class Service extends Object {
|
|
14884
15726
|
}
|
14885
15727
|
this.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys;
|
14886
15728
|
}
|
15729
|
+
if ("assertionMethod" in values && values.assertionMethod != null) {
|
15730
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [values.assertionMethod];
|
15731
|
+
}
|
15732
|
+
if ("assertionMethods" in values && values.assertionMethods != null) {
|
15733
|
+
if ("assertionMethod" in values &&
|
15734
|
+
values.assertionMethod != null) {
|
15735
|
+
throw new TypeError("Cannot initialize both assertionMethod and " +
|
15736
|
+
"assertionMethods at the same time.");
|
15737
|
+
}
|
15738
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = values.assertionMethods;
|
15739
|
+
}
|
14887
15740
|
if ("manuallyApprovesFollowers" in values &&
|
14888
15741
|
values.manuallyApprovesFollowers != null) {
|
14889
15742
|
this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [values.manuallyApprovesFollowers];
|
@@ -14954,6 +15807,18 @@ export class Service extends Object {
|
|
14954
15807
|
}
|
14955
15808
|
clone.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys;
|
14956
15809
|
}
|
15810
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
15811
|
+
if ("assertionMethod" in values && values.assertionMethod != null) {
|
15812
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [values.assertionMethod];
|
15813
|
+
}
|
15814
|
+
if ("assertionMethods" in values && values.assertionMethods != null) {
|
15815
|
+
if ("assertionMethod" in values &&
|
15816
|
+
values.assertionMethod != null) {
|
15817
|
+
throw new TypeError("Cannot update both assertionMethod and " +
|
15818
|
+
"assertionMethods at the same time.");
|
15819
|
+
}
|
15820
|
+
clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = values.assertionMethods;
|
15821
|
+
}
|
14957
15822
|
clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA;
|
14958
15823
|
if ("manuallyApprovesFollowers" in values &&
|
14959
15824
|
values.manuallyApprovesFollowers != null) {
|
@@ -15084,6 +15949,77 @@ export class Service extends Object {
|
|
15084
15949
|
yield v;
|
15085
15950
|
}
|
15086
15951
|
}
|
15952
|
+
async #fetchAssertionMethod(url, options = {}) {
|
15953
|
+
const documentLoader = options.documentLoader ?? this._documentLoader ??
|
15954
|
+
fetchDocumentLoader;
|
15955
|
+
const contextLoader = options.contextLoader ?? this._contextLoader ??
|
15956
|
+
fetchDocumentLoader;
|
15957
|
+
const { document } = await documentLoader(url.href);
|
15958
|
+
try {
|
15959
|
+
return await Multikey.fromJsonLd(document, { documentLoader, contextLoader });
|
15960
|
+
}
|
15961
|
+
catch (e) {
|
15962
|
+
if (!(e instanceof TypeError))
|
15963
|
+
throw e;
|
15964
|
+
}
|
15965
|
+
throw new TypeError("Expected an object of any type of: " +
|
15966
|
+
["https://w3id.org/security#Multikey"].join(", "));
|
15967
|
+
}
|
15968
|
+
/**
|
15969
|
+
* Similar to
|
15970
|
+
* {@link Service.getAssertionMethod},
|
15971
|
+
* but returns its `@id` URL instead of the object itself.
|
15972
|
+
*/
|
15973
|
+
get assertionMethodId() {
|
15974
|
+
if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length < 1)
|
15975
|
+
return null;
|
15976
|
+
const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
15977
|
+
if (v instanceof URL)
|
15978
|
+
return v;
|
15979
|
+
return v.id;
|
15980
|
+
}
|
15981
|
+
/** Represents this actor's public keys. It serves as equivalent to
|
15982
|
+
* the `publicKeys` property, but is used for [FEP-521a] compliance.
|
15983
|
+
*
|
15984
|
+
* [FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
15985
|
+
*/
|
15986
|
+
async getAssertionMethod(options = {}) {
|
15987
|
+
if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length < 1)
|
15988
|
+
return null;
|
15989
|
+
const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
15990
|
+
if (v instanceof URL) {
|
15991
|
+
const fetched = await this.#fetchAssertionMethod(v, options);
|
15992
|
+
this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3[0] = fetched;
|
15993
|
+
return fetched;
|
15994
|
+
}
|
15995
|
+
return v;
|
15996
|
+
}
|
15997
|
+
/**
|
15998
|
+
* Similar to
|
15999
|
+
* {@link Service.getAssertionMethods},
|
16000
|
+
* but returns their `@id`s instead of the objects themselves.
|
16001
|
+
*/
|
16002
|
+
get assertionMethodIds() {
|
16003
|
+
return this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
|
16004
|
+
}
|
16005
|
+
/** Represents this actor's public keys. It serves as equivalent to
|
16006
|
+
* the `publicKeys` property, but is used for [FEP-521a] compliance.
|
16007
|
+
*
|
16008
|
+
* [FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
16009
|
+
*/
|
16010
|
+
async *getAssertionMethods(options = {}) {
|
16011
|
+
const vs = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
16012
|
+
for (let i = 0; i < vs.length; i++) {
|
16013
|
+
const v = vs[i];
|
16014
|
+
if (v instanceof URL) {
|
16015
|
+
const fetched = await this.#fetchAssertionMethod(v, options);
|
16016
|
+
vs[i] = fetched;
|
16017
|
+
yield fetched;
|
16018
|
+
continue;
|
16019
|
+
}
|
16020
|
+
yield v;
|
16021
|
+
}
|
16022
|
+
}
|
15087
16023
|
/** When `true`, conveys that for this actor, follow requests are not usually
|
15088
16024
|
* automatically approved, but instead are examined by a person who may accept
|
15089
16025
|
* or reject the request, at some time in the future. Setting of `false`
|
@@ -15457,6 +16393,13 @@ export class Service extends Object {
|
|
15457
16393
|
if (array.length > 0)
|
15458
16394
|
values["https://w3id.org/security#publicKey"] = array;
|
15459
16395
|
array = [];
|
16396
|
+
for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3) {
|
16397
|
+
array.push(v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options));
|
16398
|
+
}
|
16399
|
+
if (array.length > 0) {
|
16400
|
+
values["https://w3id.org/security#assertionMethod"] = array;
|
16401
|
+
}
|
16402
|
+
array = [];
|
15460
16403
|
for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA) {
|
15461
16404
|
array.push({ "@value": v });
|
15462
16405
|
}
|
@@ -15547,6 +16490,8 @@ export class Service extends Object {
|
|
15547
16490
|
return await jsonld.compact(values, [
|
15548
16491
|
"https://www.w3.org/ns/activitystreams",
|
15549
16492
|
"https://w3id.org/security/v1",
|
16493
|
+
"https://www.w3.org/ns/did/v1",
|
16494
|
+
"https://w3id.org/security/multikey/v1",
|
15550
16495
|
{
|
15551
16496
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
15552
16497
|
"toot": "http://joinmastodon.org/ns#",
|
@@ -15630,6 +16575,18 @@ export class Service extends Object {
|
|
15630
16575
|
_axq166E2eZADq34V4MYUc8KMZdC.push(await CryptographicKey.fromJsonLd(v, options));
|
15631
16576
|
}
|
15632
16577
|
instance.#_axq166E2eZADq34V4MYUc8KMZdC = _axq166E2eZADq34V4MYUc8KMZdC;
|
16578
|
+
const _4EHQFWZSz1k1d4LmPrQiMba2GbP3 = [];
|
16579
|
+
for (const v of values["https://w3id.org/security#assertionMethod"] ?? []) {
|
16580
|
+
if (v == null)
|
16581
|
+
continue;
|
16582
|
+
if (typeof v === "object" && "@id" in v && !("@type" in v) &&
|
16583
|
+
globalThis.Object.keys(v).length === 1) {
|
16584
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.push(new URL(v["@id"]));
|
16585
|
+
continue;
|
16586
|
+
}
|
16587
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.push(await Multikey.fromJsonLd(v, options));
|
16588
|
+
}
|
16589
|
+
instance.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3 = _4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
15633
16590
|
const _36QNc9MxfkKf6h8sEUQSHnV9NZA = [];
|
15634
16591
|
for (const v of values["https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers"] ?? []) {
|
15635
16592
|
if (v == null)
|
@@ -15780,6 +16737,22 @@ export class Service extends Object {
|
|
15780
16737
|
_axq166E2eZADq34V4MYUc8KMZdC.length > 0) {
|
15781
16738
|
proxy.publicKeys = _axq166E2eZADq34V4MYUc8KMZdC;
|
15782
16739
|
}
|
16740
|
+
const _4EHQFWZSz1k1d4LmPrQiMba2GbP3 = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3
|
16741
|
+
// deno-lint-ignore no-explicit-any
|
16742
|
+
.map((v) => v instanceof URL
|
16743
|
+
? {
|
16744
|
+
[Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
|
16745
|
+
[Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
|
16746
|
+
}
|
16747
|
+
: v);
|
16748
|
+
if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length == 1) {
|
16749
|
+
proxy.assertionMethod = _4EHQFWZSz1k1d4LmPrQiMba2GbP3[0];
|
16750
|
+
}
|
16751
|
+
if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length > 1 ||
|
16752
|
+
!("assertionMethod" in proxy) &&
|
16753
|
+
_4EHQFWZSz1k1d4LmPrQiMba2GbP3.length > 0) {
|
16754
|
+
proxy.assertionMethods = _4EHQFWZSz1k1d4LmPrQiMba2GbP3;
|
16755
|
+
}
|
15783
16756
|
const _36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA
|
15784
16757
|
// deno-lint-ignore no-explicit-any
|
15785
16758
|
.map((v) => v instanceof URL
|