@teammy/server 0.2.23 → 0.2.25

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 (166) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -7
  3. package/dist/main.js +21235 -13704
  4. package/dist/native-pi-entry.js +815 -19
  5. package/dist/project-pi-entry.js +818 -22
  6. package/dist/runtime/en/shared/system.md +9 -0
  7. package/dist/runtime/en/shared/tools.json +22 -0
  8. package/dist/runtime/en/workflows/directory-analysis/prompt.md +11 -0
  9. package/dist/runtime/en/workflows/file-summary/prompt.md +7 -0
  10. package/dist/runtime/en/workflows/session-handoff/prompt.md +31 -0
  11. package/dist/runtime/en/workflows/session-overview/prompt.md +26 -0
  12. package/dist/runtime/en/workflows/task-bootstrap/prompt.md +84 -0
  13. package/dist/runtime/shared/system.md +1 -1
  14. package/dist/runtime/workflows/session-handoff/prompt.md +1 -1
  15. package/dist/runtime/workflows/session-overview/prompt.md +1 -1
  16. package/dist/web/THIRD-PARTY-LICENSES.md +2025 -0
  17. package/dist/web/assets/Assistant-C-GBv5St.js +1 -0
  18. package/dist/web/assets/Computers-B-FvcufX.js +14 -0
  19. package/dist/web/assets/{Computers-BtcIsnDD.css → Computers-BJKv9oJv.css} +1 -1
  20. package/dist/web/assets/Conversation-Dzr18Rmq.js +1 -0
  21. package/dist/web/assets/Dashboard-5ksfc6l9.js +1 -0
  22. package/dist/web/assets/Files-DqrIDBJI.js +1 -0
  23. package/dist/web/assets/Help-JsdkpQ8l.js +2413 -0
  24. package/dist/web/assets/MessageComposer-DOJ1PYXg.js +1 -0
  25. package/dist/web/assets/MessageComposer-DqcbXBIG.css +1 -0
  26. package/dist/web/assets/ResourceLibrary--aVsAt6m.js +6 -0
  27. package/dist/web/assets/TerminalPane-jJa53g04.js +22 -0
  28. package/dist/web/assets/WorkspaceTree-CuwIu3vj.js +1 -0
  29. package/dist/web/assets/file-links-BnaVOi2G.js +1 -0
  30. package/dist/web/assets/index-B9gF6reY.css +1 -0
  31. package/dist/web/assets/index-Ck_8bv0N.js +40 -0
  32. package/dist/web/assets/project-links-CodATITq.js +105 -0
  33. package/dist/web/assets/workflow-DR-M8YZx.svg +111 -0
  34. package/dist/web/downloads/teammy-inbox-skill.zip +0 -0
  35. package/dist/web/downloads/teammy-skill.zip +0 -0
  36. package/dist/web/index.html +4 -4
  37. package/dist/web/notification-worker.js +2 -10
  38. package/node_modules/i18next/LICENSE +21 -0
  39. package/node_modules/i18next/README.md +77 -0
  40. package/node_modules/i18next/dist/cjs/i18next.js +2495 -0
  41. package/node_modules/i18next/dist/esm/i18next.js +2505 -0
  42. package/node_modules/i18next/dist/esm/package.json +1 -0
  43. package/node_modules/i18next/dist/umd/i18next.js +2501 -0
  44. package/node_modules/i18next/dist/umd/i18next.min.js +1 -0
  45. package/node_modules/i18next/i18next.js +2501 -0
  46. package/node_modules/i18next/i18next.min.js +1 -0
  47. package/node_modules/i18next/index.d.mts +71 -0
  48. package/node_modules/i18next/index.d.ts +739 -0
  49. package/node_modules/i18next/package.json +125 -0
  50. package/node_modules/i18next/typescript/helpers.d.ts +73 -0
  51. package/node_modules/i18next/typescript/options.d.ts +871 -0
  52. package/node_modules/i18next/typescript/t.d.ts +1449 -0
  53. package/node_modules/jose/LICENSE.md +21 -0
  54. package/node_modules/jose/README.md +150 -0
  55. package/node_modules/jose/dist/types/index.d.ts +55 -0
  56. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +25 -0
  57. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +40 -0
  58. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +25 -0
  59. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +46 -0
  60. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +29 -0
  61. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +51 -0
  62. package/node_modules/jose/dist/types/jwk/embedded.d.ts +10 -0
  63. package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +15 -0
  64. package/node_modules/jose/dist/types/jwks/local.d.ts +17 -0
  65. package/node_modules/jose/dist/types/jwks/remote.d.ts +94 -0
  66. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +21 -0
  67. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +25 -0
  68. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +23 -0
  69. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +26 -0
  70. package/node_modules/jose/dist/types/jws/general/sign.d.ts +41 -0
  71. package/node_modules/jose/dist/types/jws/general/verify.d.ts +31 -0
  72. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +38 -0
  73. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +57 -0
  74. package/node_modules/jose/dist/types/jwt/sign.d.ts +21 -0
  75. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +21 -0
  76. package/node_modules/jose/dist/types/jwt/verify.d.ts +36 -0
  77. package/node_modules/jose/dist/types/key/export.d.ts +19 -0
  78. package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +33 -0
  79. package/node_modules/jose/dist/types/key/generate_secret.d.ts +30 -0
  80. package/node_modules/jose/dist/types/key/import.d.ts +67 -0
  81. package/node_modules/jose/dist/types/types.d.ts +802 -0
  82. package/node_modules/jose/dist/types/util/base64url.d.ts +16 -0
  83. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +9 -0
  84. package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +10 -0
  85. package/node_modules/jose/dist/types/util/errors.d.ts +182 -0
  86. package/node_modules/jose/dist/webapi/index.js +70 -0
  87. package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -0
  88. package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +26 -0
  89. package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +15 -0
  90. package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +35 -0
  91. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +41 -0
  92. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +105 -0
  93. package/node_modules/jose/dist/webapi/jwk/embedded.js +30 -0
  94. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +55 -0
  95. package/node_modules/jose/dist/webapi/jwks/local.js +60 -0
  96. package/node_modules/jose/dist/webapi/jwks/remote.js +103 -0
  97. package/node_modules/jose/dist/webapi/jws/compact/sign.js +20 -0
  98. package/node_modules/jose/dist/webapi/jws/compact/verify.js +8 -0
  99. package/node_modules/jose/dist/webapi/jws/flattened/sign.js +23 -0
  100. package/node_modules/jose/dist/webapi/jws/flattened/verify.js +12 -0
  101. package/node_modules/jose/dist/webapi/jws/general/sign.js +58 -0
  102. package/node_modules/jose/dist/webapi/jws/general/verify.js +42 -0
  103. package/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -0
  104. package/node_modules/jose/dist/webapi/jwt/encrypt.js +42 -0
  105. package/node_modules/jose/dist/webapi/jwt/sign.js +19 -0
  106. package/node_modules/jose/dist/webapi/jwt/unsecured.js +34 -0
  107. package/node_modules/jose/dist/webapi/jwt/verify.js +13 -0
  108. package/node_modules/jose/dist/webapi/key/export.js +35 -0
  109. package/node_modules/jose/dist/webapi/key/generate_key_pair.js +35 -0
  110. package/node_modules/jose/dist/webapi/key/generate_secret.js +36 -0
  111. package/node_modules/jose/dist/webapi/key/import.js +53 -0
  112. package/node_modules/jose/dist/webapi/lib/asn1.js +138 -0
  113. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +75 -0
  114. package/node_modules/jose/dist/webapi/lib/content_encryption.js +90 -0
  115. package/node_modules/jose/dist/webapi/lib/deflate.js +41 -0
  116. package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +116 -0
  117. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +190 -0
  118. package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +75 -0
  119. package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +74 -0
  120. package/node_modules/jose/dist/webapi/lib/jws_sign.js +46 -0
  121. package/node_modules/jose/dist/webapi/lib/jws_verify.js +89 -0
  122. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +150 -0
  123. package/node_modules/jose/dist/webapi/lib/key.js +157 -0
  124. package/node_modules/jose/dist/webapi/lib/key_algorithm.js +15 -0
  125. package/node_modules/jose/dist/webapi/lib/key_descriptor.js +9 -0
  126. package/node_modules/jose/dist/webapi/lib/key_management.js +195 -0
  127. package/node_modules/jose/dist/webapi/lib/validate.js +122 -0
  128. package/node_modules/jose/dist/webapi/util/base64url.js +16 -0
  129. package/node_modules/jose/dist/webapi/util/decode_jwt.js +33 -0
  130. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +19 -0
  131. package/node_modules/jose/dist/webapi/util/errors.js +109 -0
  132. package/node_modules/jose/package.json +134 -0
  133. package/node_modules/oauth4webapi/LICENSE.md +21 -0
  134. package/node_modules/oauth4webapi/README.md +104 -0
  135. package/node_modules/oauth4webapi/build/index.d.ts +3046 -0
  136. package/node_modules/oauth4webapi/build/index.js +2530 -0
  137. package/node_modules/oauth4webapi/build/index.js.map +1 -0
  138. package/node_modules/oauth4webapi/package.json +112 -0
  139. package/node_modules/openid-client/LICENSE.md +21 -0
  140. package/node_modules/openid-client/README.md +258 -0
  141. package/node_modules/openid-client/build/index.d.ts +2478 -0
  142. package/node_modules/openid-client/build/index.js +1347 -0
  143. package/node_modules/openid-client/build/index.js.map +1 -0
  144. package/node_modules/openid-client/build/passport.d.ts +258 -0
  145. package/node_modules/openid-client/build/passport.js +264 -0
  146. package/node_modules/openid-client/build/passport.js.map +1 -0
  147. package/node_modules/openid-client/package.json +130 -0
  148. package/package.json +5 -1
  149. package/dist/web/assets/Assistant-Dks48Y5w.js +0 -1
  150. package/dist/web/assets/Computers-CaCzZeCc.js +0 -13
  151. package/dist/web/assets/Conversation-kAMzKADw.js +0 -1
  152. package/dist/web/assets/Dashboard-ComNJNOg.js +0 -1
  153. package/dist/web/assets/Dropdown-DGFI68Vd.js +0 -55
  154. package/dist/web/assets/Files-Blsq_C-B.js +0 -1
  155. package/dist/web/assets/Help-BM23uS-t.js +0 -1079
  156. package/dist/web/assets/Markdown-CXnZDm5J.js +0 -29
  157. package/dist/web/assets/MessageComposer-BoOgfyPA.js +0 -1
  158. package/dist/web/assets/MessageComposer-hKEluJsT.css +0 -1
  159. package/dist/web/assets/ResourceLibrary-C12_47kE.js +0 -6
  160. package/dist/web/assets/TerminalPane-BTRM-36z.js +0 -22
  161. package/dist/web/assets/WorkspaceTree-Co7XG2RG.js +0 -1
  162. package/dist/web/assets/file-links-CoVqmrXg.js +0 -1
  163. package/dist/web/assets/index-CeKzFsxV.css +0 -1
  164. package/dist/web/assets/index-mhJ33-bH.js +0 -10
  165. package/dist/web/assets/task-links-BE36-8mc.js +0 -1
  166. /package/dist/web/assets/{Dropdown-ktgqMqAD.css → project-links-ktgqMqAD.css} +0 -0
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Filip Skokan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,150 @@
1
+ # jose
2
+
3
+ `jose` is a JavaScript module for JSON Object Signing and Encryption, providing support for JSON Web Tokens (JWT), JSON Web Signature (JWS), JSON Web Encryption (JWE), JSON Web Key (JWK), JSON Web Key Set (JWKS), and more. The module is designed to work across various Web-interoperable runtimes including Node.js, browsers, Cloudflare Workers, Deno, Bun, and others.
4
+
5
+ ## Sponsor
6
+
7
+ <picture>
8
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_dark.png">
9
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_light.png">
10
+ <img height="65" align="left" alt="Auth0 by Okta" src="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_light.png">
11
+ </picture>
12
+
13
+ If you want to quickly add JWT authentication to JavaScript apps, feel free to check out Auth0's JavaScript SDK and free plan. [Create an Auth0 account; it's free!][sponsor-auth0]<br><br>
14
+
15
+ ## [💗 Help the project](https://github.com/sponsors/panva)
16
+
17
+ Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by [becoming a sponsor](https://github.com/sponsors/panva).
18
+
19
+ ## Dependencies: 0
20
+
21
+ `jose` has no dependencies and it exports tree-shakeable ESM[^cjs].
22
+
23
+ ## Documentation
24
+
25
+ `jose` is distributed via [npmjs.com](https://www.npmjs.com/package/jose), [jsr.io](https://jsr.io/@panva/jose), [jsdelivr.com](https://www.jsdelivr.com/package/npm/jose), and [github.com](https://github.com/panva/jose).
26
+
27
+ **`example`** ESM import[^cjs]
28
+
29
+ ```js
30
+ import * as jose from 'jose'
31
+ ```
32
+
33
+ ### JSON Web Tokens (JWT)
34
+
35
+ The `jose` module supports JSON Web Tokens (JWT) and provides functionality for signing and verifying tokens, as well as their JWT Claims Set validation.
36
+
37
+ - [JWT Claims Set Validation & Signature Verification](docs/jwt/verify/functions/jwtVerify.md) using the `jwtVerify` function
38
+ - [Using a remote JSON Web Key Set (JWKS)](docs/jwks/remote/functions/createRemoteJWKSet.md)
39
+ - [Using a local JSON Web Key Set (JWKS)](docs/jwks/local/functions/createLocalJWKSet.md)
40
+ - [Signing](docs/jwt/sign/classes/SignJWT.md) using the `SignJWT` class
41
+ - Utility functions
42
+ - [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
43
+ - [Decoding JWT Claims Set](docs/util/decode_jwt/functions/decodeJwt.md) prior to its validation
44
+
45
+ ### Encrypted JSON Web Tokens
46
+
47
+ The `jose` module supports encrypted JSON Web Tokens and provides functionality for encrypting and decrypting tokens, as well as their JWT Claims Set validation.
48
+
49
+ - [Decryption & JWT Claims Set Validation](docs/jwt/decrypt/functions/jwtDecrypt.md) using the `jwtDecrypt` function
50
+ - [Encryption](docs/jwt/encrypt/classes/EncryptJWT.md) using the `EncryptJWT` class
51
+ - Utility functions
52
+ - [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
53
+
54
+ ### Key Utilities
55
+
56
+ The `jose` module supports importing, exporting, and generating keys and secrets in various formats, including PEM formats like SPKI, X.509 certificate, and PKCS #8, as well as JSON Web Key (JWK).
57
+
58
+ - Key Import Functions
59
+ - [JWK Import](docs/key/import/functions/importJWK.md)
60
+ - [Public Key Import (SPKI)](docs/key/import/functions/importSPKI.md)
61
+ - [Public Key Import (X.509 Certificate)](docs/key/import/functions/importX509.md)
62
+ - [Private Key Import (PKCS #8)](docs/key/import/functions/importPKCS8.md)
63
+ - Key and Secret Generation Functions
64
+ - [Asymmetric Key Pair Generation](docs/key/generate_key_pair/functions/generateKeyPair.md)
65
+ - [Symmetric Secret Generation](docs/key/generate_secret/functions/generateSecret.md)
66
+ - Key Export Functions
67
+ - [JWK Export](docs/key/export/functions/exportJWK.md)
68
+ - [Private Key Export](docs/key/export/functions/exportPKCS8.md)
69
+ - [Public Key Export](docs/key/export/functions/exportSPKI.md)
70
+
71
+ ### JSON Web Signature (JWS)
72
+
73
+ The `jose` module supports digital signature and MAC computation and validation over arbitrary JWS Payloads using the JWS Compact Serialization and the flattened and general JWS JSON Serialization syntaxes ([RFC 7515, Section 7](https://www.rfc-editor.org/info/rfc7515/#section-7)).
74
+
75
+ - Signing - [Compact](docs/jws/compact/sign/classes/CompactSign.md), [Flattened JSON](docs/jws/flattened/sign/classes/FlattenedSign.md), [General JSON](docs/jws/general/sign/classes/GeneralSign.md)
76
+ - Verification - [Compact](docs/jws/compact/verify/functions/compactVerify.md), [Flattened JSON](docs/jws/flattened/verify/functions/flattenedVerify.md), [General JSON](docs/jws/general/verify/functions/generalVerify.md)
77
+ - [Using a remote JSON Web Key Set (JWKS)](docs/jwks/remote/functions/createRemoteJWKSet.md)
78
+ - [Using a local JSON Web Key Set (JWKS)](docs/jwks/local/functions/createLocalJWKSet.md)
79
+ - Utility functions
80
+ - [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
81
+
82
+ ### JSON Web Encryption (JWE)
83
+
84
+ The `jose` module supports encryption and authenticated decryption of arbitrary plaintext using the JWE Compact Serialization and the flattened and general JWE JSON Serialization syntaxes ([RFC 7516, Section 7](https://www.rfc-editor.org/info/rfc7516/#section-7)).
85
+
86
+ - Encryption - [Compact](docs/jwe/compact/encrypt/classes/CompactEncrypt.md), [Flattened JSON](docs/jwe/flattened/encrypt/classes/FlattenedEncrypt.md), [General JSON](docs/jwe/general/encrypt/classes/GeneralEncrypt.md)
87
+ - Decryption - [Compact](docs/jwe/compact/decrypt/functions/compactDecrypt.md), [Flattened JSON](docs/jwe/flattened/decrypt/functions/flattenedDecrypt.md), [General JSON](docs/jwe/general/decrypt/functions/generalDecrypt.md)
88
+ - Utility functions
89
+ - [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
90
+
91
+ ### Other
92
+
93
+ The following are additional features and utilities provided by the `jose` module:
94
+
95
+ - [Calculating JWK Thumbprint](docs/jwk/thumbprint/functions/calculateJwkThumbprint.md)
96
+ - [Calculating JWK Thumbprint URI](docs/jwk/thumbprint/functions/calculateJwkThumbprintUri.md)
97
+ - [Verification using a JWK Embedded in a JWS Header](docs/jwk/embedded/functions/EmbeddedJWK.md)
98
+ - [Unsecured JWT](docs/jwt/unsecured/classes/UnsecuredJWT.md)
99
+ - [JOSE Errors](docs/util/errors/README.md)
100
+
101
+ ## Supported Runtimes
102
+
103
+ The `jose` module is compatible with JavaScript runtimes that support the utilized Web API globals and standard built-in objects or are Node.js.
104
+
105
+ The following runtimes are supported _(this is not an exhaustive list)_:
106
+
107
+ - [Bun](https://github.com/panva/jose/issues/471)
108
+ - [Browsers](https://github.com/panva/jose/issues/263)
109
+ - [Cloudflare Workers](https://github.com/panva/jose/issues/265)
110
+ - [Deno](https://github.com/panva/jose/issues/266)
111
+ - [Electron](https://github.com/panva/jose/issues/264)
112
+ - [Node.js](https://github.com/panva/jose/issues/262)
113
+
114
+ Please note that certain algorithms may not be available depending on the runtime used. You can find a list of available algorithms for each runtime in the specific issue links provided above.
115
+
116
+ ## Supported Versions
117
+
118
+ | Version | Security Fixes 🔑 | Other Bug Fixes 🐞 | New Features ⭐ | Runtime and Module type |
119
+ | ----------------------------------------------- | ----------------- | ------------------ | --------------- | ------------------------------- |
120
+ | [v6.x](https://github.com/panva/jose/tree/v6.x) | [Security Policy] | ✅ | ✅ | Universal[^universal] ESM[^cjs] |
121
+
122
+ ## Specifications
123
+
124
+ <details>
125
+ <summary>Details</summary>
126
+
127
+ - JSON Web Signature (JWS) - [RFC7515](https://www.rfc-editor.org/info/rfc7515/)
128
+ - JSON Web Encryption (JWE) - [RFC7516](https://www.rfc-editor.org/info/rfc7516/)
129
+ - JSON Web Key (JWK) - [RFC7517](https://www.rfc-editor.org/info/rfc7517/)
130
+ - JSON Web Algorithms (JWA) - [RFC7518](https://www.rfc-editor.org/info/rfc7518/)
131
+ - JSON Web Token (JWT) - [RFC7519](https://www.rfc-editor.org/info/rfc7519/)
132
+ - JSON Web Key Thumbprint - [RFC7638](https://www.rfc-editor.org/info/rfc7638/)
133
+ - JSON Web Key Thumbprint URI - [RFC9278](https://www.rfc-editor.org/info/rfc9278/)
134
+ - JWS Unencoded Payload Option - [RFC7797](https://www.rfc-editor.org/info/rfc7797/)
135
+ - CFRG Elliptic Curve ECDH and Signatures - [RFC8037](https://www.rfc-editor.org/info/rfc8037/)
136
+ - Fully-Specified Algorithms for JOSE - [RFC9864](https://www.rfc-editor.org/info/rfc9864/)
137
+ - ML-DSA for JOSE - [RFC9964](https://www.rfc-editor.org/info/rfc9964/)
138
+
139
+ The algorithm implementations in `jose` have been tested using test vectors from their respective specifications as well as [RFC7520](https://www.rfc-editor.org/info/rfc7520/).
140
+
141
+ </details>
142
+
143
+ [sponsor-auth0]: https://a0.to/signup/panva
144
+ [WebCryptoAPI]: https://w3c.github.io/webcrypto/
145
+ [Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
146
+ [Security Policy]: https://github.com/panva/jose/security/policy
147
+
148
+ [^cjs]: CJS style `let jose = require('jose')` is possible in Node.js versions where the `require(esm)` feature is enabled by default (^20.19.0 || ^22.12.0 || >= 23.0.0).
149
+
150
+ [^universal]: Assumes runtime support of [WebCryptoAPI][] and [Fetch API][]
@@ -0,0 +1,55 @@
1
+ export { compactDecrypt } from './jwe/compact/decrypt.js';
2
+ export type { CompactDecryptGetKey } from './jwe/compact/decrypt.js';
3
+ export { flattenedDecrypt } from './jwe/flattened/decrypt.js';
4
+ export type { FlattenedDecryptGetKey } from './jwe/flattened/decrypt.js';
5
+ export { generalDecrypt } from './jwe/general/decrypt.js';
6
+ export type { GeneralDecryptGetKey } from './jwe/general/decrypt.js';
7
+ export { GeneralEncrypt } from './jwe/general/encrypt.js';
8
+ export type { Recipient } from './jwe/general/encrypt.js';
9
+ export { compactVerify } from './jws/compact/verify.js';
10
+ export type { CompactVerifyGetKey } from './jws/compact/verify.js';
11
+ export { flattenedVerify } from './jws/flattened/verify.js';
12
+ export type { FlattenedVerifyGetKey } from './jws/flattened/verify.js';
13
+ export { generalVerify } from './jws/general/verify.js';
14
+ export type { GeneralVerifyGetKey } from './jws/general/verify.js';
15
+ export { jwtVerify } from './jwt/verify.js';
16
+ export type { JWTVerifyOptions, JWTVerifyGetKey } from './jwt/verify.js';
17
+ export { jwtDecrypt } from './jwt/decrypt.js';
18
+ export type { JWTDecryptOptions, JWTDecryptGetKey } from './jwt/decrypt.js';
19
+ export { CompactEncrypt } from './jwe/compact/encrypt.js';
20
+ export { FlattenedEncrypt } from './jwe/flattened/encrypt.js';
21
+ export { CompactSign } from './jws/compact/sign.js';
22
+ export { FlattenedSign } from './jws/flattened/sign.js';
23
+ export { GeneralSign } from './jws/general/sign.js';
24
+ export type { Signature } from './jws/general/sign.js';
25
+ export { SignJWT } from './jwt/sign.js';
26
+ export { EncryptJWT } from './jwt/encrypt.js';
27
+ export { calculateJwkThumbprint, calculateJwkThumbprintUri } from './jwk/thumbprint.js';
28
+ export { EmbeddedJWK } from './jwk/embedded.js';
29
+ export { createLocalJWKSet } from './jwks/local.js';
30
+ export type { LocalJWKSet } from './jwks/local.js';
31
+ export { createRemoteJWKSet, jwksCache, customFetch } from './jwks/remote.js';
32
+ export type { RemoteJWKSet, RemoteJWKSetOptions, JWKSCacheInput, ExportedJWKSCache, FetchImplementation, } from './jwks/remote.js';
33
+ export { UnsecuredJWT } from './jwt/unsecured.js';
34
+ export type { UnsecuredResult } from './jwt/unsecured.js';
35
+ export { exportPKCS8, exportSPKI, exportJWK } from './key/export.js';
36
+ export { importSPKI, importPKCS8, importX509, importJWK } from './key/import.js';
37
+ export type { KeyImportOptions } from './key/import.js';
38
+ export { decodeProtectedHeader } from './util/decode_protected_header.js';
39
+ export { decodeJwt } from './util/decode_jwt.js';
40
+ export type { ProtectedHeaderParameters } from './util/decode_protected_header.js';
41
+ import * as errors from './util/errors.js';
42
+ export { errors };
43
+ export { generateKeyPair } from './key/generate_key_pair.js';
44
+ export type { GenerateKeyPairAlgorithm, GenerateKeyPairResult, GenerateKeyPairOptions, } from './key/generate_key_pair.js';
45
+ export { generateSecret } from './key/generate_secret.js';
46
+ export type { GenerateSecretAlgorithm, GenerateSecretOptions } from './key/generate_secret.js';
47
+ import * as base64url from './util/base64url.js';
48
+ export { base64url };
49
+ export type { AnyJWK, CompactDecryptResult, CompactJWEHeaderParameters, CompactJWSHeaderParameters, CompactVerifyResult, CritOption, CryptoKey, DecryptOptions, EncryptOptions, FlattenedDecryptResult, FlattenedJWE, FlattenedJWS, FlattenedJWSInput, FlattenedVerifyResult, GeneralDecryptResult, GeneralJWE, GeneralJWS, GeneralJWSInput, GeneralVerifyResult, GetKeyFunction, JoseHeaderParameters, JSONWebKeySet, JWEContentEncryptionAlgorithm, JWEHeaderParameters, JWEKeyManagementAlgorithm, JWEKeyManagementHeaderParameters, JWK_AKP_Private, JWK_AKP_Public, JWK_EC_Private, JWK_EC_Public, JWK_oct, JWK_OKP_Private, JWK_OKP_Public, JWK_RSA_Private, JWK_RSA_Public, JWK, JWKKeyType, JWKParameters, JWSAlgorithm, JWSHeaderParameters, JWTClaimVerificationOptions, JWTDecryptResult, JWTHeaderParameters, JWTPayload, JWTVerifyResult, KeyInput, KeyObject, ProduceJWT, ResolvedKey, SignOptions, VerifyOptions, } from './types.d.ts';
50
+ /**
51
+ * Identified the loaded runtime-specific build in prior releases; now always `"WebCryptoAPI"`.
52
+ *
53
+ * @deprecated Remove any runtime branching on this value; it is always `"WebCryptoAPI"`.
54
+ */
55
+ export declare const cryptoRuntime = "WebCryptoAPI";
@@ -0,0 +1,25 @@
1
+ import type * as t from '../../types.d.ts';
2
+ /** Resolves a key for Compact JWE decryption from unverified headers and token data. */
3
+ export interface CompactDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.CompactJWEHeaderParameters, t.FlattenedJWE, KeyType | t.KeyObject | t.JWK> {
4
+ }
5
+ /**
6
+ * Authenticates and decrypts a JWE Compact Serialization.
7
+ *
8
+ * @param key Private key or shared secret. See
9
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
10
+ */
11
+ export declare function compactDecrypt(jwe: string | Uint8Array, key: t.KeyInput, options?: t.DecryptOptions): Promise<t.CompactDecryptResult>;
12
+ /**
13
+ * Authenticates and decrypts a JWE Compact Serialization with a dynamically resolved key, included
14
+ * in the result.
15
+ *
16
+ * @param getKey Resolves a private key or shared secret from unverified token data.
17
+ */
18
+ export declare function compactDecrypt<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jwe: string | Uint8Array, getKey: CompactDecryptGetKey<KeyType>, options?: t.DecryptOptions): Promise<t.CompactDecryptResult & t.ResolvedKey<KeyType>>;
19
+ /**
20
+ * Authenticates and decrypts a JWE Compact Serialization with a key or key resolver. The result
21
+ * includes `key` only when a resolver is used.
22
+ *
23
+ * @param key Private key or shared secret, or a function resolving one.
24
+ */
25
+ export declare function compactDecrypt(jwe: string | Uint8Array, key: t.KeyInput | CompactDecryptGetKey, options?: t.DecryptOptions): Promise<t.CompactDecryptResult & Partial<t.ResolvedKey>>;
@@ -0,0 +1,40 @@
1
+ import type * as t from '../../types.d.ts';
2
+ /** Produces JWE Compact Serialization using authenticated encryption. */
3
+ export declare class CompactEncrypt {
4
+ #private;
5
+ /**
6
+ * Creates an encryptor for JWE Compact Serialization.
7
+ *
8
+ * @param plaintext Binary representation of the plaintext to encrypt.
9
+ */
10
+ constructor(plaintext: Uint8Array);
11
+ /**
12
+ * Sets a content encryption key instead of generating a random one for the JWE "enc" algorithm.
13
+ * May only be called once.
14
+ *
15
+ * @deprecated Use only for testing and vector validation.
16
+ */
17
+ setContentEncryptionKey(cek: Uint8Array): this;
18
+ /**
19
+ * Sets the content encryption IV instead of generating a random one for the JWE "enc" algorithm.
20
+ * May only be called once.
21
+ *
22
+ * @deprecated Use only for testing and vector validation.
23
+ */
24
+ setInitializationVector(iv: Uint8Array): this;
25
+ /** Sets the JWE Protected Header. May only be called once. */
26
+ setProtectedHeader(protectedHeader: t.CompactJWEHeaderParameters): this;
27
+ /**
28
+ * Sets key management inputs such as ECDH-ES "apu"/"apv" or PBES2 "p2c". Use this method instead
29
+ * of header setters; the resulting parameters are added to the JOSE Header. May only be called
30
+ * once.
31
+ */
32
+ setKeyManagementParameters(parameters: t.JWEKeyManagementHeaderParameters): this;
33
+ /**
34
+ * Encrypts the plaintext and returns the JWE Compact Serialization.
35
+ *
36
+ * @param key Public key or shared secret. See
37
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
38
+ */
39
+ encrypt(key: t.KeyInput, options?: t.EncryptOptions): Promise<string>;
40
+ }
@@ -0,0 +1,25 @@
1
+ import type * as t from '../../types.d.ts';
2
+ /** Resolves a key for Flattened JWE decryption from unverified headers and token data. */
3
+ export interface FlattenedDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.JWEHeaderParameters | undefined, t.FlattenedJWE, KeyType | t.KeyObject | t.JWK> {
4
+ }
5
+ /**
6
+ * Authenticates and decrypts a flattened JWE JSON Serialization.
7
+ *
8
+ * @param key Private key or shared secret. See
9
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
10
+ */
11
+ export declare function flattenedDecrypt(jwe: t.FlattenedJWE, key: t.KeyInput, options?: t.DecryptOptions): Promise<t.FlattenedDecryptResult>;
12
+ /**
13
+ * Authenticates and decrypts a flattened JWE JSON Serialization with a dynamically resolved key,
14
+ * included in the result.
15
+ *
16
+ * @param getKey Resolves a private key or shared secret from unverified token data.
17
+ */
18
+ export declare function flattenedDecrypt<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jwe: t.FlattenedJWE, getKey: FlattenedDecryptGetKey<KeyType>, options?: t.DecryptOptions): Promise<t.FlattenedDecryptResult & t.ResolvedKey<KeyType>>;
19
+ /**
20
+ * Authenticates and decrypts a flattened JWE JSON Serialization with a key or key resolver. The
21
+ * result includes `key` only when a resolver is used.
22
+ *
23
+ * @param key Private key or shared secret, or a function resolving one.
24
+ */
25
+ export declare function flattenedDecrypt(jwe: t.FlattenedJWE, key: t.KeyInput | FlattenedDecryptGetKey, options?: t.DecryptOptions): Promise<t.FlattenedDecryptResult & Partial<t.ResolvedKey>>;
@@ -0,0 +1,46 @@
1
+ import type * as t from '../../types.d.ts';
2
+ /** Produces flattened JWE JSON Serialization using authenticated encryption. */
3
+ export declare class FlattenedEncrypt {
4
+ #private;
5
+ /**
6
+ * Creates an encryptor for flattened JWE JSON Serialization.
7
+ *
8
+ * @param plaintext Binary representation of the plaintext to encrypt.
9
+ */
10
+ constructor(plaintext: Uint8Array);
11
+ /**
12
+ * Sets key management inputs such as ECDH-ES "apu"/"apv" or PBES2 "p2c". Use this method instead
13
+ * of header setters; the resulting parameters are added to the JOSE Header. May only be called
14
+ * once.
15
+ */
16
+ setKeyManagementParameters(parameters: t.JWEKeyManagementHeaderParameters): this;
17
+ /** Sets the JWE Protected Header. May only be called once. */
18
+ setProtectedHeader(protectedHeader: t.JWEHeaderParameters): this;
19
+ /** Sets the JWE Shared Unprotected Header. May only be called once. */
20
+ setSharedUnprotectedHeader(sharedUnprotectedHeader: t.JWEHeaderParameters): this;
21
+ /** Sets the JWE Per-Recipient Unprotected Header. May only be called once. */
22
+ setUnprotectedHeader(unprotectedHeader: t.JWEHeaderParameters): this;
23
+ /** Sets the JWE AAD, which is integrity protected but not encrypted. */
24
+ setAdditionalAuthenticatedData(aad: Uint8Array): this;
25
+ /**
26
+ * Sets a content encryption key instead of generating a random one for the JWE "enc" algorithm.
27
+ * May only be called once.
28
+ *
29
+ * @deprecated Use only for testing and vector validation.
30
+ */
31
+ setContentEncryptionKey(cek: Uint8Array): this;
32
+ /**
33
+ * Sets the content encryption IV instead of generating a random one for the JWE "enc" algorithm.
34
+ * May only be called once.
35
+ *
36
+ * @deprecated Use only for testing and vector validation.
37
+ */
38
+ setInitializationVector(iv: Uint8Array): this;
39
+ /**
40
+ * Encrypts the plaintext and returns the flattened JWE JSON Serialization.
41
+ *
42
+ * @param key Public key or shared secret. See
43
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
44
+ */
45
+ encrypt(key: t.KeyInput, options?: t.EncryptOptions): Promise<t.FlattenedJWE>;
46
+ }
@@ -0,0 +1,29 @@
1
+ import type * as t from '../../types.d.ts';
2
+ /** Resolves a key for General JWE decryption from unverified headers and token data. */
3
+ export interface GeneralDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.JWEHeaderParameters | undefined, t.FlattenedJWE, KeyType | t.KeyObject | t.JWK> {
4
+ }
5
+ /**
6
+ * Authenticates and decrypts a general JWE JSON Serialization.
7
+ *
8
+ * > Note: Returns plaintext and headers from the first recipient that decrypts successfully. Other
9
+ * > recipients may be inspected to enforce serialization rules, but their headers are not included in
10
+ * > the result. Rely only on the returned data.
11
+ *
12
+ * @param key Private key or shared secret. See
13
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
14
+ */
15
+ export declare function generalDecrypt(jwe: t.GeneralJWE, key: t.KeyInput, options?: t.DecryptOptions): Promise<t.GeneralDecryptResult>;
16
+ /**
17
+ * Authenticates and decrypts a general JWE JSON Serialization with a dynamically resolved key,
18
+ * included in the result.
19
+ *
20
+ * @param getKey Resolves a private key or shared secret from unverified token data.
21
+ */
22
+ export declare function generalDecrypt<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jwe: t.GeneralJWE, getKey: GeneralDecryptGetKey<KeyType>, options?: t.DecryptOptions): Promise<t.GeneralDecryptResult & t.ResolvedKey<KeyType>>;
23
+ /**
24
+ * Authenticates and decrypts a general JWE JSON Serialization with a key or key resolver. The
25
+ * result includes `key` only when a resolver is used.
26
+ *
27
+ * @param key Private key or shared secret, or a function resolving one.
28
+ */
29
+ export declare function generalDecrypt(jwe: t.GeneralJWE, key: t.KeyInput | GeneralDecryptGetKey, options?: t.DecryptOptions): Promise<t.GeneralDecryptResult & Partial<t.ResolvedKey>>;
@@ -0,0 +1,51 @@
1
+ import type * as t from '../../types.d.ts';
2
+ /** Configures an individual recipient in a General JWE. */
3
+ export interface Recipient {
4
+ /** Sets the JWE Per-Recipient Unprotected Header. May only be called once. */
5
+ setUnprotectedHeader(unprotectedHeader: t.JWEHeaderParameters): Recipient;
6
+ /**
7
+ * Sets key management inputs such as ECDH-ES "apu"/"apv" or PBES2 "p2c". Use this method instead
8
+ * of header setters; the resulting parameters are added to the JOSE Header. May only be called
9
+ * once.
10
+ */
11
+ setKeyManagementParameters(parameters: t.JWEKeyManagementHeaderParameters): Recipient;
12
+ /**
13
+ * Adds another recipient to the enclosing {@link GeneralEncrypt} and returns its configuration.
14
+ *
15
+ * @param key Public key or shared secret. See
16
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
17
+ */
18
+ addRecipient(key: t.KeyInput, options?: t.CritOption): Recipient;
19
+ /**
20
+ * Encrypts for all recipients on the enclosing {@link GeneralEncrypt}, using their configured
21
+ * keys.
22
+ */
23
+ encrypt(): Promise<t.GeneralJWE>;
24
+ /** Returns the enclosing {@link GeneralEncrypt} instance. */
25
+ done(): GeneralEncrypt;
26
+ }
27
+ /** Produces general JWE JSON Serialization using authenticated encryption. */
28
+ export declare class GeneralEncrypt {
29
+ #private;
30
+ /**
31
+ * Creates an encryptor for general JWE JSON Serialization.
32
+ *
33
+ * @param plaintext Binary representation of the plaintext to encrypt.
34
+ */
35
+ constructor(plaintext: Uint8Array);
36
+ /**
37
+ * Adds a recipient and returns its configuration.
38
+ *
39
+ * @param key Public key or shared secret. See
40
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
41
+ */
42
+ addRecipient(key: t.KeyInput, options?: t.CritOption): Recipient;
43
+ /** Sets the JWE Protected Header. May only be called once. */
44
+ setProtectedHeader(protectedHeader: t.JWEHeaderParameters): this;
45
+ /** Sets the JWE Shared Unprotected Header. May only be called once. */
46
+ setSharedUnprotectedHeader(sharedUnprotectedHeader: t.JWEHeaderParameters): this;
47
+ /** Sets the JWE AAD, which is integrity protected but not encrypted. */
48
+ setAdditionalAuthenticatedData(aad: Uint8Array): this;
49
+ /** Encrypts the plaintext and returns the general JWE JSON Serialization. */
50
+ encrypt(): Promise<t.GeneralJWE>;
51
+ }
@@ -0,0 +1,10 @@
1
+ import type * as t from '../types.d.ts';
2
+ /**
3
+ * Resolves a verification key from an embedded "jwk" (JSON Web Key) Header Parameter. This key
4
+ * resolver opts JWS and JWT verification into trusting a public key supplied by the token. Use the
5
+ * verification function's `algorithms` option to restrict accepted algorithms.
6
+ *
7
+ * @param token The consumed JWS token.
8
+ * @returns The public key from the JWS "jwk" (JSON Web Key) Header Parameter.
9
+ */
10
+ export declare function EmbeddedJWK(protectedHeader?: t.JWSHeaderParameters, token?: t.FlattenedJWSInput): Promise<t.CryptoKey>;
@@ -0,0 +1,15 @@
1
+ import type * as t from '../types.d.ts';
2
+ /**
3
+ * Calculates a base64url-encoded JWK Thumbprint. CryptoKey inputs must be extractable.
4
+ *
5
+ * @param key Key to calculate the thumbprint for.
6
+ * @param digestAlgorithm Digest algorithm. Defaults to "sha256".
7
+ */
8
+ export declare function calculateJwkThumbprint(key: t.JWK | t.CryptoKey | t.KeyObject, digestAlgorithm?: 'sha256' | 'sha384' | 'sha512'): Promise<string>;
9
+ /**
10
+ * Calculates a JWK Thumbprint URI. CryptoKey inputs must be extractable.
11
+ *
12
+ * @param key Key to calculate the thumbprint for.
13
+ * @param digestAlgorithm Digest algorithm. Defaults to "sha256".
14
+ */
15
+ export declare function calculateJwkThumbprintUri(key: t.CryptoKey | t.KeyObject | t.JWK, digestAlgorithm?: 'sha256' | 'sha384' | 'sha512'): Promise<string>;
@@ -0,0 +1,17 @@
1
+ import type * as t from '../types.d.ts';
2
+ /** A key resolver created by {@link createLocalJWKSet}. */
3
+ export interface LocalJWKSet {
4
+ (protectedHeader?: t.JWSHeaderParameters, token?: t.FlattenedJWSInput): Promise<t.CryptoKey>;
5
+ /** Returns a structured clone of the original JSON Web Key Set. */
6
+ jwks: () => t.JSONWebKeySet;
7
+ }
8
+ /**
9
+ * Creates a resolver for a locally available JSON Web Key Set. Selection uses the header's "alg"
10
+ * (Algorithm) and "kid" (Key ID), and respects the JWK's "use" (Public Key Use) and "key_ops" (Key
11
+ * Operations). Exactly one key must match.
12
+ *
13
+ * > Note: Only public signature verification keys are supported, not public encryption keys.
14
+ *
15
+ * @param jwks JSON Web Key Set formatted object.
16
+ */
17
+ export declare function createLocalJWKSet(jwks: t.JSONWebKeySet): LocalJWKSet;
@@ -0,0 +1,94 @@
1
+ import type * as t from '../types.d.ts';
2
+ /**
3
+ * Configures a custom fetch implementation for remote JWKS retrieval.
4
+ *
5
+ * > Note: Fetch-like libraries may have incompatible TypeScript signatures even when they accept the
6
+ * > supplied arguments at runtime.
7
+ */
8
+ export declare const customFetch: unique symbol;
9
+ /** Custom fetch function. Must return HTTP 200 with a JSON JWKS. See {@link customFetch}. */
10
+ export type FetchImplementation = (
11
+ /** JWKS URL, passed as the fetch resource. */
12
+ url: string,
13
+ /** Options passed to fetch. */
14
+ options: {
15
+ headers: Headers;
16
+ method: 'GET';
17
+ /** See {@link !Request.redirect} */
18
+ redirect: 'manual';
19
+ signal: AbortSignal;
20
+ }) => Promise<Response>;
21
+ /**
22
+ * Symbol used to configure an externally persisted remote JWKS cache.
23
+ *
24
+ * > Warning: Only trusted application code must be allowed to write this cache; its keys are trusted for
25
+ * > signature verification.
26
+ */
27
+ export declare const jwksCache: unique symbol;
28
+ /** Remote JWKS resolver options. */
29
+ export interface RemoteJWKSetOptions {
30
+ /**
31
+ * Timeout (in milliseconds) for the HTTP request. When reached the request will be aborted and
32
+ * the verification will fail. Must be a non-negative integer. Default is 5000 (5 seconds).
33
+ */
34
+ timeoutDuration?: number;
35
+ /**
36
+ * Time in milliseconds after a successful fetch before a missing key can trigger another fetch.
37
+ * Must not be `NaN`. Defaults to 30000 (30 seconds).
38
+ */
39
+ cooldownDuration?: number;
40
+ /**
41
+ * Maximum age of cached keys in milliseconds. Defaults to 600000 (10 minutes); `Infinity`
42
+ * disables expiry. Must not be `NaN`.
43
+ */
44
+ cacheMaxAge?: number | typeof Infinity;
45
+ /** Headers to be sent with the HTTP request. */
46
+ headers?: Record<string, string>;
47
+ /** See {@link jwksCache}. */
48
+ [jwksCache]?: JWKSCacheInput;
49
+ /** See {@link customFetch}. */
50
+ [customFetch]?: FetchImplementation;
51
+ }
52
+ /** Shape of an externally persisted remote JWKS cache. */
53
+ export interface ExportedJWKSCache {
54
+ /** Current cached JSON Web Key Set */
55
+ jwks: t.JSONWebKeySet;
56
+ /** Last successful fetch, in milliseconds since Unix epoch. */
57
+ uat: number;
58
+ }
59
+ /** Values accepted by the {@link jwksCache} option. */
60
+ export type JWKSCacheInput = ExportedJWKSCache | Record<string, never>;
61
+ /** A key resolver created by {@link createRemoteJWKSet}. */
62
+ export interface RemoteJWKSet {
63
+ (protectedHeader?: t.JWSHeaderParameters, token?: t.FlattenedJWSInput): Promise<t.CryptoKey>;
64
+ /** Whether the cooldown window following the last successful fetch is still in effect. */
65
+ readonly coolingDown: boolean;
66
+ /**
67
+ * Whether the currently cached JSON Web Key Set is within its
68
+ * {@link RemoteJWKSetOptions.cacheMaxAge}.
69
+ */
70
+ readonly fresh: boolean;
71
+ /** Whether a JSON Web Key Set fetch is currently in flight. */
72
+ readonly reloading: boolean;
73
+ /**
74
+ * Triggers a JSON Web Key Set fetch, bypassing
75
+ * {@link RemoteJWKSetOptions.cooldownDuration the cooldown}.
76
+ */
77
+ reload: () => Promise<void>;
78
+ /**
79
+ * Returns a structured clone of the cached JSON Web Key Set, or `undefined` before keys have been
80
+ * fetched or seeded via {@link jwksCache}.
81
+ */
82
+ jwks: () => t.JSONWebKeySet | undefined;
83
+ }
84
+ /**
85
+ * Creates a resolver for a JSON Web Key Set available at an HTTP(S) URL. Fetches the JSON Web Key
86
+ * Set when the cache is missing or stale. An unmatched key triggers another fetch only when
87
+ * `cooldownDuration` has elapsed since the last successful fetch. Selection uses the header's "alg"
88
+ * and "kid" and respects the JWK's "use" and "key_ops". Exactly one key must match.
89
+ *
90
+ * > Note: Only public signature verification keys are supported, not public encryption keys.
91
+ *
92
+ * @param url URL to fetch the JSON Web Key Set from.
93
+ */
94
+ export declare function createRemoteJWKSet(url: URL, options?: RemoteJWKSetOptions): RemoteJWKSet;
@@ -0,0 +1,21 @@
1
+ import type * as t from '../../types.d.ts';
2
+ /** Produces JWS Compact Serialization using a digital signature or MAC. */
3
+ export declare class CompactSign {
4
+ #private;
5
+ /**
6
+ * Creates a signer for JWS Compact Serialization.
7
+ *
8
+ * @param payload JWS Payload bytes to sign or MAC.
9
+ */
10
+ constructor(payload: Uint8Array);
11
+ /** Sets the JWS Protected Header. May only be called once. */
12
+ setProtectedHeader(protectedHeader: t.CompactJWSHeaderParameters): this;
13
+ /**
14
+ * Computes the JWS Signature (digital signature or MAC) and returns the JWS Compact
15
+ * Serialization.
16
+ *
17
+ * @param key Private key or shared secret. See
18
+ * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
19
+ */
20
+ sign(key: t.KeyInput, options?: t.SignOptions): Promise<string>;
21
+ }
@@ -0,0 +1,25 @@
1
+ import type * as t from '../../types.d.ts';
2
+ /** Resolves a key for Compact JWS verification from unverified headers and token data. */
3
+ export interface CompactVerifyGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.CompactJWSHeaderParameters, t.FlattenedJWSInput, KeyType | t.KeyObject | t.JWK> {
4
+ }
5
+ /**
6
+ * Validates a JWS Compact Serialization (digital signature or MAC) and decodes its JWS Payload.
7
+ *
8
+ * @param key Public key or shared secret. See
9
+ * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
10
+ */
11
+ export declare function compactVerify(jws: string | Uint8Array, key: t.KeyInput, options?: t.VerifyOptions): Promise<t.CompactVerifyResult>;
12
+ /**
13
+ * Validates a JWS Compact Serialization (digital signature or MAC) and decodes its JWS Payload with
14
+ * a dynamically resolved key, included in the result.
15
+ *
16
+ * @param getKey Resolves a public key or shared secret from unverified token data.
17
+ */
18
+ export declare function compactVerify<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jws: string | Uint8Array, getKey: CompactVerifyGetKey<KeyType>, options?: t.VerifyOptions): Promise<t.CompactVerifyResult & t.ResolvedKey<KeyType>>;
19
+ /**
20
+ * Validates a JWS Compact Serialization (digital signature or MAC) and decodes its JWS Payload
21
+ * using a key or key resolver. The result includes `key` only when a resolver is used.
22
+ *
23
+ * @param key Public key or shared secret, or a function resolving one.
24
+ */
25
+ export declare function compactVerify(jws: string | Uint8Array, key: t.KeyInput | CompactVerifyGetKey, options?: t.VerifyOptions): Promise<t.CompactVerifyResult & Partial<t.ResolvedKey>>;