@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/CHANGES.md
CHANGED
@@ -18,7 +18,7 @@ To be released.
|
|
18
18
|
- The `importSpki()` function now accepts Ed25519 keys.
|
19
19
|
- The `exportJwk()` function now exports Ed25519 keys.
|
20
20
|
|
21
|
-
- Now multiple key pairs can be registered for an actor.
|
21
|
+
- Now multiple key pairs can be registered for an actor. [[FEP-521a], [#55]]
|
22
22
|
|
23
23
|
- Added `Context.getActorKeyPairs()` method.
|
24
24
|
- Deprecated `Context.getActorKey()` method.
|
@@ -31,6 +31,45 @@ To be released.
|
|
31
31
|
- Deprecated the third parameter of the `ActorDispatcher` callback type.
|
32
32
|
Use `Context.getActorKeyPairs()` method instead.
|
33
33
|
|
34
|
+
- Added `Multikey` class to Activity Vocabulary API. [[FEP-521a], [#55]]
|
35
|
+
|
36
|
+
- Added `importMultibaseKey()` function.
|
37
|
+
- Added `exportMultibaseKey()` function.
|
38
|
+
|
39
|
+
- Added `assertionMethod` property to the `Actor` types in the Activity
|
40
|
+
Vocabulary API. [[FEP-521a], [#55]]
|
41
|
+
|
42
|
+
- Added `Application.getAssertionMethod()` method.
|
43
|
+
- Added `Application.getAssertionMethods()` method.
|
44
|
+
- `new Application()` constructor now accepts `assertionMethod` option.
|
45
|
+
- `new Application()` constructor now accepts `assertionMethods` option.
|
46
|
+
- `Application.clone()` method now accepts `assertionMethod` option.
|
47
|
+
- `Application.clone()` method now accepts `assertionMethods` option.
|
48
|
+
- Added `Group.getAssertionMethod()` method.
|
49
|
+
- Added `Group.getAssertionMethods()` method.
|
50
|
+
- `new Group()` constructor now accepts `assertionMethod` option.
|
51
|
+
- `new Group()` constructor now accepts `assertionMethods` option.
|
52
|
+
- `Group.clone()` method now accepts `assertionMethod` option.
|
53
|
+
- `Group.clone()` method now accepts `assertionMethods` option.
|
54
|
+
- Added `Organization.getAssertionMethod()` method.
|
55
|
+
- Added `Organization.getAssertionMethods()` method.
|
56
|
+
- `new Organization()` constructor now accepts `assertionMethod` option.
|
57
|
+
- `new Organization()` constructor now accepts `assertionMethods` option.
|
58
|
+
- `Organization.clone()` method now accepts `assertionMethod` option.
|
59
|
+
- `Organization.clone()` method now accepts `assertionMethods` option.
|
60
|
+
- Added `Person.getAssertionMethod()` method.
|
61
|
+
- Added `Person.getAssertionMethods()` method.
|
62
|
+
- `new Person()` constructor now accepts `assertionMethod` option.
|
63
|
+
- `new Person()` constructor now accepts `assertionMethods` option.
|
64
|
+
- `Person.clone()` method now accepts `assertionMethod` option.
|
65
|
+
- `Person.clone()` method now accepts `assertionMethods` option.
|
66
|
+
- Added `Service.getAssertionMethod()` method.
|
67
|
+
- Added `Service.getAssertionMethods()` method.
|
68
|
+
- `new Service()` constructor now accepts `assertionMethod` option.
|
69
|
+
- `new Service()` constructor now accepts `assertionMethods` option.
|
70
|
+
- `Service.clone()` method now accepts `assertionMethod` option.
|
71
|
+
- `Service.clone()` method now accepts `assertionMethods` option.
|
72
|
+
|
34
73
|
- Deprecated `treatHttps` option in `FederationParameters` interface.
|
35
74
|
Instead, use the [x-forwarded-fetch] library to recognize the
|
36
75
|
`X-Forwarded-Host` and `X-Forwarded-Proto` headers.
|
@@ -43,6 +82,7 @@ To be released.
|
|
43
82
|
`url`.
|
44
83
|
|
45
84
|
[#55]: https://github.com/dahlia/fedify/issues/55
|
85
|
+
[FEP-521a]: https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md
|
46
86
|
[x-forwarded-fetch]: https://github.com/dahlia/x-forwarded-fetch
|
47
87
|
|
48
88
|
|
@@ -0,0 +1,83 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Utilities for
|
5
|
+
* {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-5 | base64url}
|
6
|
+
* encoding and decoding.
|
7
|
+
*
|
8
|
+
* This module is browser compatible.
|
9
|
+
*
|
10
|
+
* @module
|
11
|
+
*/
|
12
|
+
import * as base64 from "./base64.js";
|
13
|
+
/**
|
14
|
+
* Some variants allow or require omitting the padding '=' signs:
|
15
|
+
* https://en.wikipedia.org/wiki/Base64#The_URL_applications
|
16
|
+
*
|
17
|
+
* @param base64url
|
18
|
+
*/
|
19
|
+
function addPaddingToBase64url(base64url) {
|
20
|
+
if (base64url.length % 4 === 2)
|
21
|
+
return base64url + "==";
|
22
|
+
if (base64url.length % 4 === 3)
|
23
|
+
return base64url + "=";
|
24
|
+
if (base64url.length % 4 === 1) {
|
25
|
+
throw new TypeError("Illegal base64url string!");
|
26
|
+
}
|
27
|
+
return base64url;
|
28
|
+
}
|
29
|
+
function convertBase64urlToBase64(b64url) {
|
30
|
+
if (!/^[-_A-Z0-9]*?={0,2}$/i.test(b64url)) {
|
31
|
+
// Contains characters not part of base64url spec.
|
32
|
+
throw new TypeError("Failed to decode base64url: invalid character");
|
33
|
+
}
|
34
|
+
return addPaddingToBase64url(b64url).replace(/\-/g, "+").replace(/_/g, "/");
|
35
|
+
}
|
36
|
+
function convertBase64ToBase64url(b64) {
|
37
|
+
return b64.endsWith("=")
|
38
|
+
? b64.endsWith("==")
|
39
|
+
? b64.replace(/\+/g, "-").replace(/\//g, "_").slice(0, -2)
|
40
|
+
: b64.replace(/\+/g, "-").replace(/\//g, "_").slice(0, -1)
|
41
|
+
: b64.replace(/\+/g, "-").replace(/\//g, "_");
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Convert data into a base64url-encoded string.
|
45
|
+
*
|
46
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-5}
|
47
|
+
*
|
48
|
+
* @param data The data to encode.
|
49
|
+
* @returns The base64url-encoded string.
|
50
|
+
*
|
51
|
+
* @example Usage
|
52
|
+
* ```ts
|
53
|
+
* import { encodeBase64Url } from "@std/encoding/base64url";
|
54
|
+
* import { assertEquals } from "@std/assert/assert-equals";
|
55
|
+
*
|
56
|
+
* assertEquals(encodeBase64Url("foobar"), "Zm9vYmFy");
|
57
|
+
* ```
|
58
|
+
*/
|
59
|
+
export function encodeBase64Url(data) {
|
60
|
+
return convertBase64ToBase64url(base64.encodeBase64(data));
|
61
|
+
}
|
62
|
+
/**
|
63
|
+
* Decodes a given base64url-encoded string.
|
64
|
+
*
|
65
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-5}
|
66
|
+
*
|
67
|
+
* @param b64url The base64url-encoded string to decode.
|
68
|
+
* @returns The decoded data.
|
69
|
+
*
|
70
|
+
* @example Usage
|
71
|
+
* ```ts
|
72
|
+
* import { decodeBase64Url } from "@std/encoding/base64url";
|
73
|
+
* import { assertEquals } from "@std/assert/assert-equals";
|
74
|
+
*
|
75
|
+
* assertEquals(
|
76
|
+
* decodeBase64Url("Zm9vYmFy"),
|
77
|
+
* new TextEncoder().encode("foobar")
|
78
|
+
* );
|
79
|
+
* ```
|
80
|
+
*/
|
81
|
+
export function decodeBase64Url(b64url) {
|
82
|
+
return base64.decodeBase64(convertBase64urlToBase64(b64url));
|
83
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
2
|
import { getLogger } from "@logtape/logtape";
|
3
|
-
import { accepts } from "../deps/jsr.io/@std/http/0.224.
|
3
|
+
import { accepts } from "../deps/jsr.io/@std/http/0.224.4/negotiation.js";
|
4
4
|
import { verifyRequest } from "../sig/http.js";
|
5
5
|
import { doesActorOwnKey } from "../sig/owner.js";
|
6
6
|
import { Activity, Link, Object, OrderedCollection, OrderedCollectionPage, } from "../vocab/vocab.js";
|