repocairn 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/README.md +13 -2
  2. package/dist/graphify-source.d.ts +17 -0
  3. package/dist/graphify-source.js +87 -0
  4. package/dist/graphify-source.js.map +1 -0
  5. package/dist/index-command.js +3 -1
  6. package/dist/index-command.js.map +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/indexer.d.ts +1 -0
  11. package/dist/indexer.js +2 -1
  12. package/dist/indexer.js.map +1 -1
  13. package/dist/signals.d.ts +13 -0
  14. package/dist/signals.js +84 -0
  15. package/dist/signals.js.map +1 -0
  16. package/dist/tree-sitter-extract.js +134 -1
  17. package/dist/tree-sitter-extract.js.map +1 -1
  18. package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  19. package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  20. package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  21. package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  22. package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  23. package/node_modules/eventsource-parser/dist/index.cjs +2 -2
  24. package/node_modules/eventsource-parser/dist/index.cjs.map +1 -1
  25. package/node_modules/eventsource-parser/dist/index.js +2 -2
  26. package/node_modules/eventsource-parser/dist/index.js.map +1 -1
  27. package/node_modules/eventsource-parser/package.json +1 -1
  28. package/node_modules/eventsource-parser/src/parse.ts +4 -2
  29. package/node_modules/express-rate-limit/dist/index.cjs +6 -1
  30. package/node_modules/express-rate-limit/dist/index.mjs +6 -1
  31. package/node_modules/express-rate-limit/package.json +6 -6
  32. package/node_modules/fast-uri/index.js +37 -1
  33. package/node_modules/fast-uri/package.json +1 -1
  34. package/node_modules/fast-uri/test/security.test.js +136 -0
  35. package/node_modules/hono/dist/cjs/client/client.js +3 -3
  36. package/node_modules/hono/dist/cjs/client/utils.js +1 -1
  37. package/node_modules/hono/dist/cjs/context.js +32 -13
  38. package/node_modules/hono/dist/cjs/helper/proxy/index.js +4 -0
  39. package/node_modules/hono/dist/cjs/hono-base.js +3 -2
  40. package/node_modules/hono/dist/cjs/jsx/base.js +27 -23
  41. package/node_modules/hono/dist/cjs/jsx/hooks/index.js +16 -13
  42. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +1 -1
  43. package/node_modules/hono/dist/cjs/middleware/cache/index.js +103 -8
  44. package/node_modules/hono/dist/cjs/middleware/compress/index.js +5 -0
  45. package/node_modules/hono/dist/cjs/middleware/cors/index.js +17 -14
  46. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
  47. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +47 -1
  48. package/node_modules/hono/dist/cjs/middleware/etag/index.js +6 -3
  49. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +9 -4
  50. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +9 -4
  51. package/node_modules/hono/dist/cjs/middleware/language/language.js +10 -6
  52. package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +90 -0
  53. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +3 -1
  54. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +6 -3
  55. package/node_modules/hono/dist/cjs/request.js +6 -8
  56. package/node_modules/hono/dist/cjs/router/linear-router/router.js +7 -2
  57. package/node_modules/hono/dist/cjs/router/pattern-router/router.js +3 -9
  58. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +55 -56
  59. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +64 -85
  60. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +13 -5
  61. package/node_modules/hono/dist/cjs/router/trie-router/node.js +44 -68
  62. package/node_modules/hono/dist/cjs/router/trie-router/router.js +3 -11
  63. package/node_modules/hono/dist/cjs/router.js +1 -1
  64. package/node_modules/hono/dist/cjs/utils/cookie.js +3 -2
  65. package/node_modules/hono/dist/cjs/utils/ipaddr.js +5 -3
  66. package/node_modules/hono/dist/cjs/utils/stream.js +5 -2
  67. package/node_modules/hono/dist/cjs/utils/url.js +9 -9
  68. package/node_modules/hono/dist/client/client.js +3 -3
  69. package/node_modules/hono/dist/client/utils.js +1 -1
  70. package/node_modules/hono/dist/context.js +32 -13
  71. package/node_modules/hono/dist/helper/proxy/index.js +4 -0
  72. package/node_modules/hono/dist/hono-base.js +3 -2
  73. package/node_modules/hono/dist/jsx/base.js +27 -23
  74. package/node_modules/hono/dist/jsx/hooks/index.js +16 -13
  75. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +1 -1
  76. package/node_modules/hono/dist/middleware/cache/index.js +103 -8
  77. package/node_modules/hono/dist/middleware/compress/index.js +5 -0
  78. package/node_modules/hono/dist/middleware/cors/index.js +17 -14
  79. package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
  80. package/node_modules/hono/dist/middleware/etag/digest.js +47 -1
  81. package/node_modules/hono/dist/middleware/etag/index.js +6 -3
  82. package/node_modules/hono/dist/middleware/jwk/jwk.js +9 -4
  83. package/node_modules/hono/dist/middleware/jwt/jwt.js +9 -4
  84. package/node_modules/hono/dist/middleware/language/language.js +10 -6
  85. package/node_modules/hono/dist/middleware/method-not-allowed/index.js +68 -0
  86. package/node_modules/hono/dist/middleware/pretty-json/index.js +3 -1
  87. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +6 -3
  88. package/node_modules/hono/dist/request.js +7 -9
  89. package/node_modules/hono/dist/router/linear-router/router.js +7 -2
  90. package/node_modules/hono/dist/router/pattern-router/router.js +3 -9
  91. package/node_modules/hono/dist/router/reg-exp-router/node.js +55 -56
  92. package/node_modules/hono/dist/router/reg-exp-router/router.js +64 -85
  93. package/node_modules/hono/dist/router/reg-exp-router/trie.js +13 -5
  94. package/node_modules/hono/dist/router/trie-router/node.js +44 -68
  95. package/node_modules/hono/dist/router/trie-router/router.js +3 -11
  96. package/node_modules/hono/dist/router.js +1 -1
  97. package/node_modules/hono/dist/types/client/types.d.ts +1 -1
  98. package/node_modules/hono/dist/types/context.d.ts +4 -0
  99. package/node_modules/hono/dist/types/hono-base.d.ts +4 -3
  100. package/node_modules/hono/dist/types/jsx/base.d.ts +4 -2
  101. package/node_modules/hono/dist/types/jsx/dom/index.d.ts +5 -5
  102. package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +2 -2
  103. package/node_modules/hono/dist/types/jsx/dom/server.d.ts +5 -5
  104. package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +8 -6
  105. package/node_modules/hono/dist/types/jsx/index.d.ts +5 -5
  106. package/node_modules/hono/dist/types/middleware/cache/index.d.ts +6 -4
  107. package/node_modules/hono/dist/types/middleware/cors/index.d.ts +1 -1
  108. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +2 -2
  109. package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +2 -0
  110. package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +2 -0
  111. package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +49 -0
  112. package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +3 -3
  113. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +1 -1
  114. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +2 -1
  115. package/node_modules/hono/dist/types/router/trie-router/node.d.ts +1 -2
  116. package/node_modules/hono/dist/types/router/trie-router/router.d.ts +0 -1
  117. package/node_modules/hono/dist/types/router.d.ts +1 -1
  118. package/node_modules/hono/dist/types/utils/headers.d.ts +2 -2
  119. package/node_modules/hono/dist/types/utils/url.d.ts +1 -0
  120. package/node_modules/hono/dist/utils/cookie.js +4 -3
  121. package/node_modules/hono/dist/utils/ipaddr.js +5 -3
  122. package/node_modules/hono/dist/utils/stream.js +5 -2
  123. package/node_modules/hono/dist/utils/url.js +7 -8
  124. package/node_modules/hono/package.json +10 -3
  125. package/node_modules/ip-address/README.md +163 -149
  126. package/node_modules/ip-address/dist/address-error.d.ts +11 -0
  127. package/node_modules/ip-address/dist/address-error.js.map +1 -1
  128. package/node_modules/ip-address/dist/common.d.ts +6 -0
  129. package/node_modules/ip-address/dist/common.js +17 -1
  130. package/node_modules/ip-address/dist/common.js.map +1 -1
  131. package/node_modules/ip-address/dist/ipv4.d.ts +22 -6
  132. package/node_modules/ip-address/dist/ipv4.js +25 -18
  133. package/node_modules/ip-address/dist/ipv4.js.map +1 -1
  134. package/node_modules/ip-address/dist/ipv6.d.ts +19 -5
  135. package/node_modules/ip-address/dist/ipv6.js +61 -33
  136. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  137. package/node_modules/ip-address/package.json +5 -3
  138. package/node_modules/jose/README.md +13 -13
  139. package/node_modules/jose/dist/types/index.d.ts +6 -5
  140. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +17 -11
  141. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +8 -19
  142. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +17 -11
  143. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +8 -19
  144. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +18 -13
  145. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +21 -21
  146. package/node_modules/jose/dist/types/jwk/embedded.d.ts +8 -12
  147. package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +0 -15
  148. package/node_modules/jose/dist/types/jwks/local.d.ts +12 -21
  149. package/node_modules/jose/dist/types/jwks/remote.d.ts +34 -165
  150. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +2 -13
  151. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +17 -13
  152. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +2 -13
  153. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +17 -13
  154. package/node_modules/jose/dist/types/jws/general/sign.d.ts +16 -17
  155. package/node_modules/jose/dist/types/jws/general/verify.d.ts +18 -15
  156. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +17 -11
  157. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +11 -34
  158. package/node_modules/jose/dist/types/jwt/sign.d.ts +2 -13
  159. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +4 -13
  160. package/node_modules/jose/dist/types/jwt/verify.d.ts +14 -13
  161. package/node_modules/jose/dist/types/key/export.d.ts +0 -14
  162. package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +7 -14
  163. package/node_modules/jose/dist/types/key/generate_secret.d.ts +16 -14
  164. package/node_modules/jose/dist/types/key/import.d.ts +18 -28
  165. package/node_modules/jose/dist/types/types.d.ts +243 -224
  166. package/node_modules/jose/dist/types/util/base64url.d.ts +11 -4
  167. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -9
  168. package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +0 -8
  169. package/node_modules/jose/dist/types/util/errors.d.ts +128 -121
  170. package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +4 -22
  171. package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +5 -153
  172. package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +16 -111
  173. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +23 -3
  174. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +70 -82
  175. package/node_modules/jose/dist/webapi/jwk/embedded.js +5 -3
  176. package/node_modules/jose/dist/webapi/jwks/local.js +32 -73
  177. package/node_modules/jose/dist/webapi/jwks/remote.js +19 -28
  178. package/node_modules/jose/dist/webapi/jws/compact/sign.js +5 -2
  179. package/node_modules/jose/dist/webapi/jws/compact/verify.js +4 -16
  180. package/node_modules/jose/dist/webapi/jws/flattened/sign.js +7 -65
  181. package/node_modules/jose/dist/webapi/jws/flattened/verify.js +3 -89
  182. package/node_modules/jose/dist/webapi/jws/general/sign.js +19 -15
  183. package/node_modules/jose/dist/webapi/jws/general/verify.js +29 -9
  184. package/node_modules/jose/dist/webapi/jwt/decrypt.js +5 -5
  185. package/node_modules/jose/dist/webapi/jwt/sign.js +2 -3
  186. package/node_modules/jose/dist/webapi/jwt/unsecured.js +4 -3
  187. package/node_modules/jose/dist/webapi/jwt/verify.js +6 -6
  188. package/node_modules/jose/dist/webapi/key/export.js +37 -4
  189. package/node_modules/jose/dist/webapi/key/generate_key_pair.js +33 -82
  190. package/node_modules/jose/dist/webapi/key/generate_secret.js +2 -2
  191. package/node_modules/jose/dist/webapi/key/import.js +8 -8
  192. package/node_modules/jose/dist/webapi/lib/asn1.js +53 -122
  193. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +1 -0
  194. package/node_modules/jose/dist/webapi/lib/content_encryption.js +34 -109
  195. package/node_modules/jose/dist/webapi/lib/crypto_key.js +18 -126
  196. package/node_modules/jose/dist/webapi/lib/helpers.js +23 -0
  197. package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +0 -1
  198. package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +107 -0
  199. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +186 -0
  200. package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +114 -0
  201. package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +8 -98
  202. package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +73 -0
  203. package/node_modules/jose/dist/webapi/lib/jws_sign.js +74 -0
  204. package/node_modules/jose/dist/webapi/lib/jws_verify.js +107 -0
  205. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +68 -109
  206. package/node_modules/jose/dist/webapi/lib/key.js +132 -0
  207. package/node_modules/jose/dist/webapi/lib/key_algorithm.js +10 -0
  208. package/node_modules/jose/dist/webapi/lib/key_descriptor.js +7 -0
  209. package/node_modules/jose/dist/webapi/lib/key_management.js +162 -92
  210. package/node_modules/jose/dist/webapi/lib/options.js +48 -0
  211. package/node_modules/jose/dist/webapi/lib/signing.js +14 -56
  212. package/node_modules/jose/dist/webapi/lib/type_checks.js +13 -18
  213. package/node_modules/jose/dist/webapi/util/base64url.js +13 -4
  214. package/node_modules/jose/dist/webapi/util/decode_jwt.js +2 -2
  215. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -15
  216. package/node_modules/jose/dist/webapi/util/errors.js +1 -1
  217. package/node_modules/jose/package.json +2 -4
  218. package/node_modules/type-is/node_modules/content-type/README.md +2 -0
  219. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  220. package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  221. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  222. package/node_modules/type-is/node_modules/content-type/package.json +1 -1
  223. package/package.json +5 -3
  224. package/node_modules/jose/dist/webapi/lib/aesgcmkw.js +0 -15
  225. package/node_modules/jose/dist/webapi/lib/aeskw.js +0 -25
  226. package/node_modules/jose/dist/webapi/lib/check_key_type.js +0 -122
  227. package/node_modules/jose/dist/webapi/lib/ecdhes.js +0 -52
  228. package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +0 -34
  229. package/node_modules/jose/dist/webapi/lib/normalize_key.js +0 -166
  230. package/node_modules/jose/dist/webapi/lib/pbes2kw.js +0 -42
  231. package/node_modules/jose/dist/webapi/lib/rsaes.js +0 -24
  232. package/node_modules/jose/dist/webapi/lib/validate_algorithms.js +0 -10
  233. package/node_modules/jose/dist/webapi/lib/validate_crit.js +0 -33
@@ -1,19 +1,85 @@
1
- /** Generic JSON Web Key Parameters. */
2
- export interface JWKParameters {
1
+ /**
2
+ * JWS "alg" (Algorithm) Header Parameter values supported by this module. Availability of a given
3
+ * identifier additionally depends on the runtime.
4
+ */
5
+ export type JWSAlgorithm =
6
+ | 'HS256'
7
+ | 'HS384'
8
+ | 'HS512'
9
+ | 'RS256'
10
+ | 'RS384'
11
+ | 'RS512'
12
+ | 'PS256'
13
+ | 'PS384'
14
+ | 'PS512'
15
+ | 'ES256'
16
+ | 'ES384'
17
+ | 'ES512'
18
+ | 'EdDSA'
19
+ | 'Ed25519'
20
+ | 'ML-DSA-44'
21
+ | 'ML-DSA-65'
22
+ | 'ML-DSA-87'
23
+ | (string & {})
24
+
25
+ /**
26
+ * JWE "alg" (Algorithm) Header Parameter values supported by this module. Availability of a given
27
+ * identifier additionally depends on the runtime.
28
+ */
29
+ export type JWEKeyManagementAlgorithm =
30
+ | 'dir'
31
+ | 'A128KW'
32
+ | 'A192KW'
33
+ | 'A256KW'
34
+ | 'A128GCMKW'
35
+ | 'A192GCMKW'
36
+ | 'A256GCMKW'
37
+ | 'ECDH-ES'
38
+ | 'ECDH-ES+A128KW'
39
+ | 'ECDH-ES+A192KW'
40
+ | 'ECDH-ES+A256KW'
41
+ | 'RSA-OAEP'
42
+ | 'RSA-OAEP-256'
43
+ | 'RSA-OAEP-384'
44
+ | 'RSA-OAEP-512'
45
+ | 'PBES2-HS256+A128KW'
46
+ | 'PBES2-HS384+A192KW'
47
+ | 'PBES2-HS512+A256KW'
48
+ | (string & {})
49
+
50
+ /**
51
+ * JWE "enc" (Encryption Algorithm) Header Parameter values supported by this module. Availability
52
+ * of a given identifier additionally depends on the runtime.
53
+ */
54
+ export type JWEContentEncryptionAlgorithm =
55
+ | 'A128CBC-HS256'
56
+ | 'A192CBC-HS384'
57
+ | 'A256CBC-HS512'
58
+ | 'A128GCM'
59
+ | 'A192GCM'
60
+ | 'A256GCM'
61
+ | (string & {})
62
+
63
+ /** JWK "kty" (Key Type) Parameter values supported by this module. */
64
+ export type JWKKeyType = 'EC' | 'RSA' | 'OKP' | 'AKP' | 'oct' | (string & {})
65
+
66
+ /**
67
+ * Generic JSON Web Key Parameters.
68
+ *
69
+ * > Note: This is declared as a type alias rather than an interface so that it satisfies the implicit index
70
+ * > signature of the `JsonWebKey` types shipped by `@types/node` and `lib.dom`.
71
+ */
72
+ export type JWKParameters = {
3
73
  /** JWK "kty" (Key Type) Parameter */
4
- kty?: string
5
- /**
6
- * JWK "alg" (Algorithm) Parameter
7
- *
8
- * @see {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}
9
- */
10
- alg?: string
74
+ kty?: JWKKeyType
75
+ /** JWK "alg" (Algorithm) Parameter */
76
+ alg?: JWSAlgorithm | JWEKeyManagementAlgorithm | JWEContentEncryptionAlgorithm
11
77
  /** JWK "key_ops" (Key Operations) Parameter */
12
78
  key_ops?: string[]
13
79
  /** JWK "ext" (Extractable) Parameter */
14
80
  ext?: boolean
15
81
  /** JWK "use" (Public Key Use) Parameter */
16
- use?: string
82
+ use?: 'sig' | 'enc' | (string & {})
17
83
  /** JWK "x5c" (X.509 Certificate Chain) Parameter */
18
84
  x5c?: string[]
19
85
  /** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter */
@@ -101,20 +167,35 @@ export interface JWK_oct extends JWKParameters {
101
167
  }
102
168
 
103
169
  /**
104
- * JSON Web Key ({@link https://www.rfc-editor.org/rfc/rfc7517 JWK}). "RSA", "EC", "OKP", "AKP", and
105
- * "oct" key types are supported.
170
+ * JSON Web Key ({@link https://www.rfc-editor.org/info/rfc7517/ JWK}). "RSA", "EC", "OKP", "AKP",
171
+ * and "oct" key types are supported.
106
172
  *
107
- * @see {@link JWK_AKP_Public}
108
- * @see {@link JWK_AKP_Private}
109
- * @see {@link JWK_OKP_Public}
110
- * @see {@link JWK_OKP_Private}
111
- * @see {@link JWK_EC_Public}
112
- * @see {@link JWK_EC_Private}
113
- * @see {@link JWK_RSA_Public}
114
- * @see {@link JWK_RSA_Private}
115
- * @see {@link JWK_oct}
173
+ * > Note: This is declared as a type alias rather than an interface so that it satisfies the implicit index
174
+ * > signature of the `JsonWebKey` types shipped by `@types/node` and `lib.dom`. It spells out the
175
+ * > {@link JWKParameters} members rather than intersecting them so that every JWK member is documented
176
+ * > in one place.
116
177
  */
117
- export interface JWK extends JWKParameters {
178
+ export type JWK = {
179
+ /** JWK "kty" (Key Type) Parameter */
180
+ kty?: JWKKeyType
181
+ /** JWK "alg" (Algorithm) Parameter */
182
+ alg?: JWSAlgorithm | JWEKeyManagementAlgorithm | JWEContentEncryptionAlgorithm
183
+ /** JWK "key_ops" (Key Operations) Parameter */
184
+ key_ops?: string[]
185
+ /** JWK "ext" (Extractable) Parameter */
186
+ ext?: boolean
187
+ /** JWK "use" (Public Key Use) Parameter */
188
+ use?: 'sig' | 'enc' | (string & {})
189
+ /** JWK "x5c" (X.509 Certificate Chain) Parameter */
190
+ x5c?: string[]
191
+ /** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter */
192
+ x5t?: string
193
+ /** JWK "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter */
194
+ 'x5t#S256'?: string
195
+ /** JWK "x5u" (X.509 URL) Parameter */
196
+ x5u?: string
197
+ /** JWK "kid" (Key ID) Parameter */
198
+ kid?: string
118
199
  /**
119
200
  * - EC JWK "crv" (Curve) Parameter
120
201
  * - OKP JWK "crv" (The Subtype of Key Pair) Parameter
@@ -153,19 +234,47 @@ export interface JWK extends JWKParameters {
153
234
  pub?: string
154
235
  /** AKP JWK "priv" (Private key) Parameter */
155
236
  priv?: string
237
+ /**
238
+ * RSA JWK "oth" (Other Primes Info) Parameter
239
+ *
240
+ * > Note: Multi-prime RSA keys are not supported; importing a JWK with this parameter present throws.
241
+ */
242
+ oth?: Array<{
243
+ /** The Factor CRT Exponent */
244
+ d?: string
245
+ /** The Prime Factor */
246
+ r?: string
247
+ /** The Factor CRT Coefficient */
248
+ t?: string
249
+ }>
156
250
  }
157
251
 
158
252
  /**
159
- * @private
160
- *
161
- * @internal
253
+ * Discriminated union of the JSON Web Key shapes supported by this module. Unlike {@link JWK}, each
254
+ * member requires and fixes the "kty" (Key Type) Parameter to its key type so that the union can be
255
+ * narrowed on it.
162
256
  */
257
+ // The "kty" is intersected into each arm one at a time rather than distributed over a parenthesised
258
+ // union - `X & (A | B)` means the same thing, but typedoc renders it without the parentheses, which
259
+ // reads as though the second arm carried no "kty" at all.
260
+ export type AnyJWK =
261
+ | (JWK_EC_Private & { kty: 'EC' })
262
+ | (JWK_EC_Public & { kty: 'EC' })
263
+ | (JWK_RSA_Private & { kty: 'RSA' })
264
+ | (JWK_RSA_Public & { kty: 'RSA' })
265
+ | (JWK_OKP_Private & { kty: 'OKP' })
266
+ | (JWK_OKP_Public & { kty: 'OKP' })
267
+ | (JWK_AKP_Private & { kty: 'AKP' })
268
+ | (JWK_AKP_Public & { kty: 'AKP' })
269
+ | (JWK_oct & { kty: 'oct' })
270
+
271
+ /** Key or secret input accepted by all sign, verify, encrypt, and decrypt operations. */
272
+ export type KeyInput = CryptoKey | KeyObject | JWK | Uint8Array
273
+
163
274
  export interface GenericGetKeyFunction<IProtectedHeader, IToken, ReturnKeyTypes> {
164
275
  /**
165
276
  * Dynamic key resolution function. No token components have been verified at the time of this
166
- * function call.
167
- *
168
- * If a suitable key for the token cannot be matched, throw an error instead.
277
+ * function call. If a suitable key for the token cannot be matched, throw an error instead.
169
278
  *
170
279
  * @param protectedHeader JWE or JWS Protected Header.
171
280
  * @param token The consumed JWE or JWS token.
@@ -173,17 +282,12 @@ export interface GenericGetKeyFunction<IProtectedHeader, IToken, ReturnKeyTypes>
173
282
  (protectedHeader: IProtectedHeader, token: IToken): Promise<ReturnKeyTypes> | ReturnKeyTypes
174
283
  }
175
284
 
176
- /**
177
- * Generic Interface for consuming operations dynamic key resolution.
178
- *
179
- * @param IProtectedHeader Type definition of the JWE or JWS Protected Header.
180
- * @param IToken Type definition of the consumed JWE or JWS token.
181
- */
182
- export interface GetKeyFunction<IProtectedHeader, IToken> extends GenericGetKeyFunction<
285
+ /** Interface for consuming operations dynamic key resolution. */
286
+ export interface GetKeyFunction<
183
287
  IProtectedHeader,
184
288
  IToken,
185
- CryptoKey | KeyObject | JWK | Uint8Array
186
- > {}
289
+ KeyTypes extends KeyInput = KeyInput,
290
+ > extends GenericGetKeyFunction<IProtectedHeader, IToken, KeyTypes> {}
187
291
 
188
292
  /**
189
293
  * Flattened JWS definition for verify function inputs, allows payload as {@link !Uint8Array} for
@@ -222,7 +326,7 @@ export interface FlattenedJWSInput {
222
326
  export interface GeneralJWSInput {
223
327
  /**
224
328
  * The "payload" member MUST be present and contain the value BASE64URL(JWS Payload). When when
225
- * JWS Unencoded Payload ({@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}) "b64": false is
329
+ * JWS Unencoded Payload ({@link https://www.rfc-editor.org/info/rfc7797/ RFC7797}) "b64": false is
226
330
  * used the value passed may also be a {@link !Uint8Array}.
227
331
  */
228
332
  payload: string | Uint8Array
@@ -236,7 +340,7 @@ export interface GeneralJWSInput {
236
340
 
237
341
  /**
238
342
  * Flattened JWS JSON Serialization Syntax token. Payload is returned as an empty string when JWS
239
- * Unencoded Payload ({@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}) is used.
343
+ * Unencoded Payload ({@link https://www.rfc-editor.org/info/rfc7797/ RFC7797}) is used.
240
344
  */
241
345
  export interface FlattenedJWS extends Partial<FlattenedJWSInput> {
242
346
  payload: string
@@ -245,7 +349,7 @@ export interface FlattenedJWS extends Partial<FlattenedJWSInput> {
245
349
 
246
350
  /**
247
351
  * General JWS JSON Serialization Syntax token. Payload is returned as an empty string when JWS
248
- * Unencoded Payload ({@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}) is used.
352
+ * Unencoded Payload ({@link https://www.rfc-editor.org/info/rfc7797/ RFC7797}) is used.
249
353
  */
250
354
  export interface GeneralJWS {
251
355
  payload: string
@@ -269,8 +373,11 @@ export interface JoseHeaderParameters {
269
373
  /** "jku" (JWK Set URL) Header Parameter */
270
374
  jku?: string
271
375
 
272
- /** "jwk" (JSON Web Key) Header Parameter */
273
- jwk?: Pick<JWK, 'kty' | 'crv' | 'x' | 'y' | 'e' | 'n' | 'alg' | 'pub'>
376
+ /**
377
+ * "jwk" (JSON Web Key) Header Parameter. This must be a public JSON Web Key; private and
378
+ * symmetric key parameters are not permitted.
379
+ */
380
+ jwk?: Omit<JWK, 'd' | 'dp' | 'dq' | 'k' | 'p' | 'q' | 'qi' | 'priv' | 'oth'>
274
381
 
275
382
  /** "typ" (Type) Header Parameter */
276
383
  typ?: string
@@ -281,16 +388,12 @@ export interface JoseHeaderParameters {
281
388
 
282
389
  /** Recognized JWS Header Parameters, any other Header Members may also be present. */
283
390
  export interface JWSHeaderParameters extends JoseHeaderParameters {
284
- /**
285
- * JWS "alg" (Algorithm) Header Parameter
286
- *
287
- * @see {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}
288
- */
289
- alg?: string
391
+ /** JWS "alg" (Algorithm) Header Parameter */
392
+ alg?: JWSAlgorithm
290
393
 
291
394
  /**
292
395
  * This JWS Extension Header Parameter modifies the JWS Payload representation and the JWS Signing
293
- * Input computation as per {@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}.
396
+ * Input computation as per {@link https://www.rfc-editor.org/info/rfc7797/ RFC7797}.
294
397
  */
295
398
  b64?: boolean
296
399
 
@@ -314,11 +417,13 @@ export interface JWEKeyManagementHeaderParameters {
314
417
  * used in ECDH's ConcatKDF.
315
418
  */
316
419
  apv?: Uint8Array
420
+
317
421
  /**
318
- * @deprecated You should not use this parameter. It is only intended for testing and vector
319
- * validation purposes.
422
+ * PBES2 "p2c" (PBES2 Count). This will be used as a JOSE Header Parameter and as the PBKDF2
423
+ * iteration count.
320
424
  */
321
425
  p2c?: number
426
+
322
427
  /**
323
428
  * @deprecated You should not use this parameter. It is only intended for testing and vector
324
429
  * validation purposes.
@@ -397,32 +502,21 @@ export interface GeneralJWE extends Omit<FlattenedJWE, 'encrypted_key' | 'header
397
502
 
398
503
  /** Recognized JWE Header Parameters, any other Header members may also be present. */
399
504
  export interface JWEHeaderParameters extends JoseHeaderParameters {
400
- /**
401
- * JWE "alg" (Algorithm) Header Parameter
402
- *
403
- * @see {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}
404
- */
405
- alg?: string
505
+ /** JWE "alg" (Algorithm) Header Parameter */
506
+ alg?: JWEKeyManagementAlgorithm
406
507
 
407
- /**
408
- * JWE "enc" (Encryption Algorithm) Header Parameter
409
- *
410
- * @see {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}
411
- */
412
- enc?: string
508
+ /** JWE "enc" (Encryption Algorithm) Header Parameter */
509
+ enc?: JWEContentEncryptionAlgorithm
413
510
 
414
511
  /** JWE "crit" (Critical) Header Parameter */
415
512
  crit?: string[]
416
513
 
417
514
  /**
418
- * JWE "zip" (Compression Algorithm) Header Parameter.
419
- *
420
- * The only supported value is `"DEF"` (DEFLATE). Requires the `CompressionStream` /
421
- * `DecompressionStream` APIs to be available in the runtime.
422
- *
423
- * @see {@link https://www.rfc-editor.org/rfc/rfc7516#section-4.1.3 JWE "zip" Header Parameter}
515
+ * JWE "zip" (Compression Algorithm) Header Parameter. The only supported value is `"DEF"`
516
+ * (DEFLATE), and it requires the `CompressionStream` / `DecompressionStream` APIs to be available
517
+ * in the runtime.
424
518
  */
425
- zip?: string
519
+ zip?: 'DEF' | (string & {})
426
520
 
427
521
  /** Any other JWE Header member. */
428
522
  [propName: string]: unknown
@@ -433,20 +527,14 @@ export interface CritOption {
433
527
  /**
434
528
  * An object with keys representing recognized "crit" (Critical) Header Parameter names. The value
435
529
  * for those is either `true` or `false`. `true` when the Header Parameter MUST be integrity
436
- * protected, `false` when it's irrelevant.
437
- *
438
- * This makes the "Extension Header Parameter "..." is not recognized" error go away.
530
+ * protected, `false` when it's irrelevant. The JWS extension Header Parameter `b64` is always
531
+ * recognized and processed properly; no other registered Header Parameters currently receive this
532
+ * built-in treatment.
439
533
  *
440
- * Use this when a given JWS/JWT/JWE profile requires the use of proprietary non-registered "crit"
441
- * (Critical) Header Parameters. This will only make sure the Header Parameter is syntactically
442
- * correct when provided and that it is optionally integrity protected. It will not process the
443
- * Header Parameter in any way or reject the operation if it is missing. You MUST still verify the
444
- * Header Parameter was present and process it according to the profile's validation steps after
445
- * the operation succeeds.
446
- *
447
- * The JWS extension Header Parameter `b64` is always recognized and processed properly. No other
448
- * registered Header Parameters that need this kind of default built-in treatment are currently
449
- * available.
534
+ * > Warning: This only checks that the Header Parameter is syntactically correct when provided and,
535
+ * > optionally, integrity protected. It does not process the Header Parameter or reject the
536
+ * > operation when it is missing. You MUST still verify its presence and process it according to
537
+ * > the profile's validation steps after the operation succeeds.
450
538
  */
451
539
  crit?: {
452
540
  [propName: string]: boolean
@@ -460,13 +548,13 @@ export interface DecryptOptions extends CritOption {
460
548
  * (Algorithm) Header Parameter values applicable for the used key/secret are allowed except for
461
549
  * all PBES2 Key Management Algorithms, these need to be explicitly allowed using this option.
462
550
  */
463
- keyManagementAlgorithms?: string[]
551
+ keyManagementAlgorithms?: JWEKeyManagementAlgorithm[]
464
552
 
465
553
  /**
466
554
  * A list of accepted JWE "enc" (Encryption Algorithm) Header Parameter values. By default all
467
555
  * "enc" (Encryption Algorithm) values applicable for the used key/secret are allowed.
468
556
  */
469
- contentEncryptionAlgorithms?: string[]
557
+ contentEncryptionAlgorithms?: JWEContentEncryptionAlgorithm[]
470
558
 
471
559
  /**
472
560
  * (PBES2 Key Management Algorithms only) Maximum allowed "p2c" (PBES2 Count) Header Parameter
@@ -478,11 +566,8 @@ export interface DecryptOptions extends CritOption {
478
566
  /**
479
567
  * Maximum allowed size (in bytes) of the decompressed plaintext when the JWE `"zip"` (Compression
480
568
  * Algorithm) Header Parameter is present. By default this value is set to 250000 (250 KB). The
481
- * value must be `0`, a positive safe integer, or `Infinity`.
482
- *
483
- * Set to `0` to reject all compressed JWEs during decryption.
484
- *
485
- * Set to `Infinity` to disable the decompressed size limit.
569
+ * value must be `0`, a positive safe integer, or `Infinity`. Set it to `0` to reject all
570
+ * compressed JWEs during decryption or to `Infinity` to disable the decompressed size limit.
486
571
  */
487
572
  maxDecompressedLength?: number
488
573
  }
@@ -493,51 +578,41 @@ export interface EncryptOptions extends CritOption {}
493
578
  /** JWT Claims Set verification options. */
494
579
  export interface JWTClaimVerificationOptions {
495
580
  /**
496
- * Expected JWT "aud" (Audience) Claim value(s).
497
- *
498
- * This option makes the JWT "aud" (Audience) Claim presence required.
581
+ * Expected JWT "aud" (Audience) Claim value(s). This option makes the JWT "aud" (Audience) Claim
582
+ * presence required.
499
583
  */
500
584
  audience?: string | string[]
501
585
 
502
586
  /**
503
- * Clock skew tolerance
504
- *
505
- * - In seconds when number (e.g. 5)
506
- * - Resolved into a number of seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours").
507
- *
508
- * Used when validating the JWT "nbf" (Not Before) and "exp" (Expiration Time) claims, and when
509
- * validating the "iat" (Issued At) claim if the {@link maxTokenAge `maxTokenAge` option} is set.
587
+ * Clock skew tolerance in seconds when a number (e.g. 5), or resolved into seconds when a string
588
+ * (e.g. "5 seconds", "10 minutes", "2 hours"). Used when validating the JWT "nbf" (Not Before)
589
+ * and "exp" (Expiration Time) claims, and when validating the "iat" (Issued At) claim if the
590
+ * {@link maxTokenAge `maxTokenAge` option} is set.
510
591
  */
511
592
  clockTolerance?: string | number
512
593
 
513
594
  /**
514
- * Expected JWT "iss" (Issuer) Claim value(s).
515
- *
516
- * This option makes the JWT "iss" (Issuer) Claim presence required.
595
+ * Expected JWT "iss" (Issuer) Claim value(s). This option makes the JWT "iss" (Issuer) Claim
596
+ * presence required.
517
597
  */
518
598
  issuer?: string | string[]
519
599
 
520
600
  /**
521
- * Maximum time elapsed (in seconds) from the JWT "iat" (Issued At) Claim value.
522
- *
523
- * - In seconds when number (e.g. 5)
524
- * - Resolved into a number of seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours").
525
- *
526
- * This option makes the JWT "iat" (Issued At) Claim presence required.
601
+ * Maximum time elapsed from the JWT "iat" (Issued At) Claim value, in seconds when a number (e.g.
602
+ * 5), or resolved into seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours"). This
603
+ * option makes the JWT "iat" (Issued At) Claim presence required.
527
604
  */
528
605
  maxTokenAge?: string | number
529
606
 
530
607
  /**
531
- * Expected JWT "sub" (Subject) Claim value.
532
- *
533
- * This option makes the JWT "sub" (Subject) Claim presence required.
608
+ * Expected JWT "sub" (Subject) Claim value. This option makes the JWT "sub" (Subject) Claim
609
+ * presence required.
534
610
  */
535
611
  subject?: string
536
612
 
537
613
  /**
538
- * Expected JWT "typ" (Type) Header Parameter value.
539
- *
540
- * This option makes the JWT "typ" (Type) Header Parameter presence required.
614
+ * Expected JWT "typ" (Type) Header Parameter value. This option makes the JWT "typ" (Type) Header
615
+ * Parameter presence required.
541
616
  */
542
617
  typ?: string
543
618
 
@@ -561,10 +636,9 @@ export interface VerifyOptions extends CritOption {
561
636
  * A list of accepted JWS "alg" (Algorithm) Header Parameter values. By default all "alg"
562
637
  * (Algorithm) values applicable for the used key/secret are allowed.
563
638
  *
564
- * > [!NOTE]\
565
- * > Unsecured JWTs (`{ "alg": "none" }`) are never accepted by this API.
639
+ * > Note: Unsecured JWTs (`{ "alg": "none" }`) are never accepted by this API.
566
640
  */
567
- algorithms?: string[]
641
+ algorithms?: JWSAlgorithm[]
568
642
  }
569
643
 
570
644
  /** JWS Signing options. */
@@ -572,53 +646,25 @@ export interface SignOptions extends CritOption {}
572
646
 
573
647
  /** Recognized JWT Claims Set members, any other members may also be present. */
574
648
  export interface JWTPayload {
575
- /**
576
- * JWT Issuer
577
- *
578
- * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.1 RFC7519#section-4.1.1}
579
- */
649
+ /** JWT Issuer */
580
650
  iss?: string
581
651
 
582
- /**
583
- * JWT Subject
584
- *
585
- * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.2 RFC7519#section-4.1.2}
586
- */
652
+ /** JWT Subject */
587
653
  sub?: string
588
654
 
589
- /**
590
- * JWT Audience
591
- *
592
- * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.3 RFC7519#section-4.1.3}
593
- */
655
+ /** JWT Audience */
594
656
  aud?: string | string[]
595
657
 
596
- /**
597
- * JWT ID
598
- *
599
- * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.7 RFC7519#section-4.1.7}
600
- */
658
+ /** JWT ID */
601
659
  jti?: string
602
660
 
603
- /**
604
- * JWT Not Before
605
- *
606
- * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.5 RFC7519#section-4.1.5}
607
- */
661
+ /** JWT Not Before */
608
662
  nbf?: number
609
663
 
610
- /**
611
- * JWT Expiration Time
612
- *
613
- * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.4 RFC7519#section-4.1.4}
614
- */
664
+ /** JWT Expiration Time */
615
665
  exp?: number
616
666
 
617
- /**
618
- * JWT Issued At
619
- *
620
- * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6 RFC7519#section-4.1.6}
621
- */
667
+ /** JWT Issued At */
622
668
  iat?: number
623
669
 
624
670
  /** Any other JWT Claim Set member. */
@@ -682,7 +728,9 @@ export interface CompactVerifyResult {
682
728
  /** Signed JSON Web Token (JWT) verification result */
683
729
  export interface JWTVerifyResult<PayloadType = JWTPayload> {
684
730
  /** JWT Claims Set. */
685
- payload: PayloadType & JWTPayload
731
+ payload: PayloadType &
732
+ JWTPayload &
733
+ ([PayloadType] extends [object] ? unknown : unknown extends PayloadType ? unknown : never)
686
734
 
687
735
  /** JWS Protected Header. */
688
736
  protectedHeader: JWTHeaderParameters
@@ -691,32 +739,34 @@ export interface JWTVerifyResult<PayloadType = JWTPayload> {
691
739
  /** Encrypted JSON Web Token (JWT) decryption result */
692
740
  export interface JWTDecryptResult<PayloadType = JWTPayload> {
693
741
  /** JWT Claims Set. */
694
- payload: PayloadType & JWTPayload
742
+ payload: PayloadType &
743
+ JWTPayload &
744
+ ([PayloadType] extends [object] ? unknown : unknown extends PayloadType ? unknown : never)
695
745
 
696
746
  /** JWE Protected Header. */
697
747
  protectedHeader: CompactJWEHeaderParameters
698
748
  }
699
749
 
700
750
  /** When key resolver functions are used this becomes part of successful resolves */
701
- export interface ResolvedKey {
751
+ export interface ResolvedKey<KeyType extends CryptoKey | Uint8Array = CryptoKey | Uint8Array> {
702
752
  /** Key resolved from the key resolver function. */
703
- key: CryptoKey | Uint8Array
753
+ key: KeyType
704
754
  }
705
755
 
706
756
  /** Recognized Compact JWS Header Parameters, any other Header Members may also be present. */
707
757
  export interface CompactJWSHeaderParameters extends JWSHeaderParameters {
708
- alg: string
758
+ alg: JWSAlgorithm
709
759
  }
710
760
 
711
761
  /** Recognized Signed JWT Header Parameters, any other Header Members may also be present. */
712
762
  export interface JWTHeaderParameters extends CompactJWSHeaderParameters {
713
- b64?: true
763
+ b64?: boolean
714
764
  }
715
765
 
716
766
  /** Recognized Compact JWE Header Parameters, any other Header Members may also be present. */
717
767
  export interface CompactJWEHeaderParameters extends JWEHeaderParameters {
718
- alg: string
719
- enc: string
768
+ alg: JWEKeyManagementAlgorithm
769
+ enc: JWEContentEncryptionAlgorithm
720
770
  }
721
771
 
722
772
  /** JSON Web Key Set */
@@ -739,10 +789,24 @@ export interface KeyObject {
739
789
  * {@link !SubtleCrypto.importKey} API to obtain a {@link !CryptoKey} from your existing key
740
790
  * material.
741
791
  */
742
- export type CryptoKey = Extract<
743
- Awaited<ReturnType<typeof crypto.subtle.generateKey>>,
744
- { type: string }
745
- >
792
+ export type CryptoKey = typeof globalThis extends {
793
+ crypto: { subtle: { generateKey(...args: any[]): Promise<infer R> } }
794
+ }
795
+ ? Extract<R, { type: string }>
796
+ : CryptoKeyStructuralFallback
797
+
798
+ /**
799
+ * Used as {@link CryptoKey} when the host runtime's `crypto` global is not exposed on `typeof
800
+ * globalThis`, including when it is absent from ambient types or declared with `const` or `let`. It
801
+ * remains structurally compatible with host {@link !CryptoKey} declarations so values flow freely to
802
+ * and from {@link !SubtleCrypto} APIs.
803
+ */
804
+ export interface CryptoKeyStructuralFallback {
805
+ readonly algorithm: { name: string }
806
+ readonly extractable: boolean
807
+ readonly type: string
808
+ readonly usages: string[]
809
+ }
746
810
 
747
811
  /** Generic interface for JWT producing classes. */
748
812
  export interface ProduceJWT {
@@ -775,78 +839,33 @@ export interface ProduceJWT {
775
839
  setJti(jwtId: string): this
776
840
 
777
841
  /**
778
- * Set the "nbf" (Not Before) Claim.
779
- *
780
- * - If a `number` is passed as an argument it is used as the claim directly.
781
- * - If a `Date` instance is passed as an argument it is converted to unix timestamp and used as the
782
- * claim.
783
- * - If a `string` is passed as an argument it is resolved to a time span, and then added to the
784
- * current unix timestamp and used as the claim.
785
- *
786
- * Format used for time span should be a number followed by a unit, such as "5 minutes" or "1
787
- * day".
788
- *
789
- * Valid units are: "sec", "secs", "second", "seconds", "s", "minute", "minutes", "min", "mins",
790
- * "m", "hour", "hours", "hr", "hrs", "h", "day", "days", "d", "week", "weeks", "w", "year",
791
- * "years", "yr", "yrs", and "y". It is not possible to specify months. 365.25 days is used as an
792
- * alias for a year.
793
- *
794
- * If the string is suffixed with "ago", or prefixed with a "-", the resulting time span gets
795
- * subtracted from the current unix timestamp. A "from now" suffix can also be used for
796
- * readability when adding to the current unix timestamp.
842
+ * Set the "nbf" (Not Before) Claim. A `number` is used directly, a `Date` is converted to a Unix
843
+ * timestamp, and a `string` is parsed as a time span relative to the current Unix timestamp.
844
+ * String units may be seconds, minutes, hours, days, weeks, or years; months are unsupported and
845
+ * a year is 365.25 days. A leading `-` or trailing `"ago"` subtracts the time span.
797
846
  *
798
847
  * @param input "nbf" (Not Before) Claim value to set on the JWT Claims Set.
799
848
  */
800
849
  setNotBefore(input: number | string | Date): this
801
850
 
802
851
  /**
803
- * Set the "exp" (Expiration Time) Claim.
804
- *
805
- * - If a `number` is passed as an argument it is used as the claim directly.
806
- * - If a `Date` instance is passed as an argument it is converted to unix timestamp and used as the
807
- * claim.
808
- * - If a `string` is passed as an argument it is resolved to a time span, and then added to the
809
- * current unix timestamp and used as the claim.
810
- *
811
- * Format used for time span should be a number followed by a unit, such as "5 minutes" or "1
812
- * day".
813
- *
814
- * Valid units are: "sec", "secs", "second", "seconds", "s", "minute", "minutes", "min", "mins",
815
- * "m", "hour", "hours", "hr", "hrs", "h", "day", "days", "d", "week", "weeks", "w", "year",
816
- * "years", "yr", "yrs", and "y". It is not possible to specify months. 365.25 days is used as an
817
- * alias for a year.
818
- *
819
- * If the string is suffixed with "ago", or prefixed with a "-", the resulting time span gets
820
- * subtracted from the current unix timestamp. A "from now" suffix can also be used for
821
- * readability when adding to the current unix timestamp.
852
+ * Set the "exp" (Expiration Time) Claim. A `number` is used directly, a `Date` is converted to a
853
+ * Unix timestamp, and a `string` is parsed as a time span relative to the current Unix timestamp.
854
+ * String units may be seconds, minutes, hours, days, weeks, or years; months are unsupported and
855
+ * a year is 365.25 days. A leading `-` or trailing `"ago"` subtracts the time span.
822
856
  *
823
857
  * @param input "exp" (Expiration Time) Claim value to set on the JWT Claims Set.
824
858
  */
825
859
  setExpirationTime(input: number | string | Date): this
826
860
 
827
861
  /**
828
- * Set the "iat" (Issued At) Claim.
829
- *
830
- * - If no argument is used the current unix timestamp is used as the claim.
831
- * - If a `number` is passed as an argument it is used as the claim directly.
832
- * - If a `Date` instance is passed as an argument it is converted to unix timestamp and used as the
833
- * claim.
834
- * - If a `string` is passed as an argument it is resolved to a time span, and then added to the
835
- * current unix timestamp and used as the claim.
836
- *
837
- * Format used for time span should be a number followed by a unit, such as "5 minutes" or "1
838
- * day".
839
- *
840
- * Valid units are: "sec", "secs", "second", "seconds", "s", "minute", "minutes", "min", "mins",
841
- * "m", "hour", "hours", "hr", "hrs", "h", "day", "days", "d", "week", "weeks", "w", "year",
842
- * "years", "yr", "yrs", and "y". It is not possible to specify months. 365.25 days is used as an
843
- * alias for a year.
844
- *
845
- * If the string is suffixed with "ago", or prefixed with a "-", the resulting time span gets
846
- * subtracted from the current unix timestamp. A "from now" suffix can also be used for
847
- * readability when adding to the current unix timestamp.
862
+ * Set the "iat" (Issued At) Claim. With no argument the current Unix timestamp is used. A
863
+ * `number` is used directly, a `Date` is converted to a Unix timestamp, and a `string` is parsed
864
+ * as a time span relative to the current Unix timestamp. String units may be seconds, minutes,
865
+ * hours, days, weeks, or years; months are unsupported and a year is 365.25 days. A leading `-`
866
+ * or trailing `"ago"` subtracts the time span.
848
867
  *
849
- * @param input "iat" (Expiration Time) Claim value to set on the JWT Claims Set.
868
+ * @param input "iat" (Issued At) Claim value to set on the JWT Claims Set.
850
869
  */
851
870
  setIssuedAt(input?: number | string | Date): this
852
871
  }