@projected/auth-jwt 0.0.0-stage → 0.1.1
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.
- package/LICENSE +21 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +114 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -3
- package/src/index.ts +151 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Martin Zokov
|
|
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 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2023.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2023.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2023.collection.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2023.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/better-result@3.0.1/node_modules/better-result/dist/index.d.mts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/json-schema.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/standard-schema.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/registries.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/to-json-schema.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/util.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/versions.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/schemas.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/checks.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/errors.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/core.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/parse.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/memoizer.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/regexes.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ar.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/az.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/be.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/bg.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/bn.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ca.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ckb.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/cs.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/da.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/de.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/el.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/en.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/eo.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/es.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/fa.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/fi.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/fr.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/fr-ca.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/gu.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/he.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hi.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hr.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hu.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hy.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/id.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/is.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/it.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ja.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ka.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/kh.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/km.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/kn.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ko.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/lt.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/mk.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ms.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ne.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/nl.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/nn.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/no.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ota.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ps.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/pl.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/pt.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/pt-br.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ro.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ru.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/sk.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/sl.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/sv.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ta.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/tg.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/th.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/tk.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/tr.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ua.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/uk.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ur.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/uz.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/vi.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/zh-cn.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/zh-tw.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/yo.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/index.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/doc.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/compile.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/api.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/json-schema-processors.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/json-schema-generator.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/index.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/errors.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/parse.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/schemas.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/checks.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/compat.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/from-json-schema.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/deep-partial.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/in-out.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/iso.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/coerce.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/external.d.cts","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/index.d.cts","../../domain/dist/error.d.ts","../../domain/dist/event.d.ts","../../domain/dist/json.d.ts","../../domain/dist/index.d.ts","../../application/dist/contract.d.ts","../../application/dist/errors.d.ts","../../application/dist/wire.d.ts","../../application/dist/ports.d.ts","../../application/dist/naming.d.ts","../../application/dist/operator.d.ts","../../application/dist/logger.d.ts","../../application/dist/telemetry.d.ts","../../application/dist/fingerprint.d.ts","../../application/dist/event-metadata.d.ts","../../application/dist/dependency.d.ts","../../application/dist/event-handler.d.ts","../../application/dist/event-handling.d.ts","../../application/dist/idempotency.d.ts","../../application/dist/lifecycle.d.ts","../../application/dist/application.d.ts","../../application/dist/access.d.ts","../../application/dist/remote.d.ts","../../application/dist/index.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/types.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwe/general/decrypt.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwe/general/encrypt.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jws/compact/verify.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jws/flattened/verify.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jws/general/verify.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwt/verify.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwt/decrypt.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jws/compact/sign.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jws/flattened/sign.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jws/general/sign.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwt/sign.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwt/encrypt.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwk/thumbprint.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwk/embedded.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwks/local.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwks/remote.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/jwt/unsecured.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/key/export.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/key/import.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/util/decode_protected_header.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/util/decode_jwt.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/util/errors.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/key/generate_key_pair.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/key/generate_secret.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/util/base64url.d.ts","../../../node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/types/index.d.ts","../src/index.ts"],"fileIdsList":[[182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211],[182],[157],[146],[146,149],[68,140,144,146,147,148,149,150,151,152,153,154,155,156],[64,66,149],[146,147],[65,71,146,148],[66,68,70,71,72,73],[68,70,72,73],[70,73],[68,70,72],[65,68,70,71,73],[64,66,67,68,69,70,71,72,73,74,75,76,140,141,142,143,144,145],[64,66,67,70],[66,67,70],[70],[64,65,67,68,69,71,72,73],[64,65,66,70,146],[70,71,72,73],[72],[77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139],[163,164,166],[162,163,164,165,166,167,168,170,174,175,176,177],[162],[162,164],[63],[162,164,166,167,170],[162,164,166,170,174],[166],[162,163,164,165,166,170],[162,163,164,165,166,168,169,170,171,172,173,174,175,176,177,178,179,180],[162,164,166,167],[162,164,165],[162,163,164,166,178],[162,163,164,166],[181,212],[63,158],[63,158,159,160,161],[158]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"1e9332c23e9a907175e0ffc6a49e236f97b48838cc8aec9ce7e4cec21e544b65","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"0bd714129fca875f7d4c477a1a392200b0bcd13fb2e80928cd334b63830ea047","affectsGlobalScope":true,"impliedFormat":1},{"version":"e2c9037ae6cd2c52d80ceef0b3c5ffdb488627d71529cf4f63776daf11161c9a","affectsGlobalScope":true,"impliedFormat":1},{"version":"135d5cf4d345f59f1a9caadfafcd858d3d9cc68290db616cc85797224448cccc","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd66ccd31251573b59316086eb61d1f9a3c46732edd30afc0f2c61ae13f1d787","impliedFormat":99},{"version":"d1fc2d317157b161af800631bb01668bf08307bf2a0ff053f743aeca3a368465","impliedFormat":1},{"version":"835fb2909ce458740fb4a49fc61709896c6864f5ce3db7f0a88f06c720d74d02","impliedFormat":1},{"version":"6e5857f38aa297a859cab4ec891408659218a5a2610cd317b6dcbef9979459cc","impliedFormat":1},{"version":"2ef8ffe86811721c62038c3de3c2cb27e5555f252b9c71ae1a877f1335485aea","impliedFormat":1},{"version":"404660f2aeed19fc2af51f287dad86556beeeff2075768b01832092de4397c38","impliedFormat":1},{"version":"204b47598070c8d2b26921cdd7cb5b55804bd73ad1a60428750ef95b35c97ec4","impliedFormat":1},{"version":"85605c7095abac45fb2be5b15d1a0a806586113321eb923c28ad7fd0764ed7db","impliedFormat":1},{"version":"c7d7e274be439bd604580d994bdfb305221e471e061d3178f430c09d417f9536","impliedFormat":1},{"version":"c140211fba71b3a847b15da4a70776ed904198e7e4dc8c32df22742235072c4c","impliedFormat":1},{"version":"ce51a3572f75b0f8fc07a11828876ac28cf606a780a2d4c6b3bbcee79e48a90b","impliedFormat":1},{"version":"a8fed1298e1a1aeb2b689c56fe4200c6bf48491cabe47f54a1caa22fa9ebcc6e","impliedFormat":1},{"version":"c7d1e897d7751e2f2f7e41ee6db87a567418a0e9d307c580029e8565a76cb1f8","impliedFormat":1},{"version":"bae85faf965874160673777542d5def87f22c71125d3b71267b1384b0532a4c4","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"8fdac54b93a59a6627b74c680e2df92f8f66b0b7d2699c9dd2a10484066a1c22","impliedFormat":1},{"version":"55fadfc733db7198f557af11bf55ae955db6257e17262351a9cdb8a98af4a9f9","impliedFormat":1},{"version":"ff49687860a57d46828bccbedd739e192ead2421a59bb04024529e8e80c6264e","impliedFormat":1},{"version":"d5063dd2ce061414ebb1ec3608295d6681d3153a427b715bd515813c621b3cf1","impliedFormat":1},{"version":"b147d5d4e973ea9725631a6bd49d3dffd0c28c521b20b7bf44456daa86723395","impliedFormat":1},{"version":"14e1da8984e72f3837de4aec8bc6d29e9ecce4dc260ac6ef4ca4e5e4f93add01","impliedFormat":1},{"version":"99003dbd8309d6cfda98e4bacb264ad40bfc197ede6af95370b0f3177076eb6a","impliedFormat":1},{"version":"be7e9393805753e479746c81dcfe4287063d83ffa30e0284f7a016775af2c1d2","impliedFormat":1},{"version":"f49bf9fcde399132c5760eefb0714cee3f8e96cd30fcec8c535e2cee57870d63","impliedFormat":1},{"version":"9943ae429279a7a4bab6bacc828f9416ee0eed92a370d4c22d5b4235b0c9bd66","impliedFormat":1},{"version":"5490cbcd192227f9a1f61bdf7000da8b47635fc0cdec9e1879b932586b6d2e8e","impliedFormat":1},{"version":"487178767be2789fa2f765d0e77fc5abad8212f7d5dfbe255011dd8e8bb5306c","impliedFormat":1},{"version":"2316301dd223d31962d917999acf8e543e0119c5d24ec984c9f22cb23247160c","impliedFormat":1},{"version":"a3eb5de45edf334745bb6347979b6f9eb44bab235910afb551d44eb05a84a233","impliedFormat":1},{"version":"bfa8e3563e561377191b49bcfb4cea149286a2b843058c1236dce8c3b541564d","impliedFormat":1},{"version":"b8495ee8dbff077d31e9365c73f170709106d7bc6e17a163c7568bb485c8368c","impliedFormat":1},{"version":"e818471014c77c103330aee11f00a7a00b37b35500b53ea6f337aefacd6174c9","impliedFormat":1},{"version":"88c4f1da1a1a6f8ca005fa1a4241897da754b7120fdb731b51a4434232bbcb42","impliedFormat":1},{"version":"31506fd6e72c0d09e082b2f0b3741e6bbe90670361c9560ef998bdb1e56edc3e","impliedFormat":1},{"version":"6b552bbc908f60a7044ebdbfff469983befd88fc9563d9ba55efc303361f94bb","impliedFormat":99},{"version":"e26873824cf39868773f2282e0285da2c3340ba10f8f1a9f75f12f296eb0549c","impliedFormat":99},{"version":"67b5a0eda4b785a365b035e7f6ed03cc16b993967e5672ec2e1ab220a04e5f2f","impliedFormat":99},{"version":"d96c9d58e63d42440ec936675f27757136aee3c2b39ce430fe17acc28f7990f6","impliedFormat":99},{"version":"452e87823cf486e33468fd070698f3db957192b454d7a743793f4d187865820d","impliedFormat":99},{"version":"c19610b5ac8e1e83cd4560ab5515e70764eff4305ddd23a4d14ecf1dc876c5e8","impliedFormat":99},{"version":"9885b1d4926b469e7c3ede9f17a01ce918629150c13ff3937ff83d461ceb691d","impliedFormat":99},{"version":"f7d5c96518f1f9f31d9dbe0a444b44ae9a19748fb2b3f55cdeffa50edccfe0ba","impliedFormat":99},{"version":"8a51b1efd3efb8092f00c96ee0d6f5b9ac9903e2e696608b7ade4910105052d0","impliedFormat":99},{"version":"022a2547fd13a94600ab3ec3cf55b54505446d6819fb1f69a17cb61a45eb7e73","impliedFormat":99},{"version":"b657bbe68b1851594b9a8ba15c0886f1454a22e348873155ee8f8124dc7a72be","impliedFormat":99},{"version":"e549d88e7212070417ad4b5d4a3afc0d69687d9af57290e79612ac394f3fbf49","impliedFormat":99},{"version":"97f0daf580e54bb49d6c7c6f3ca3af6c6f956e4e418bb7f227d495eb28245b75","impliedFormat":99},{"version":"6eef048e096b1d7e22d2d8b08fa57979ce4e80aa5cf2b9f2443004fe2f5b8710","impliedFormat":99},{"version":"036429a8af08307c04af33040dea88215c8161cbd7e4a41a6b1df18a3e866796","impliedFormat":99},{"version":"83a7d763429acdeeccc0c67b444c1cf0d3235e07defd36e79b8479e2485a83f1","impliedFormat":99},{"version":"d64790fcab8a2fae0ad5861b926ad0f4fb52aa88aa237dd059967f3018444391","impliedFormat":99},{"version":"5ca54cb1d4dd68145369e6ddd18e759caeaf002ecc16e12659e2063810df9b44","impliedFormat":99},{"version":"a55ff151143c9858d70fe5bafb0ec349a9740c4a9a2ab3798f3c33251a6cd925","impliedFormat":99},{"version":"5f0d428e87ab9ff8c806ddcb7e7dba8922c87d16e73b727debaaa3bf94cfffb1","impliedFormat":99},{"version":"e0a3982daa775594af463b7f0f8a70a9e96a364fd1e29d96beeb1dbcbbe07f2d","impliedFormat":99},{"version":"722581462c6912401150418d084eaba0f42e2404538b393e4a7681dc2ae9921f","impliedFormat":99},{"version":"4896552874f54b963b17ee653380746aa5fa82458f0f13d6733fc9e305a8d466","impliedFormat":99},{"version":"90855774626b52701f4eee095ac3e991d1a3ab16aba821264425c9569f85b354","impliedFormat":99},{"version":"5ca068709e941dc06beaa00f712f43bb19e2e078d89d037a5610b031ce376a71","impliedFormat":99},{"version":"67716f950a2aba6f3fb6942a3982c9ff549d3e07ac61d3379ff1331089c0d54c","impliedFormat":99},{"version":"0a883b311f8cb604d6536cd74a25dd4de8b43f3a670e8b2cce69b6dc7c20fdc6","impliedFormat":99},{"version":"3f1ab87f163cb39a13aed7c93cab4dfc4ece2cbfaa8b504d7986f9b688df83b5","impliedFormat":99},{"version":"6a66de4cd57759b09ded4d711ac213e94e976ae978b57040772e870455ef6974","impliedFormat":99},{"version":"2aa9b75072f6458ebd66193970cf4113f0808255fd715eef43da7d7f83e1968e","impliedFormat":99},{"version":"1c72a1be65597024dc79c0e88c7bc15388abe31ee22e0a9b45bbcbd63892b52c","impliedFormat":99},{"version":"22b02262cd0ab67eadc82639ada9286e6191562c8a85abbd6587b5bb6e8dd8ef","impliedFormat":99},{"version":"db9ef2df5aa3f38c781c5e2f163faa44d0a165225e347201b9f9d33fce1735b9","impliedFormat":99},{"version":"b08c258c8c3883ebc690fb0f066a5e24fa9d36d404de110c8c6f8af209622553","impliedFormat":99},{"version":"518e83b8718cd5514e7c1f7fb27e720e5396e383f46d3e047b2befbcc119ad21","impliedFormat":99},{"version":"1b29a0bd51632ece118e300324f40896558c4583da5c61d33a75b03a7366744c","impliedFormat":99},{"version":"68da9ae2195c7af081edcec6e751c1ee0ad146883ca52f1418068a4aad1a92a6","impliedFormat":99},{"version":"ae50d965910ca06f9f8f47b3b0fbf38064a0581a8263f0cbd41920544b72f93a","impliedFormat":99},{"version":"743f4591119ffdfa7c90297af7aa617d887b45d9d803188749b916553f16538c","impliedFormat":99},{"version":"a6e2471321693a320be475517bfe34693aee5e776623b39e2d65ad1ec61c68a3","impliedFormat":99},{"version":"b53e6017f30437096813ba5b191ba8f207cc68b5c49fc7d5c373a5977eb3b227","impliedFormat":99},{"version":"3be6e994180df1fa1a57706eb9070f905b88a31133ad962052685c6d864f986d","impliedFormat":99},{"version":"8ee019582cfb775345530144dcefa2a1b9bd3b97e24d3b031cdf199cf3d885ff","impliedFormat":99},{"version":"589cce09cb9171d4291f410f6a7663958f49ed23b59e535d8723f5ee520c2992","impliedFormat":99},{"version":"d1b7243d7c17a49a16b40c83457d241a09e76f9ba4807d400a3d5f319ffa5f6f","impliedFormat":99},{"version":"b3f84b26ba193ac2bc1c7b763fb27872d5d203a835d558208cde67111045a581","impliedFormat":99},{"version":"628ca54de58a9b32d40fdfb0bd36055bb8ac8856d9c97b6f3e6fbd38dad69d0e","impliedFormat":99},{"version":"e2a3ee25f43d163379f1fb2ea7ae3bba1703c8e08f6723eb7c3ece5122de34f8","impliedFormat":99},{"version":"14ffe751d987ff1bbea35b725cfef90bf8f4b13764797ea99eb0919cc2bc3e7c","impliedFormat":99},{"version":"956e8af41b74a382beb0e71f43c8c0520069c52ef42b1437e8f56038ce3d29ca","impliedFormat":99},{"version":"28c819853632e67bfcefaa28284cc903a097d91ac8a363e7e0130029f9652525","impliedFormat":99},{"version":"2f02419c9c770e6db38f361c0a6baeced4a84024e3c3af6ae30740c0c77e3a2a","impliedFormat":99},{"version":"5191f81538f064a1a28b0b59b413f4435e71421168fea5e0afb5ebd5ed41a265","impliedFormat":99},{"version":"1decd2094835e939269d137c31570d789f9d190cd40d520f18df46dc98e6d474","impliedFormat":99},{"version":"b7ca0f66dcc00df2512a2aafa0ab6ba2df247bb9677a7dd84230860a97289b64","signature":"e6b982b0cfd1b614c81d3707ca9e34ba5ba16a6a4596a6ca7dc28c10be1a0a35","impliedFormat":99}],"root":[213],"options":{"composite":true,"declaration":true,"declarationMap":true,"erasableSyntaxOnly":true,"exactOptionalPropertyTypes":true,"module":199,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":10,"tsBuildInfoFile":"./.tsbuildinfo","verbatimModuleSyntax":true},"referencedMap":[[212,1],[183,2],[192,2],[184,2],[193,2],[185,2],[186,2],[200,2],[199,2],[201,2],[202,2],[194,2],[187,2],[195,2],[188,2],[196,2],[189,2],[191,2],[198,2],[197,2],[203,2],[190,2],[204,2],[209,2],[210,2],[205,2],[207,2],[206,2],[208,2],[158,3],[150,4],[156,5],[151,5],[153,5],[147,4],[157,6],[152,7],[154,5],[155,5],[148,8],[149,9],[143,10],[71,11],[142,12],[73,13],[72,14],[146,15],[145,16],[144,17],[75,18],[74,11],[66,12],[70,19],[67,20],[68,21],[77,22],[78,22],[79,22],[80,22],[81,22],[82,22],[83,22],[84,22],[85,22],[86,22],[87,22],[88,22],[89,22],[90,22],[91,22],[92,22],[94,22],[93,22],[95,22],[96,22],[97,22],[98,22],[99,22],[100,22],[101,22],[140,23],[102,22],[103,22],[104,22],[105,22],[106,22],[107,22],[108,22],[109,22],[110,22],[111,22],[112,22],[113,22],[114,22],[115,22],[116,22],[117,22],[119,22],[118,22],[121,22],[120,22],[122,22],[123,22],[124,22],[125,22],[126,22],[127,22],[128,22],[129,22],[130,22],[131,22],[132,22],[133,22],[134,22],[135,22],[136,22],[139,22],[137,22],[138,22],[179,24],[178,25],[163,26],[173,27],[164,28],[174,29],[175,30],[172,31],[176,32],[181,33],[177,31],[168,34],[166,35],[180,36],[165,37],[213,38],[159,39],[160,39],[162,40],[161,41]],"latestChangedDtsFile":"./index.d.ts","version":"6.0.3"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @projected/auth-jwt — authenticate projected requests with JSON Web Tokens from an OpenID
|
|
3
|
+
* Connect or OAuth 2 issuer: Auth0, Clerk, Cognito, Keycloak, WorkOS, Entra ID, or your own.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* const authenticator = jwtAuthenticator({ issuer: "https://school.eu.auth0.com/", audience: "https://api.school.example" });
|
|
7
|
+
* const handler = httpHandler(app, { authenticator, openApi: { securitySchemes: jwtSecuritySchemes() } });
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* Infrastructure-only: wire it in `src/infrastructure/config`. Use cases see only the resulting
|
|
11
|
+
* `Principal`, so swapping one issuer for another never touches them.
|
|
12
|
+
*/
|
|
13
|
+
import { type Authenticator, type Principal } from "@projected/application";
|
|
14
|
+
import { type JSONWebKeySet, type JWTPayload } from "jose";
|
|
15
|
+
export type JwtClaims = JWTPayload & Readonly<Record<string, unknown>>;
|
|
16
|
+
export interface JwtAuthenticatorOptions {
|
|
17
|
+
/** The `iss` every token must carry, e.g. `https://school.eu.auth0.com/`. */
|
|
18
|
+
readonly issuer: string;
|
|
19
|
+
/** The `aud` a token must include: this service's identifier at the issuer. */
|
|
20
|
+
readonly audience: string | readonly string[];
|
|
21
|
+
/**
|
|
22
|
+
* Where the issuer's signing keys are. Defaults to the `jwks_uri` of the issuer's OpenID Connect
|
|
23
|
+
* discovery document (`<issuer>/.well-known/openid-configuration`). Pass a key set itself to
|
|
24
|
+
* verify against fixed keys — in tests, or with an issuer that publishes no discovery document.
|
|
25
|
+
*/
|
|
26
|
+
readonly keys?: string | JSONWebKeySet;
|
|
27
|
+
/**
|
|
28
|
+
* What the principal may do. Defaults to the `permissions` claim (Auth0's RBAC), else the
|
|
29
|
+
* `scope` (OAuth) or `scp` (Entra ID) claim split on spaces. Map the issuer's roles or scopes
|
|
30
|
+
* to the permissions your operations require here.
|
|
31
|
+
*/
|
|
32
|
+
readonly permissions?: (claims: JwtClaims) => readonly string[];
|
|
33
|
+
/**
|
|
34
|
+
* Whether the token is a user's or a service's. Defaults to `"service"` for client-credentials
|
|
35
|
+
* tokens — `sub` equal to `client_id`, Auth0's `gty: "client-credentials"` or `…@clients` —
|
|
36
|
+
* and `"user"` otherwise.
|
|
37
|
+
*/
|
|
38
|
+
readonly kind?: (claims: JwtClaims) => Principal["kind"];
|
|
39
|
+
/** Signature algorithms accepted. Defaults to RS256, PS256, ES256 and EdDSA. */
|
|
40
|
+
readonly algorithms?: readonly string[];
|
|
41
|
+
/** Leeway for `exp` and `nbf`, for clocks that disagree a little. Defaults to 5 s. */
|
|
42
|
+
readonly clockToleranceSeconds?: number;
|
|
43
|
+
/** How long fetching the discovery document or the keys may take. Defaults to 5 s. */
|
|
44
|
+
readonly timeoutMs?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* An {@link Authenticator} for `Authorization: Bearer <jwt>`. A token that verifies — signed by
|
|
48
|
+
* the issuer's key, from the issuer, for this audience, not expired — becomes a principal: `sub`
|
|
49
|
+
* as its id, and its claims. A missing, malformed, expired or forged token is anonymous, so
|
|
50
|
+
* whether that may proceed is each operation's `access` rule. An issuer that cannot be reached is
|
|
51
|
+
* `DependencyUnavailable`: the caller gets a 503, not a 401 it would wrongly act on.
|
|
52
|
+
*/
|
|
53
|
+
export declare function jwtAuthenticator(options: JwtAuthenticatorOptions): Authenticator;
|
|
54
|
+
/**
|
|
55
|
+
* OpenAPI security schemes for the generated document: bearer JWTs and, given the issuer, its
|
|
56
|
+
* OpenID Connect discovery document, which lets tools sign a caller in.
|
|
57
|
+
*/
|
|
58
|
+
export declare function jwtSecuritySchemes(options?: {
|
|
59
|
+
readonly issuer?: string;
|
|
60
|
+
}): Record<string, unknown>;
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAiC,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,EAAoD,KAAK,aAAa,EAAE,KAAK,UAAU,EAAwB,MAAM,MAAM,CAAC;AAEnI,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvE,MAAM,WAAW,uBAAuB;IACtC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,MAAM,EAAE,CAAC;IAChE;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC;IACzD,gFAAgF;IAChF,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,sFAAsF;IACtF,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC,sFAAsF;IACtF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AA8BD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,aAAa,CAsDhF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOtG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @projected/auth-jwt — authenticate projected requests with JSON Web Tokens from an OpenID
|
|
3
|
+
* Connect or OAuth 2 issuer: Auth0, Clerk, Cognito, Keycloak, WorkOS, Entra ID, or your own.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* const authenticator = jwtAuthenticator({ issuer: "https://school.eu.auth0.com/", audience: "https://api.school.example" });
|
|
7
|
+
* const handler = httpHandler(app, { authenticator, openApi: { securitySchemes: jwtSecuritySchemes() } });
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* Infrastructure-only: wire it in `src/infrastructure/config`. Use cases see only the resulting
|
|
11
|
+
* `Principal`, so swapping one issuer for another never touches them.
|
|
12
|
+
*/
|
|
13
|
+
import { DependencyUnavailable, Result } from "@projected/application";
|
|
14
|
+
import { createLocalJWKSet, createRemoteJWKSet, jwtVerify } from "jose";
|
|
15
|
+
const BEARER = /^Bearer\s+([A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*)$/i;
|
|
16
|
+
/** Errors that mean the token is not good — expired, forged, for another audience — rather than that the issuer could not be asked. */
|
|
17
|
+
const REJECTED = new Set([
|
|
18
|
+
"ERR_JWT_EXPIRED",
|
|
19
|
+
"ERR_JWT_CLAIM_VALIDATION_FAILED",
|
|
20
|
+
"ERR_JWT_INVALID",
|
|
21
|
+
"ERR_JWS_INVALID",
|
|
22
|
+
"ERR_JWS_SIGNATURE_VERIFICATION_FAILED",
|
|
23
|
+
"ERR_JWKS_NO_MATCHING_KEY",
|
|
24
|
+
"ERR_JWKS_MULTIPLE_MATCHING_KEYS",
|
|
25
|
+
"ERR_JOSE_ALG_NOT_ALLOWED",
|
|
26
|
+
"ERR_JOSE_NOT_SUPPORTED",
|
|
27
|
+
]);
|
|
28
|
+
const strings = (value) => typeof value === "string" ? value.split(" ").filter((part) => part !== "") : Array.isArray(value) ? value.filter((part) => typeof part === "string") : [];
|
|
29
|
+
const defaultPermissions = (claims) => Array.isArray(claims["permissions"]) ? strings(claims["permissions"]) : strings(claims["scope"] ?? claims["scp"]);
|
|
30
|
+
const defaultKind = (claims) => claims["gty"] === "client-credentials" ||
|
|
31
|
+
(typeof claims["client_id"] === "string" && claims.sub === claims["client_id"]) ||
|
|
32
|
+
(typeof claims.sub === "string" && claims.sub.endsWith("@clients"))
|
|
33
|
+
? "service"
|
|
34
|
+
: "user";
|
|
35
|
+
/**
|
|
36
|
+
* An {@link Authenticator} for `Authorization: Bearer <jwt>`. A token that verifies — signed by
|
|
37
|
+
* the issuer's key, from the issuer, for this audience, not expired — becomes a principal: `sub`
|
|
38
|
+
* as its id, and its claims. A missing, malformed, expired or forged token is anonymous, so
|
|
39
|
+
* whether that may proceed is each operation's `access` rule. An issuer that cannot be reached is
|
|
40
|
+
* `DependencyUnavailable`: the caller gets a 503, not a 401 it would wrongly act on.
|
|
41
|
+
*/
|
|
42
|
+
export function jwtAuthenticator(options) {
|
|
43
|
+
const timeoutMs = options.timeoutMs ?? 5_000;
|
|
44
|
+
const permissionsOf = options.permissions ?? defaultPermissions;
|
|
45
|
+
const kindOf = options.kind ?? defaultKind;
|
|
46
|
+
const unavailable = (message, cause) => Result.err(new DependencyUnavailable({ dependency: "jwt issuer", message: `jwt issuer ${options.issuer}: ${message}`, cause }));
|
|
47
|
+
let keySet = typeof options.keys === "object" ? createLocalJWKSet(options.keys) : typeof options.keys === "string" ? remote(options.keys) : undefined;
|
|
48
|
+
function remote(url) {
|
|
49
|
+
return createRemoteJWKSet(new URL(url), { timeoutDuration: timeoutMs });
|
|
50
|
+
}
|
|
51
|
+
/** The issuer's keys, found through discovery the first time; a failed discovery is tried again on the next request. */
|
|
52
|
+
const keys = async () => {
|
|
53
|
+
if (keySet !== undefined)
|
|
54
|
+
return Result.ok(keySet);
|
|
55
|
+
const discovery = `${options.issuer.replace(/\/+$/, "")}/.well-known/openid-configuration`;
|
|
56
|
+
try {
|
|
57
|
+
const response = await fetch(discovery, { signal: AbortSignal.timeout(timeoutMs) });
|
|
58
|
+
if (!response.ok)
|
|
59
|
+
return unavailable(`discovery answered ${response.status}`);
|
|
60
|
+
const document = (await response.json());
|
|
61
|
+
if (document.issuer !== options.issuer)
|
|
62
|
+
return unavailable(`discovery names another issuer: ${String(document.issuer)}`);
|
|
63
|
+
if (typeof document.jwks_uri !== "string")
|
|
64
|
+
return unavailable("discovery names no jwks_uri");
|
|
65
|
+
keySet = remote(document.jwks_uri);
|
|
66
|
+
return Result.ok(keySet);
|
|
67
|
+
}
|
|
68
|
+
catch (cause) {
|
|
69
|
+
return unavailable(`cannot read ${discovery}`, cause);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
authenticate: async ({ headers }) => {
|
|
74
|
+
const token = BEARER.exec(headers["authorization"] ?? "")?.[1];
|
|
75
|
+
// Not a JWT: someone else's credentials, or none.
|
|
76
|
+
if (token === undefined)
|
|
77
|
+
return Result.ok(undefined);
|
|
78
|
+
const found = await keys();
|
|
79
|
+
if (found.isErr())
|
|
80
|
+
return Result.err(found.error);
|
|
81
|
+
try {
|
|
82
|
+
const { payload } = await jwtVerify(token, found.value, {
|
|
83
|
+
issuer: options.issuer,
|
|
84
|
+
audience: typeof options.audience === "string" ? options.audience : [...options.audience],
|
|
85
|
+
algorithms: [...(options.algorithms ?? ["RS256", "PS256", "ES256", "EdDSA"])],
|
|
86
|
+
clockTolerance: options.clockToleranceSeconds ?? 5,
|
|
87
|
+
});
|
|
88
|
+
const claims = payload;
|
|
89
|
+
if (typeof claims.sub !== "string" || claims.sub === "")
|
|
90
|
+
return Result.ok(undefined);
|
|
91
|
+
return Result.ok({ id: claims.sub, kind: kindOf(claims), permissions: [...permissionsOf(claims)], claims });
|
|
92
|
+
}
|
|
93
|
+
catch (cause) {
|
|
94
|
+
const code = cause.code;
|
|
95
|
+
if (typeof code === "string" && REJECTED.has(code))
|
|
96
|
+
return Result.ok(undefined);
|
|
97
|
+
return unavailable("cannot verify tokens", cause);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* OpenAPI security schemes for the generated document: bearer JWTs and, given the issuer, its
|
|
104
|
+
* OpenID Connect discovery document, which lets tools sign a caller in.
|
|
105
|
+
*/
|
|
106
|
+
export function jwtSecuritySchemes(options = {}) {
|
|
107
|
+
return {
|
|
108
|
+
bearer: { type: "http", scheme: "bearer", bearerFormat: "JWT", description: "An access token from the service's issuer." },
|
|
109
|
+
...(options.issuer === undefined
|
|
110
|
+
? {}
|
|
111
|
+
: { openIdConnect: { type: "openIdConnect", openIdConnectUrl: `${options.issuer.replace(/\/+$/, "")}/.well-known/openid-configuration` } }),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projected/auth-jwt",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "JWT and OpenID Connect for projected: an Authenticator that verifies bearer tokens against an issuer's keys (Auth0, Clerk, Cognito, Keycloak, WorkOS, Entra ID) and turns their claims into principals.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/martinzokov/projected.git",
|
|
9
|
+
"directory": "typescript/packages/auth-jwt"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/martinzokov/projected#readme",
|
|
12
|
+
"bugs": "https://github.com/martinzokov/projected/issues",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"src"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"jose": "^6.2.13",
|
|
27
|
+
"@projected/application": "0.1.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@projected/http": "0.1.1",
|
|
31
|
+
"@projected/testing": "0.1.1"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
6
36
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @projected/auth-jwt — authenticate projected requests with JSON Web Tokens from an OpenID
|
|
3
|
+
* Connect or OAuth 2 issuer: Auth0, Clerk, Cognito, Keycloak, WorkOS, Entra ID, or your own.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* const authenticator = jwtAuthenticator({ issuer: "https://school.eu.auth0.com/", audience: "https://api.school.example" });
|
|
7
|
+
* const handler = httpHandler(app, { authenticator, openApi: { securitySchemes: jwtSecuritySchemes() } });
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* Infrastructure-only: wire it in `src/infrastructure/config`. Use cases see only the resulting
|
|
11
|
+
* `Principal`, so swapping one issuer for another never touches them.
|
|
12
|
+
*/
|
|
13
|
+
import { DependencyUnavailable, Result, type Authenticator, type Principal } from "@projected/application";
|
|
14
|
+
import { createLocalJWKSet, createRemoteJWKSet, jwtVerify, type JSONWebKeySet, type JWTPayload, type JWTVerifyGetKey } from "jose";
|
|
15
|
+
|
|
16
|
+
export type JwtClaims = JWTPayload & Readonly<Record<string, unknown>>;
|
|
17
|
+
|
|
18
|
+
export interface JwtAuthenticatorOptions {
|
|
19
|
+
/** The `iss` every token must carry, e.g. `https://school.eu.auth0.com/`. */
|
|
20
|
+
readonly issuer: string;
|
|
21
|
+
/** The `aud` a token must include: this service's identifier at the issuer. */
|
|
22
|
+
readonly audience: string | readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Where the issuer's signing keys are. Defaults to the `jwks_uri` of the issuer's OpenID Connect
|
|
25
|
+
* discovery document (`<issuer>/.well-known/openid-configuration`). Pass a key set itself to
|
|
26
|
+
* verify against fixed keys — in tests, or with an issuer that publishes no discovery document.
|
|
27
|
+
*/
|
|
28
|
+
readonly keys?: string | JSONWebKeySet;
|
|
29
|
+
/**
|
|
30
|
+
* What the principal may do. Defaults to the `permissions` claim (Auth0's RBAC), else the
|
|
31
|
+
* `scope` (OAuth) or `scp` (Entra ID) claim split on spaces. Map the issuer's roles or scopes
|
|
32
|
+
* to the permissions your operations require here.
|
|
33
|
+
*/
|
|
34
|
+
readonly permissions?: (claims: JwtClaims) => readonly string[];
|
|
35
|
+
/**
|
|
36
|
+
* Whether the token is a user's or a service's. Defaults to `"service"` for client-credentials
|
|
37
|
+
* tokens — `sub` equal to `client_id`, Auth0's `gty: "client-credentials"` or `…@clients` —
|
|
38
|
+
* and `"user"` otherwise.
|
|
39
|
+
*/
|
|
40
|
+
readonly kind?: (claims: JwtClaims) => Principal["kind"];
|
|
41
|
+
/** Signature algorithms accepted. Defaults to RS256, PS256, ES256 and EdDSA. */
|
|
42
|
+
readonly algorithms?: readonly string[];
|
|
43
|
+
/** Leeway for `exp` and `nbf`, for clocks that disagree a little. Defaults to 5 s. */
|
|
44
|
+
readonly clockToleranceSeconds?: number;
|
|
45
|
+
/** How long fetching the discovery document or the keys may take. Defaults to 5 s. */
|
|
46
|
+
readonly timeoutMs?: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const BEARER = /^Bearer\s+([A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*)$/i;
|
|
50
|
+
|
|
51
|
+
/** Errors that mean the token is not good — expired, forged, for another audience — rather than that the issuer could not be asked. */
|
|
52
|
+
const REJECTED = new Set([
|
|
53
|
+
"ERR_JWT_EXPIRED",
|
|
54
|
+
"ERR_JWT_CLAIM_VALIDATION_FAILED",
|
|
55
|
+
"ERR_JWT_INVALID",
|
|
56
|
+
"ERR_JWS_INVALID",
|
|
57
|
+
"ERR_JWS_SIGNATURE_VERIFICATION_FAILED",
|
|
58
|
+
"ERR_JWKS_NO_MATCHING_KEY",
|
|
59
|
+
"ERR_JWKS_MULTIPLE_MATCHING_KEYS",
|
|
60
|
+
"ERR_JOSE_ALG_NOT_ALLOWED",
|
|
61
|
+
"ERR_JOSE_NOT_SUPPORTED",
|
|
62
|
+
]);
|
|
63
|
+
|
|
64
|
+
const strings = (value: unknown): string[] =>
|
|
65
|
+
typeof value === "string" ? value.split(" ").filter((part) => part !== "") : Array.isArray(value) ? value.filter((part): part is string => typeof part === "string") : [];
|
|
66
|
+
|
|
67
|
+
const defaultPermissions = (claims: JwtClaims): string[] =>
|
|
68
|
+
Array.isArray(claims["permissions"]) ? strings(claims["permissions"]) : strings(claims["scope"] ?? claims["scp"]);
|
|
69
|
+
|
|
70
|
+
const defaultKind = (claims: JwtClaims): Principal["kind"] =>
|
|
71
|
+
claims["gty"] === "client-credentials" ||
|
|
72
|
+
(typeof claims["client_id"] === "string" && claims.sub === claims["client_id"]) ||
|
|
73
|
+
(typeof claims.sub === "string" && claims.sub.endsWith("@clients"))
|
|
74
|
+
? "service"
|
|
75
|
+
: "user";
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* An {@link Authenticator} for `Authorization: Bearer <jwt>`. A token that verifies — signed by
|
|
79
|
+
* the issuer's key, from the issuer, for this audience, not expired — becomes a principal: `sub`
|
|
80
|
+
* as its id, and its claims. A missing, malformed, expired or forged token is anonymous, so
|
|
81
|
+
* whether that may proceed is each operation's `access` rule. An issuer that cannot be reached is
|
|
82
|
+
* `DependencyUnavailable`: the caller gets a 503, not a 401 it would wrongly act on.
|
|
83
|
+
*/
|
|
84
|
+
export function jwtAuthenticator(options: JwtAuthenticatorOptions): Authenticator {
|
|
85
|
+
const timeoutMs = options.timeoutMs ?? 5_000;
|
|
86
|
+
const permissionsOf = options.permissions ?? defaultPermissions;
|
|
87
|
+
const kindOf = options.kind ?? defaultKind;
|
|
88
|
+
const unavailable = (message: string, cause?: unknown) =>
|
|
89
|
+
Result.err(new DependencyUnavailable({ dependency: "jwt issuer", message: `jwt issuer ${options.issuer}: ${message}`, cause }));
|
|
90
|
+
|
|
91
|
+
let keySet: JWTVerifyGetKey | undefined =
|
|
92
|
+
typeof options.keys === "object" ? createLocalJWKSet(options.keys) : typeof options.keys === "string" ? remote(options.keys) : undefined;
|
|
93
|
+
function remote(url: string): JWTVerifyGetKey {
|
|
94
|
+
return createRemoteJWKSet(new URL(url), { timeoutDuration: timeoutMs });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The issuer's keys, found through discovery the first time; a failed discovery is tried again on the next request. */
|
|
98
|
+
const keys = async (): Promise<Result<JWTVerifyGetKey, DependencyUnavailable>> => {
|
|
99
|
+
if (keySet !== undefined) return Result.ok(keySet);
|
|
100
|
+
const discovery = `${options.issuer.replace(/\/+$/, "")}/.well-known/openid-configuration`;
|
|
101
|
+
try {
|
|
102
|
+
const response = await fetch(discovery, { signal: AbortSignal.timeout(timeoutMs) });
|
|
103
|
+
if (!response.ok) return unavailable(`discovery answered ${response.status}`);
|
|
104
|
+
const document = (await response.json()) as { issuer?: unknown; jwks_uri?: unknown };
|
|
105
|
+
if (document.issuer !== options.issuer) return unavailable(`discovery names another issuer: ${String(document.issuer)}`);
|
|
106
|
+
if (typeof document.jwks_uri !== "string") return unavailable("discovery names no jwks_uri");
|
|
107
|
+
keySet = remote(document.jwks_uri);
|
|
108
|
+
return Result.ok(keySet);
|
|
109
|
+
} catch (cause) {
|
|
110
|
+
return unavailable(`cannot read ${discovery}`, cause);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
authenticate: async ({ headers }) => {
|
|
116
|
+
const token = BEARER.exec(headers["authorization"] ?? "")?.[1];
|
|
117
|
+
// Not a JWT: someone else's credentials, or none.
|
|
118
|
+
if (token === undefined) return Result.ok(undefined);
|
|
119
|
+
const found = await keys();
|
|
120
|
+
if (found.isErr()) return Result.err(found.error);
|
|
121
|
+
try {
|
|
122
|
+
const { payload } = await jwtVerify(token, found.value, {
|
|
123
|
+
issuer: options.issuer,
|
|
124
|
+
audience: typeof options.audience === "string" ? options.audience : [...options.audience],
|
|
125
|
+
algorithms: [...(options.algorithms ?? ["RS256", "PS256", "ES256", "EdDSA"])],
|
|
126
|
+
clockTolerance: options.clockToleranceSeconds ?? 5,
|
|
127
|
+
});
|
|
128
|
+
const claims = payload as JwtClaims;
|
|
129
|
+
if (typeof claims.sub !== "string" || claims.sub === "") return Result.ok(undefined);
|
|
130
|
+
return Result.ok({ id: claims.sub, kind: kindOf(claims), permissions: [...permissionsOf(claims)], claims });
|
|
131
|
+
} catch (cause) {
|
|
132
|
+
const code = (cause as { code?: unknown }).code;
|
|
133
|
+
if (typeof code === "string" && REJECTED.has(code)) return Result.ok(undefined);
|
|
134
|
+
return unavailable("cannot verify tokens", cause);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* OpenAPI security schemes for the generated document: bearer JWTs and, given the issuer, its
|
|
142
|
+
* OpenID Connect discovery document, which lets tools sign a caller in.
|
|
143
|
+
*/
|
|
144
|
+
export function jwtSecuritySchemes(options: { readonly issuer?: string } = {}): Record<string, unknown> {
|
|
145
|
+
return {
|
|
146
|
+
bearer: { type: "http", scheme: "bearer", bearerFormat: "JWT", description: "An access token from the service's issuer." },
|
|
147
|
+
...(options.issuer === undefined
|
|
148
|
+
? {}
|
|
149
|
+
: { openIdConnect: { type: "openIdConnect", openIdConnectUrl: `${options.issuer.replace(/\/+$/, "")}/.well-known/openid-configuration` } }),
|
|
150
|
+
};
|
|
151
|
+
}
|
package/README.md
DELETED