@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.
Files changed (179) hide show
  1. package/CHANGES.md +41 -1
  2. package/esm/deps/jsr.io/@std/encoding/0.224.3/base64url.js +83 -0
  3. package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/mod.js +1 -1
  4. package/esm/federation/handler.js +1 -1
  5. package/esm/federation/middleware.js +435 -347
  6. package/esm/nodeinfo/types.js +1 -1
  7. package/esm/runtime/key.js +82 -0
  8. package/esm/testing/fixtures/w3id.org/security/multikey/v1 +35 -0
  9. package/esm/testing/fixtures/www.w3.org/ns/did/v1 +58 -0
  10. package/esm/vocab/application.yaml +15 -1
  11. package/esm/vocab/group.yaml +15 -1
  12. package/esm/vocab/multikey.yaml +33 -0
  13. package/esm/vocab/organization.yaml +15 -1
  14. package/esm/vocab/person.yaml +15 -1
  15. package/esm/vocab/service.yaml +15 -1
  16. package/esm/vocab/vocab.js +986 -13
  17. package/package.json +4 -1
  18. package/types/codegen/type.d.ts.map +1 -1
  19. package/types/deps/jsr.io/@std/async/{0.224.1 → 0.224.2}/delay.d.ts.map +1 -1
  20. package/types/deps/jsr.io/@std/encoding/0.224.3/base64url.d.ts +38 -0
  21. package/types/deps/jsr.io/@std/encoding/0.224.3/base64url.d.ts.map +1 -0
  22. package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/common.d.ts.map +1 -1
  23. package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/encoding.d.ts.map +1 -1
  24. package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/language.d.ts.map +1 -1
  25. package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/media_type.d.ts.map +1 -1
  26. package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/negotiation.d.ts.map +1 -1
  27. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/assert_path.d.ts.map +1 -0
  28. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/basename.d.ts.map +1 -0
  29. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/constants.d.ts.map +1 -0
  30. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/dirname.d.ts.map +1 -0
  31. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/normalize.d.ts.map +1 -0
  32. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/normalize_string.d.ts.map +1 -0
  33. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/_common/strip_trailing_separators.d.ts.map +1 -0
  34. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/_util.d.ts.map +1 -0
  35. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/basename.d.ts.map +1 -0
  36. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/dirname.d.ts.map +1 -0
  37. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/extname.d.ts.map +1 -0
  38. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/join.d.ts.map +1 -0
  39. package/types/deps/jsr.io/@std/path/1.0.0-rc.1/posix/normalize.d.ts.map +1 -0
  40. package/types/deps/jsr.io/@std/semver/0.224.3/_constants.d.ts.map +1 -0
  41. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_shared.d.ts.map +1 -1
  42. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_test_comparator_set.d.ts.map +1 -1
  43. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/can_parse.d.ts.map +1 -1
  44. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/compare.d.ts.map +1 -1
  45. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/constants.d.ts.map +1 -1
  46. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/difference.d.ts.map +1 -1
  47. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/equals.d.ts.map +1 -1
  48. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format.d.ts.map +1 -1
  49. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format_range.d.ts.map +1 -1
  50. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_or_equal.d.ts.map +1 -1
  51. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than.d.ts.map +1 -1
  52. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than_range.d.ts.map +1 -1
  53. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/increment.d.ts.map +1 -1
  54. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_range.d.ts.map +1 -1
  55. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_semver.d.ts.map +1 -1
  56. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_or_equal.d.ts.map +1 -1
  57. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than.d.ts.map +1 -1
  58. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than_range.d.ts.map +1 -1
  59. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/max_satisfying.d.ts.map +1 -1
  60. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/min_satisfying.d.ts.map +1 -1
  61. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/mod.d.ts +1 -1
  62. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/mod.d.ts.map +1 -1
  63. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/not_equals.d.ts.map +1 -1
  64. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse.d.ts.map +1 -1
  65. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse_range.d.ts.map +1 -1
  66. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_intersects.d.ts.map +1 -1
  67. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_max.d.ts.map +1 -1
  68. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_min.d.ts.map +1 -1
  69. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/satisfies.d.ts.map +1 -1
  70. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/test_range.d.ts.map +1 -1
  71. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse.d.ts.map +1 -1
  72. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse_range.d.ts.map +1 -1
  73. package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/types.d.ts.map +1 -1
  74. package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/_util.d.ts.map +1 -1
  75. package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/case.d.ts.map +1 -1
  76. package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/closest_string.d.ts.map +1 -1
  77. package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/compare_similarity.d.ts.map +1 -1
  78. package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/levenshtein_distance.d.ts.map +1 -1
  79. package/types/deps/jsr.io/@std/text/0.224.3/mod.d.ts.map +1 -0
  80. package/types/deps/jsr.io/@std/text/{0.224.2 → 0.224.3}/word_similarity_sort.d.ts.map +1 -1
  81. package/types/deps/jsr.io/@std/url/{0.224.0 → 0.224.1}/_strip.d.ts.map +1 -1
  82. package/types/deps/jsr.io/@std/url/0.224.1/basename.d.ts.map +1 -0
  83. package/types/deps/jsr.io/@std/url/0.224.1/dirname.d.ts.map +1 -0
  84. package/types/deps/jsr.io/@std/url/0.224.1/extname.d.ts.map +1 -0
  85. package/types/deps/jsr.io/@std/url/0.224.1/join.d.ts.map +1 -0
  86. package/types/deps/jsr.io/@std/url/0.224.1/mod.d.ts.map +1 -0
  87. package/types/deps/jsr.io/@std/url/0.224.1/normalize.d.ts.map +1 -0
  88. package/types/federation/context.d.ts +6 -1
  89. package/types/federation/context.d.ts.map +1 -1
  90. package/types/federation/middleware.d.ts.map +1 -1
  91. package/types/nodeinfo/types.d.ts +1 -1
  92. package/types/runtime/key.d.ts +20 -0
  93. package/types/runtime/key.d.ts.map +1 -1
  94. package/types/vocab/vocab.d.ts +249 -0
  95. package/types/vocab/vocab.d.ts.map +1 -1
  96. package/types/deps/jsr.io/@std/assert/0.226.0/assert.d.ts.map +0 -1
  97. package/types/deps/jsr.io/@std/assert/0.226.0/assertion_error.d.ts.map +0 -1
  98. package/types/deps/jsr.io/@std/semver/0.224.2/_constants.d.ts.map +0 -1
  99. package/types/deps/jsr.io/@std/text/0.224.2/mod.d.ts.map +0 -1
  100. package/types/deps/jsr.io/@std/url/0.224.0/basename.d.ts.map +0 -1
  101. package/types/deps/jsr.io/@std/url/0.224.0/dirname.d.ts.map +0 -1
  102. package/types/deps/jsr.io/@std/url/0.224.0/extname.d.ts.map +0 -1
  103. package/types/deps/jsr.io/@std/url/0.224.0/join.d.ts.map +0 -1
  104. package/types/deps/jsr.io/@std/url/0.224.0/mod.d.ts.map +0 -1
  105. package/types/deps/jsr.io/@std/url/0.224.0/normalize.d.ts.map +0 -1
  106. /package/esm/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/common.js +0 -0
  107. /package/esm/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/encoding.js +0 -0
  108. /package/esm/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/language.js +0 -0
  109. /package/esm/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/media_type.js +0 -0
  110. /package/esm/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/negotiation.js +0 -0
  111. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_constants.js +0 -0
  112. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_shared.js +0 -0
  113. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_test_comparator_set.js +0 -0
  114. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/can_parse.js +0 -0
  115. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/compare.js +0 -0
  116. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/constants.js +0 -0
  117. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/difference.js +0 -0
  118. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/equals.js +0 -0
  119. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format.js +0 -0
  120. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format_range.js +0 -0
  121. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_or_equal.js +0 -0
  122. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than.js +0 -0
  123. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than_range.js +0 -0
  124. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/increment.js +0 -0
  125. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_range.js +0 -0
  126. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_semver.js +0 -0
  127. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_or_equal.js +0 -0
  128. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than.js +0 -0
  129. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than_range.js +0 -0
  130. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/max_satisfying.js +0 -0
  131. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/min_satisfying.js +0 -0
  132. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/not_equals.js +0 -0
  133. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse.js +0 -0
  134. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse_range.js +0 -0
  135. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_intersects.js +0 -0
  136. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_max.js +0 -0
  137. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_min.js +0 -0
  138. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/satisfies.js +0 -0
  139. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/test_range.js +0 -0
  140. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse.js +0 -0
  141. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse_range.js +0 -0
  142. /package/esm/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/types.js +0 -0
  143. /package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/common.d.ts +0 -0
  144. /package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/encoding.d.ts +0 -0
  145. /package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/language.d.ts +0 -0
  146. /package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/_negotiation/media_type.d.ts +0 -0
  147. /package/types/deps/jsr.io/@std/http/{0.224.3 → 0.224.4}/negotiation.d.ts +0 -0
  148. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_constants.d.ts +0 -0
  149. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_shared.d.ts +0 -0
  150. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/_test_comparator_set.d.ts +0 -0
  151. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/can_parse.d.ts +0 -0
  152. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/compare.d.ts +0 -0
  153. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/constants.d.ts +0 -0
  154. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/difference.d.ts +0 -0
  155. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/equals.d.ts +0 -0
  156. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format.d.ts +0 -0
  157. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/format_range.d.ts +0 -0
  158. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_or_equal.d.ts +0 -0
  159. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than.d.ts +0 -0
  160. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/greater_than_range.d.ts +0 -0
  161. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/increment.d.ts +0 -0
  162. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_range.d.ts +0 -0
  163. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/is_semver.d.ts +0 -0
  164. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_or_equal.d.ts +0 -0
  165. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than.d.ts +0 -0
  166. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/less_than_range.d.ts +0 -0
  167. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/max_satisfying.d.ts +0 -0
  168. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/min_satisfying.d.ts +0 -0
  169. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/not_equals.d.ts +0 -0
  170. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse.d.ts +0 -0
  171. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/parse_range.d.ts +0 -0
  172. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_intersects.d.ts +0 -0
  173. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_max.d.ts +0 -0
  174. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/range_min.d.ts +0 -0
  175. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/satisfies.d.ts +0 -0
  176. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/test_range.d.ts +0 -0
  177. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse.d.ts +0 -0
  178. /package/types/deps/jsr.io/@std/semver/{0.224.2 → 0.224.3}/try_parse_range.d.ts +0 -0
  179. /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
+ }
@@ -269,7 +269,7 @@
269
269
  * If you want to know if a version satisfies or does not satisfy a range, use the
270
270
  * {@linkcode satisfies} function.
271
271
  *
272
- * This module is browser compatible.
272
+ *
273
273
  *
274
274
 
275
275
  *
@@ -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/negotiation.js";
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";