@softistx/alxia-clavix 0.0.0-stage → 0.3.0
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/README.md +122 -2
- package/dist/clavix.d.ts +85 -0
- package/dist/clavix.d.ts.map +1 -0
- package/dist/dpop/htu.d.ts +11 -0
- package/dist/dpop/htu.d.ts.map +1 -0
- package/dist/dpop/index.d.ts +6 -0
- package/dist/dpop/index.d.ts.map +1 -0
- package/dist/dpop/jwk.d.ts +20 -0
- package/dist/dpop/jwk.d.ts.map +1 -0
- package/dist/dpop/nonce.d.ts +29 -0
- package/dist/dpop/nonce.d.ts.map +1 -0
- package/dist/dpop/options.d.ts +33 -0
- package/dist/dpop/options.d.ts.map +1 -0
- package/dist/dpop/proof.d.ts +32 -0
- package/dist/dpop/proof.d.ts.map +1 -0
- package/dist/dpop/replay-store.d.ts +24 -0
- package/dist/dpop/replay-store.d.ts.map +1 -0
- package/dist/guard.d.ts +19 -0
- package/dist/guard.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +615 -0
- package/dist/index.js.map +22 -0
- package/dist/issuers.d.ts +19 -0
- package/dist/issuers.d.ts.map +1 -0
- package/dist/lru.d.ts +10 -0
- package/dist/lru.d.ts.map +1 -0
- package/dist/principal.d.ts +25 -0
- package/dist/principal.d.ts.map +1 -0
- package/dist/scope.d.ts +30 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/unverified-issuer.d.ts +3 -0
- package/dist/unverified-issuer.d.ts.map +1 -0
- package/docs/README.md +14 -0
- package/docs/guide/issuers-and-tenants.md +70 -0
- package/docs/guide/principal-and-scopes.md +59 -0
- package/docs/guide/readiness.md +31 -0
- package/docs/guide/security.md +128 -0
- package/docs/roadmap.md +38 -0
- package/docs/troubleshooting.md +269 -0
- package/package.json +52 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Steve Tsala
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,123 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @softistx/alxia-clavix
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Moved from `@alxia/clavix`: see the [migration guide](https://github.com/softistx/alxia/blob/develop/packages/core/docs/guide/migrating-from-alxia-scope.md).
|
|
4
|
+
|
|
5
|
+
Verify the access tokens Clavix (an OpenID Connect identity provider) issues in an
|
|
6
|
+
[alxia](https://www.npmjs.com/package/@softistx/alxia) API: a multi-tenant issuer allow-list on the
|
|
7
|
+
RFC 9068 profile of `@softistx/alxia-jwt`. A token is checked with the keys of its own issuer, but only an
|
|
8
|
+
issuer you allow is ever fetched from. Routes read a typed principal (`subject`, `tenant`, `scopes`, …)
|
|
9
|
+
and guard themselves with `requireScope`.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
bun add @softistx/alxia-clavix @softistx/alxia-jwt @softistx/alxia
|
|
13
|
+
bun add -d typescript
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { alxia, health } from '@softistx/alxia';
|
|
20
|
+
import { clavix, requireScope } from '@softistx/alxia-clavix';
|
|
21
|
+
|
|
22
|
+
const auth = clavix({
|
|
23
|
+
domain: 'clavix.example.com', // https://<tenant>.clavix.example.com is allowed
|
|
24
|
+
audience: 'https://api.example.com',
|
|
25
|
+
warm: ['https://acme.clavix.example.com'], // /ready waits for these issuers' keys
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
alxia()
|
|
29
|
+
.plugin(health({ checks: { clavix: auth.ready } }))
|
|
30
|
+
.use(auth.bearer())
|
|
31
|
+
.get('/invoices', requireScope('invoices:read'), ({ user, reply }) =>
|
|
32
|
+
reply(200, { tenant: user.tenant, subject: user.subject }),
|
|
33
|
+
)
|
|
34
|
+
.listen(3000);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
A request without a valid token is a 401 `{ error: 'unauthorized', reason }`; a token without the
|
|
38
|
+
scope is a 403 `{ error: 'forbidden', reason: 'insufficient_scope', scope }` with a
|
|
39
|
+
`WWW-Authenticate` challenge.
|
|
40
|
+
|
|
41
|
+
## Issuers and tenants
|
|
42
|
+
|
|
43
|
+
An issuer is allowed when it is listed (byte for byte) or is exactly `https://<one label>.<domain>`
|
|
44
|
+
(lowercase ASCII, no port, path, trailing slash or dot). The label is the tenant. Keep `domain` dedicated to Clavix tenants (no other host under it: it would be trusted). A custom domain
|
|
45
|
+
goes in `issuers`, as a list or as `{ issuer: tenant }` to name its tenant.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { clavix } from '@softistx/alxia-clavix';
|
|
49
|
+
|
|
50
|
+
clavix({
|
|
51
|
+
domain: 'clavix.example.com',
|
|
52
|
+
issuers: { 'https://login.customer.example.org': 'customer' },
|
|
53
|
+
audience: 'https://api.example.com',
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## DPoP
|
|
58
|
+
|
|
59
|
+
Tokens bound to a client key (`cnf.jkt`, RFC 9449) are checked per call when `dpop` is given: the
|
|
60
|
+
`DPoP` scheme, the proof (`typ`, ES256 or EdDSA, `htm`, `htu`, `iat`, single-use `jti`, `ath`, key
|
|
61
|
+
thumbprint equal to `cnf.jkt`) and an optional `DPoP-Nonce`. A bound token sent as `Bearer` (or in the
|
|
62
|
+
cookie) is refused.
|
|
63
|
+
|
|
64
|
+
**Behaviour change:** a token with `cnf.jkt` used to pass as a bearer token and is now a 401
|
|
65
|
+
`dpop_required`. Clients of such tokens must send `Authorization: DPoP <token>` and a `DPoP` proof
|
|
66
|
+
header, and the app must add `dpop` to `clavix()`; tokens without `cnf.jkt` need nothing. With `dpop`,
|
|
67
|
+
the `WWW-Authenticate` of a request with no token becomes `Bearer, DPoP algs="ES256 EdDSA"`.
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { connectRedis } from '@softistx/redis';
|
|
71
|
+
import { clavix, hmacDpopNonce } from '@softistx/alxia-clavix';
|
|
72
|
+
import { redisDpopReplayStore } from '@softistx/alxia-redis';
|
|
73
|
+
|
|
74
|
+
const connection = await connectRedis(Bun.env['REDIS_URL']!);
|
|
75
|
+
|
|
76
|
+
clavix({
|
|
77
|
+
domain: 'clavix.example.com',
|
|
78
|
+
audience: 'https://api.example.com',
|
|
79
|
+
dpop: {
|
|
80
|
+
origin: 'https://api.example.com', // the public origin, behind a proxy too
|
|
81
|
+
replay: redisDpopReplayStore(connection.client, { name: 'dpop' }), // shared by every instance
|
|
82
|
+
nonce: hmacDpopNonce({ secret: Bun.env['DPOP_NONCE_SECRET']! }), // optional
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`memoryDpopReplayStore()` is the replay store for tests and one instance only. No peer on
|
|
88
|
+
`@softistx/alxia-redis` is needed: its store is typed by shape.
|
|
89
|
+
|
|
90
|
+
See [Security notes](https://github.com/softistx/alxia/blob/develop/packages/clavix/docs/guide/security.md#dpop).
|
|
91
|
+
|
|
92
|
+
## API
|
|
93
|
+
|
|
94
|
+
| Export | What it is |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `clavix(options)` | a `ClavixVerifier`: a `Verifier` (`verify(token)`) with `bearer`, `ready` and `tenantOf` |
|
|
97
|
+
| `options.domain` | the deployment's domain; `https://<tenant>.<domain>` is allowed. Give `domain`, `issuers`, or both |
|
|
98
|
+
| `options.issuers` | `string[]` or `Record<issuer, tenant>`: issuers allowed beside the pattern, compared byte for byte. `https`, or `http` on localhost |
|
|
99
|
+
| `options.audience` | required: the API's identifier, which a token's `aud` must contain |
|
|
100
|
+
| `options.maxIssuers` | verified issuers whose keys are kept at once, the least recently used dropped past it (default 100) |
|
|
101
|
+
| `options.probation` | issuers not yet verified, kept in a cache of their own and promoted after one verified token (default `min(maxIssuers, 16)`) |
|
|
102
|
+
| `options.warm` | issuers whose keys `ready` waits for; each must be allowed; pinned, never evicted, not counted in `maxIssuers` |
|
|
103
|
+
| `cacheMs`, `staleMs`, `refetchMs`, `timeoutMs`, `clockTolerance`, `algorithms` | passed to `createJwt`; defaults as in [`@softistx/alxia-jwt`](https://github.com/softistx/alxia/blob/develop/packages/jwt/docs/guide/jwks.md); nothing else reaches it |
|
|
104
|
+
| `options.dpop` | `{ origin, replay, algorithms?, maxAgeSec?, clockSkewSec?, nonce? }`: verifies DPoP proofs and accepts the `DPoP` scheme; without it a token with `cnf.jkt` is refused |
|
|
105
|
+
| `hmacDpopNonce({ secret, ttlMs? })`, `memoryDpopReplayStore({ maxEntries? })`, `jwkThumbprint(jwk)` | a stateless server nonce; an in-process replay store (tests, one instance, bounded); the RFC 7638 thumbprint. The shared replay store is `redisDpopReplayStore` in `@softistx/alxia-redis` |
|
|
106
|
+
| `auth.bearer({ cookie? })` | the guard: routes after it read a `ClavixPrincipal` as `user`; a malformed token is a 401 `malformed`, and `claims` only means the issuer has no tenant |
|
|
107
|
+
| `auth.ready()` | `Promise<boolean>`, never throws: `true` once every `warm` issuer's keys are loaded (always `true` with none) |
|
|
108
|
+
| `auth.tenantOf(issuer)` | the tenant of an allowed issuer; `undefined` if refused or listed without a tenant |
|
|
109
|
+
| `requireScope(...scopes)` | a guard after `bearer()`: every scope required, else a 403 `insufficient_scope` |
|
|
110
|
+
| `ClavixPrincipal` | `subject`, `tenant`, `issuer`, `clientId`, `scopes`, `roles`, `claims` |
|
|
111
|
+
| `ClavixOptions`, `ClavixVerifier`, `DpopOptions`, `DpopReplayStore`, `DpopNonce`, `DpopReason`, `ClavixGuard`, `RequireScope`, `InsufficientScopeBody`, `InsufficientScopeProblem` | the types |
|
|
112
|
+
|
|
113
|
+
Why a token is refused (`verify` result or the 401 `reason`): `malformed` (not a JWT, no readable
|
|
114
|
+
`iss`, a required RFC 9068 claim missing or empty, or a `scope`, `roles`, `permissions` or `cnf` of the wrong shape), `issuer` (not allowed; nothing is fetched),
|
|
115
|
+
`audience`, `type` (header `typ` is not `at+jwt`), `signature`, `algorithm`, `expired`,
|
|
116
|
+
`not_yet_valid`, `key`, `keys_unavailable`, and from the guard `missing`, `claims` and the DPoP ones (`dpop_required`, `dpop_unsupported`, `dpop_malformed`, `dpop_unbound`, `dpop_proof_*`, `dpop_nonce`: see [Troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/clavix/docs/troubleshooting.md)).
|
|
117
|
+
|
|
118
|
+
## Documentation
|
|
119
|
+
|
|
120
|
+
- [Guide](https://github.com/softistx/alxia/blob/develop/packages/clavix/docs/README.md): issuers and tenants, the principal and scopes, readiness and warm-up, security notes.
|
|
121
|
+
- [Troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/clavix/docs/troubleshooting.md): an error message, and what to do about it.
|
|
122
|
+
- [Roadmap](https://github.com/softistx/alxia/blob/develop/packages/clavix/docs/roadmap.md): what is coming, and what is not planned.
|
|
123
|
+
- [Authenticate requests](https://github.com/softistx/alxia/blob/develop/docs/recipes/authentication.md): the recipe for bearer tokens in general.
|
package/dist/clavix.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type JwksOptions, type Verifier } from '@softistx/alxia-jwt';
|
|
2
|
+
import { type DpopOptions } from './dpop';
|
|
3
|
+
import { type ClavixGuard } from './guard';
|
|
4
|
+
export interface ClavixOptions extends Pick<JwksOptions, 'audience' | 'cacheMs' | 'staleMs' | 'refetchMs' | 'timeoutMs' | 'clockTolerance' | 'algorithms'> {
|
|
5
|
+
/**
|
|
6
|
+
* The deployment's domain: an issuer `https://<tenant>.<domain>` is
|
|
7
|
+
* allowed, with exactly one DNS label in front of it.
|
|
8
|
+
*/
|
|
9
|
+
readonly domain?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Issuers allowed beside the pattern (custom domains, a test issuer): a
|
|
12
|
+
* list, or `{ issuer: tenant }` to name the tenant each one stands for.
|
|
13
|
+
* Compared byte for byte.
|
|
14
|
+
*/
|
|
15
|
+
readonly issuers?: readonly string[] | Readonly<Record<string, string>>;
|
|
16
|
+
/** The API's identifier, which a token's `aud` must contain. */
|
|
17
|
+
readonly audience: string;
|
|
18
|
+
/**
|
|
19
|
+
* Issuers whose keys are kept at once, once a token from them has
|
|
20
|
+
* verified; the least recently used is dropped past it. 100 by default.
|
|
21
|
+
* `warm` issuers are not counted.
|
|
22
|
+
*/
|
|
23
|
+
readonly maxIssuers?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Issuers met but not yet proven, kept in a small cache of their own: one
|
|
26
|
+
* moves to the `maxIssuers` cache only when a token from it verifies, so
|
|
27
|
+
* forged issuers can only push each other out. `min(maxIssuers, 16)` by
|
|
28
|
+
* default.
|
|
29
|
+
*/
|
|
30
|
+
readonly probation?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Issuers whose keys `ready` waits for, each allowed by the same rules as
|
|
33
|
+
* a token's issuer (a TypeError otherwise). They are pinned: never
|
|
34
|
+
* evicted, and not counted against `maxIssuers`. Left out, `ready` is
|
|
35
|
+
* always ready.
|
|
36
|
+
*/
|
|
37
|
+
readonly warm?: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* Verifies the DPoP proof of sender-constrained tokens (RFC 9449) and
|
|
40
|
+
* accepts the `DPoP` scheme. Left out, a token bound to a key (`cnf.jkt`)
|
|
41
|
+
* is refused outright, as a bearer or as `DPoP`.
|
|
42
|
+
*/
|
|
43
|
+
readonly dpop?: DpopOptions;
|
|
44
|
+
}
|
|
45
|
+
export interface ClavixVerifier extends Verifier {
|
|
46
|
+
/**
|
|
47
|
+
* The tenant of an issuer the options allow: the slug of a pattern issuer,
|
|
48
|
+
* the mapped name of a listed one. `undefined` for a refused issuer, and
|
|
49
|
+
* for a listed issuer given without a tenant.
|
|
50
|
+
*/
|
|
51
|
+
tenantOf(issuer: string): string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* A readiness check for `health({ checks: { clavix: auth.ready } })`:
|
|
54
|
+
* resolves `true` once the keys of every `warm` issuer are loaded (a set
|
|
55
|
+
* within `cacheMs`, or stale within `staleMs`), `false` otherwise, and
|
|
56
|
+
* never throws. With no `warm` issuer it is always `true`: keys are then
|
|
57
|
+
* fetched on a tenant's first token, and a probe cannot wait for tenants
|
|
58
|
+
* it does not know.
|
|
59
|
+
*/
|
|
60
|
+
ready(): Promise<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* A guard, as `@softistx/alxia-jwt`'s `bearer()` (same 401s and cookie mode): the
|
|
63
|
+
* routes after it read a `ClavixPrincipal` as `user`. A token whose claims
|
|
64
|
+
* are malformed (no `sub`, `iss` or `client_id`, a bad `scope`, `roles`,
|
|
65
|
+
* `permissions` or `cnf`) is a 401 `malformed`, refused by the RFC 9068
|
|
66
|
+
* profile before the principal is built; reason `claims` is only for a
|
|
67
|
+
* listed issuer with no tenant (give `{ issuer: tenant }`).
|
|
68
|
+
*/
|
|
69
|
+
bearer(options?: {
|
|
70
|
+
/** Reads the token from this cookie when no `Authorization` header carries one. */
|
|
71
|
+
readonly cookie?: string;
|
|
72
|
+
}): ClavixGuard;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A verifier of the access tokens Clavix issues, for any tenant: a token is
|
|
76
|
+
* checked with the keys of its own issuer, but only an issuer the options
|
|
77
|
+
* allow is ever fetched from.
|
|
78
|
+
*
|
|
79
|
+
* ```ts
|
|
80
|
+
* const verifier = clavix({ domain: 'clavix.example', audience: 'https://api.example' });
|
|
81
|
+
* const result = await verifier.verify(token);
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function clavix(options: ClavixOptions): ClavixVerifier;
|
|
85
|
+
//# sourceMappingURL=clavix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clavix.d.ts","sourceRoot":"","sources":["../src/clavix.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,KAAK,WAAW,EAAS,MAAM,SAAS,CAAC;AAWlD,MAAM,WAAW,aAChB,SAAQ,IAAI,CACX,WAAW,EACT,UAAU,GACV,SAAS,GACT,SAAS,GACT,WAAW,GACX,WAAW,GACX,gBAAgB,GAChB,YAAY,CACd;IACD;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxE,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC7C;;;;;;;OAOG;IACH,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE;QAChB,mFAAmF;QACnF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,WAAW,CAAC;CAChB;AAuDD;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,CA+D7D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a proof's `htu` names this request: the configured public origin
|
|
3
|
+
* (already normalised by `resolveDpop`) and the request's path, the query and the fragment ignored (RFC 9449
|
|
4
|
+
* section 4.3). The scheme and host compare without case and without a
|
|
5
|
+
* default port (`:443`, `:80`) as URL parsing normalises them; the path
|
|
6
|
+
* compares exactly (a trailing slash matters; percent-escapes compare as
|
|
7
|
+
* written, RFC 3986 6.2.2 normalisation is not applied, which can only refuse); a `htu` with userinfo never
|
|
8
|
+
* matches.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sameUrl(htu: string, origin: string, path: string): boolean;
|
|
11
|
+
//# sourceMappingURL=htu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"htu.d.ts","sourceRoot":"","sources":["../../src/dpop/htu.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAS1E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { jwkThumbprint } from './jwk';
|
|
2
|
+
export { type DpopNonce, hmacDpopNonce } from './nonce';
|
|
3
|
+
export { type DpopAlgorithm, type DpopOptions, type ResolvedDpop, resolveDpop, } from './options';
|
|
4
|
+
export { type DpopReason, verifyProof } from './proof';
|
|
5
|
+
export { type DpopReplayStore, memoryDpopReplayStore } from './replay-store';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dpop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,KAAK,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,WAAW,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,KAAK,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DpopAlgorithm } from './options';
|
|
2
|
+
/** The members of a proof's header, claims and key that are read. */
|
|
3
|
+
export type Fields = Partial<Record<'typ' | 'alg' | 'jwk' | 'crit' | 'htm' | 'htu' | 'iat' | 'jti' | 'ath' | 'nonce' | 'd' | 'kty' | 'crv' | 'x' | 'y', unknown>>;
|
|
4
|
+
export declare const encoder: TextEncoder;
|
|
5
|
+
export declare const isObject: (value: unknown) => value is Fields;
|
|
6
|
+
/** A JWT part as an object, or `undefined`. */
|
|
7
|
+
export declare function decode(part: string): Fields | undefined;
|
|
8
|
+
export interface ProofKey {
|
|
9
|
+
readonly jwk: JsonWebKey;
|
|
10
|
+
readonly params: EcKeyImportParams | Algorithm;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The public key of a proof's header, kept to its public members, with its
|
|
14
|
+
* algorithm's import parameters; `undefined` for a private key, another
|
|
15
|
+
* curve, or a key that does not fit `alg`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function publicKey(jwk: Fields, alg: DpopAlgorithm): ProofKey | undefined;
|
|
18
|
+
/** The RFC 7638 thumbprint of a public JWK made by `publicKey`. */
|
|
19
|
+
export declare function jwkThumbprint(jwk: JsonWebKey): Promise<string>;
|
|
20
|
+
//# sourceMappingURL=jwk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwk.d.ts","sourceRoot":"","sources":["../../src/dpop/jwk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,qEAAqE;AACrE,MAAM,MAAM,MAAM,GAAG,OAAO,CAC3B,MAAM,CACH,KAAK,GACL,KAAK,GACL,KAAK,GACL,MAAM,GACN,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,OAAO,GACP,GAAG,GACH,KAAK,GACL,KAAK,GACL,GAAG,GACH,GAAG,EACL,OAAO,CACP,CACD,CAAC;AAEF,eAAO,MAAM,OAAO,aAAoB,CAAC;AAEzC,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACkB,CAAC;AAEtE,+CAA+C;AAC/C,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASvD;AAED,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAC/C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACxB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,aAAa,GAChB,QAAQ,GAAG,SAAS,CAgBtB;AAED,mEAAmE;AACnE,wBAAsB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAUpE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The server nonce of RFC 9449 section 8: `issue` makes the nonce a client
|
|
3
|
+
* must put in its next proof, `accepts` tells whether a nonce is still valid.
|
|
4
|
+
*/
|
|
5
|
+
export interface DpopNonce {
|
|
6
|
+
issue(): string | Promise<string>;
|
|
7
|
+
accepts(nonce: string): boolean | Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* A fresh nonce for a client whose accepted `nonce` is near its end
|
|
10
|
+
* (RFC 9449 section 8.2), sent as `DPoP-Nonce` on the answer so the next
|
|
11
|
+
* proof does not meet a `use_dpop_nonce` refusal; `undefined` while it
|
|
12
|
+
* has time left.
|
|
13
|
+
*/
|
|
14
|
+
renew?(nonce: string): string | Promise<string | undefined> | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** Constant-time equality of two strings. */
|
|
17
|
+
export declare function timingSafeEqual(a: string, b: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* A stateless nonce: a time stamp signed with a key derived from `secret`
|
|
20
|
+
* (HMAC-SHA-256, with a label of its own, so the same secret may serve
|
|
21
|
+
* elsewhere), valid for `ttlMs` (5 minutes by default). Every instance
|
|
22
|
+
* sharing `secret` accepts the nonces of the others, with nothing stored.
|
|
23
|
+
* The secret needs 16 characters.
|
|
24
|
+
*/
|
|
25
|
+
export declare function hmacDpopNonce(options: {
|
|
26
|
+
readonly secret: string;
|
|
27
|
+
readonly ttlMs?: number;
|
|
28
|
+
}): DpopNonce;
|
|
29
|
+
//# sourceMappingURL=nonce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonce.d.ts","sourceRoot":"","sources":["../../src/dpop/nonce.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,SAAS;IACzB,KAAK,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD;;;;;OAKG;IACH,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;CACxE;AAID,6CAA6C;AAC7C,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAS7D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,SAAS,CAoDZ"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DpopNonce } from './nonce';
|
|
2
|
+
import type { DpopReplayStore } from './replay-store';
|
|
3
|
+
/** The signature algorithms a DPoP proof may use (RFC 9449 section 4.2). */
|
|
4
|
+
export type DpopAlgorithm = 'ES256' | 'EdDSA';
|
|
5
|
+
export interface DpopOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The origin clients use to reach the API (`https://api.example.com`), what
|
|
8
|
+
* a proof's `htu` must start with. Behind a proxy the request's own URL is
|
|
9
|
+
* the internal one: this is the public one, never read from a header.
|
|
10
|
+
*/
|
|
11
|
+
readonly origin: string;
|
|
12
|
+
/** Where the `jti` of accepted proofs are remembered: `redisDpopReplayStore` in production, `memoryDpopReplayStore()` for tests. */
|
|
13
|
+
readonly replay: DpopReplayStore;
|
|
14
|
+
/** Proof algorithms accepted, `['ES256', 'EdDSA']` by default. */
|
|
15
|
+
readonly algorithms?: readonly DpopAlgorithm[];
|
|
16
|
+
/** How old a proof's `iat` may be, in seconds. 60 by default. */
|
|
17
|
+
readonly maxAgeSec?: number;
|
|
18
|
+
/** How far ahead of this server's clock an `iat` may be, in seconds. 5 by default. */
|
|
19
|
+
readonly clockSkewSec?: number;
|
|
20
|
+
/** Asks clients for a server nonce (RFC 9449 section 8): `hmacDpopNonce({ secret })`. Off by default. */
|
|
21
|
+
readonly nonce?: DpopNonce;
|
|
22
|
+
}
|
|
23
|
+
export interface ResolvedDpop {
|
|
24
|
+
readonly origin: string;
|
|
25
|
+
readonly replay: DpopReplayStore;
|
|
26
|
+
readonly algorithms: readonly DpopAlgorithm[];
|
|
27
|
+
readonly maxAgeSec: number;
|
|
28
|
+
readonly clockSkewSec: number;
|
|
29
|
+
readonly nonce: DpopNonce | undefined;
|
|
30
|
+
}
|
|
31
|
+
/** The options, checked, with their defaults. */
|
|
32
|
+
export declare function resolveDpop(options: DpopOptions): ResolvedDpop;
|
|
33
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/dpop/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oIAAoI;IACpI,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,kEAAkE;IAClE,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/C,iEAAiE;IACjE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,sFAAsF;IACtF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,yGAAyG;IACzG,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;CACtC;AAED,iDAAiD;AACjD,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,CAkD9D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ResolvedDpop } from './options';
|
|
2
|
+
/** Why a request's DPoP check failed. */
|
|
3
|
+
export type DpopReason = 'dpop_required' | 'dpop_unsupported' | 'dpop_unbound' | 'dpop_proof_missing' | 'dpop_proof_malformed' | 'dpop_proof_type' | 'dpop_proof_algorithm' | 'dpop_proof_key' | 'dpop_proof_signature' | 'dpop_proof_method' | 'dpop_proof_url' | 'dpop_proof_iat' | 'dpop_proof_jti' | 'dpop_proof_ath' | 'dpop_proof_thumbprint' | 'dpop_proof_replay' | 'dpop_malformed' | 'dpop_nonce';
|
|
4
|
+
export type ProofResult = {
|
|
5
|
+
readonly ok: true;
|
|
6
|
+
/** A fresh nonce to send as `DPoP-Nonce`: the accepted one is near its end. */
|
|
7
|
+
readonly nonce?: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly ok: false;
|
|
10
|
+
readonly reason: DpopReason;
|
|
11
|
+
/** Set with `dpop_nonce`: the nonce the client must use. */
|
|
12
|
+
readonly nonce?: string;
|
|
13
|
+
};
|
|
14
|
+
export interface ProofInput {
|
|
15
|
+
/** The `DPoP` header value. */
|
|
16
|
+
readonly proof: string | null;
|
|
17
|
+
/** The request's method. */
|
|
18
|
+
readonly method: string;
|
|
19
|
+
/** The request's path, as the client sent it. */
|
|
20
|
+
readonly path: string;
|
|
21
|
+
/** The access token the proof is bound to. */
|
|
22
|
+
readonly accessToken: string;
|
|
23
|
+
/** The token's `cnf.jkt`. */
|
|
24
|
+
readonly jkt: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Checks a DPoP proof against RFC 9449 section 4.3, in the cheap-to-costly
|
|
28
|
+
* order, and remembers its `jti` last: a proof refused for anything else is
|
|
29
|
+
* never recorded.
|
|
30
|
+
*/
|
|
31
|
+
export declare function verifyProof(input: ProofInput, options: ResolvedDpop): Promise<ProofResult>;
|
|
32
|
+
//# sourceMappingURL=proof.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../src/dpop/proof.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,WAAW,CAAC;AAE7D,yCAAyC;AACzC,MAAM,MAAM,UAAU,GACnB,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,oBAAoB,GACpB,sBAAsB,GACtB,iBAAiB,GACjB,sBAAsB,GACtB,gBAAgB,GAChB,sBAAsB,GACtB,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,uBAAuB,GACvB,mBAAmB,GACnB,gBAAgB,GAChB,YAAY,CAAC;AAEhB,MAAM,MAAM,WAAW,GACpB;IACA,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACvB,GACD;IACA,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEL,MAAM,WAAW,UAAU;IAC1B,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,6BAA6B;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACrB;AAwGD;;;;GAIG;AACH,wBAAsB,WAAW,CAChC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,YAAY,GACnB,OAAO,CAAC,WAAW,CAAC,CA+BtB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remembers the `jti` of the proofs already accepted, so that a proof is
|
|
3
|
+
* used once. `claim` records `key` for `ttlMs` and answers `true` the first
|
|
4
|
+
* time, `false` while it is still remembered. It must be atomic across the
|
|
5
|
+
* processes that serve the API (Redis `SET NX PX`), and it may throw: a store
|
|
6
|
+
* that cannot answer fails the request (a 500), it never lets a proof
|
|
7
|
+
* through unchecked.
|
|
8
|
+
*/
|
|
9
|
+
export interface DpopReplayStore {
|
|
10
|
+
claim(key: string, ttlMs: number): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A replay store in the memory of this process: **for tests and a single
|
|
14
|
+
* instance only**. Two instances behind a load balancer each have their own
|
|
15
|
+
* memory, so a proof replayed on the other one is accepted: use
|
|
16
|
+
* `redisDpopReplayStore` from `@softistx/alxia-redis` there. It holds at
|
|
17
|
+
* most `maxEntries` live proofs (10 000 by default) and throws past that,
|
|
18
|
+
* rather than growing without bound or forgetting a proof. Once full, each
|
|
19
|
+
* claim first sweeps the expired entries, which costs O(`maxEntries`).
|
|
20
|
+
*/
|
|
21
|
+
export declare function memoryDpopReplayStore(options?: {
|
|
22
|
+
readonly maxEntries?: number;
|
|
23
|
+
}): DpopReplayStore;
|
|
24
|
+
//# sourceMappingURL=replay-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-store.d.ts","sourceRoot":"","sources":["../../src/dpop/replay-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC/B,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,GAAE;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5C,eAAe,CAoBjB"}
|
package/dist/guard.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@softistx/alxia';
|
|
2
|
+
import { type Bearer, type UnauthorizedBody, type UnauthorizedProblem, type Verifier } from '@softistx/alxia-jwt';
|
|
3
|
+
import { type DpopReason, type ResolvedDpop } from './dpop';
|
|
4
|
+
import type { ClavixPrincipal } from './principal';
|
|
5
|
+
/** The body of a Clavix 401: the reasons of `@softistx/alxia-jwt`'s, and the DPoP ones. */
|
|
6
|
+
export type ClavixUnauthorizedBody = UnauthorizedBody<DpopReason>;
|
|
7
|
+
/** The 401 under `alxia({ errors: 'problem' })`. */
|
|
8
|
+
export type ClavixUnauthorizedProblem = UnauthorizedProblem<DpopReason>;
|
|
9
|
+
/** What `clavix().bearer()` makes: a middleware that gives `user`, or answers the 401. */
|
|
10
|
+
export type ClavixGuard = Bearer<StandardSchemaV1<unknown, ClavixPrincipal>, DpopReason>;
|
|
11
|
+
export interface GuardOptions {
|
|
12
|
+
readonly jwt: Verifier;
|
|
13
|
+
readonly schema: StandardSchemaV1<unknown, ClavixPrincipal>;
|
|
14
|
+
readonly cookie?: string | undefined;
|
|
15
|
+
readonly dpop?: ResolvedDpop | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** The guard of `clavix().bearer()`: `Bearer` and, with `dpop`, `DPoP` tokens. */
|
|
18
|
+
export declare function guard(options: GuardOptions): ClavixGuard;
|
|
19
|
+
//# sourceMappingURL=guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACN,KAAK,MAAM,EAGX,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAe,MAAM,QAAQ,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,2FAA2F;AAC3F,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAElE,oDAAoD;AACpD,MAAM,MAAM,yBAAyB,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAExE,0FAA0F;AAC1F,MAAM,MAAM,WAAW,GAAG,MAAM,CAC/B,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,EAC1C,UAAU,CACV,CAAC;AAEF,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC5D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACzC;AAyFD,kFAAkF;AAClF,wBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW,CAOxD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { type ClavixOptions, type ClavixVerifier, clavix } from './clavix';
|
|
2
|
+
export { type DpopAlgorithm, type DpopNonce, type DpopOptions, type DpopReason, type DpopReplayStore, hmacDpopNonce, memoryDpopReplayStore, } from './dpop';
|
|
3
|
+
export type { ClavixGuard, ClavixUnauthorizedBody, ClavixUnauthorizedProblem, } from './guard';
|
|
4
|
+
export type { ClavixPrincipal } from './principal';
|
|
5
|
+
export { type InsufficientScopeBody, type InsufficientScopeProblem, type RequireScope, requireScope, } from './scope';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,aAAa,EACb,qBAAqB,GACrB,MAAM,QAAQ,CAAC;AAChB,YAAY,EACX,WAAW,EACX,sBAAsB,EACtB,yBAAyB,GACzB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,YAAY,GACZ,MAAM,SAAS,CAAC"}
|