@spine-event-engine/auth 2.0.0-snapshot.26 → 2.0.0-snapshot.29
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/README.md +102 -11
- package/REFERENCE.md +125 -3
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/oidc/contracts.d.ts +18 -4
- package/dist/oidc/contracts.d.ts.map +1 -1
- package/dist/oidc/flow-store.d.ts +143 -0
- package/dist/oidc/flow-store.d.ts.map +1 -0
- package/dist/oidc/flow-store.js +184 -0
- package/dist/oidc/flow-store.js.map +1 -0
- package/dist/oidc/index.d.ts +29 -9
- package/dist/oidc/index.d.ts.map +1 -1
- package/dist/oidc/index.js +611 -152
- package/dist/oidc/index.js.map +1 -1
- package/dist/oidc/persistent-flow-store.d.ts +117 -0
- package/dist/oidc/persistent-flow-store.d.ts.map +1 -0
- package/dist/oidc/persistent-flow-store.js +413 -0
- package/dist/oidc/persistent-flow-store.js.map +1 -0
- package/dist/oidc/records.d.ts +15 -0
- package/dist/oidc/records.d.ts.map +1 -0
- package/dist/oidc/records.js +91 -0
- package/dist/oidc/records.js.map +1 -0
- package/dist/providers/index.d.ts +10 -5
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +103 -30
- package/dist/providers/index.js.map +1 -1
- package/dist/sessions/cookies.d.ts +46 -8
- package/dist/sessions/cookies.d.ts.map +1 -1
- package/dist/sessions/cookies.js +269 -47
- package/dist/sessions/cookies.js.map +1 -1
- package/dist/sessions/opaque-session-store.d.ts +143 -0
- package/dist/sessions/opaque-session-store.d.ts.map +1 -0
- package/dist/sessions/opaque-session-store.js +185 -0
- package/dist/sessions/opaque-session-store.js.map +1 -0
- package/dist/sessions/opaque.d.ts +93 -106
- package/dist/sessions/opaque.d.ts.map +1 -1
- package/dist/sessions/opaque.js +501 -232
- package/dist/sessions/opaque.js.map +1 -1
- package/dist/sessions/persistent-opaque-session-store.d.ts +105 -0
- package/dist/sessions/persistent-opaque-session-store.d.ts.map +1 -0
- package/dist/sessions/persistent-opaque-session-store.js +333 -0
- package/dist/sessions/persistent-opaque-session-store.js.map +1 -0
- package/dist/sessions/persistent-token-revocations.d.ts +90 -0
- package/dist/sessions/persistent-token-revocations.d.ts.map +1 -0
- package/dist/sessions/persistent-token-revocations.js +422 -0
- package/dist/sessions/persistent-token-revocations.js.map +1 -0
- package/dist/sessions/session-lifetime.d.ts +67 -0
- package/dist/sessions/session-lifetime.d.ts.map +1 -0
- package/dist/sessions/session-lifetime.js +165 -0
- package/dist/sessions/session-lifetime.js.map +1 -0
- package/dist/sessions/session-record.d.ts +15 -0
- package/dist/sessions/session-record.d.ts.map +1 -0
- package/dist/sessions/session-record.js +109 -0
- package/dist/sessions/session-record.js.map +1 -0
- package/dist/sessions/signed.d.ts +5 -4
- package/dist/sessions/signed.d.ts.map +1 -1
- package/dist/sessions/signed.js +212 -74
- package/dist/sessions/signed.js.map +1 -1
- package/dist/subscriptions/index.d.ts.map +1 -1
- package/dist/subscriptions/index.js +260 -26
- package/dist/subscriptions/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -6
package/README.md
CHANGED
|
@@ -24,15 +24,25 @@ is native-only and treats auth as an optional peer.
|
|
|
24
24
|
|
|
25
25
|
## First success: create and resolve a local session
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
Omitting a store selects process-local memory for development. Configure a seal
|
|
28
|
+
secret and explicit session policy before issuing credentials. A
|
|
29
|
+
`PersistentOpaqueSessionStore` can instead share the same atomic sessions across
|
|
30
|
+
processes; its asynchronous factory prepares selected structures by default.
|
|
29
31
|
|
|
30
32
|
```ts
|
|
31
33
|
import { OpaqueSessions } from "@spine-event-engine/auth";
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
import { Time } from "@spine-event-engine/core/time";
|
|
35
|
+
|
|
36
|
+
const password = process.env.SESSION_SEAL_PASSWORD;
|
|
37
|
+
if (!password) throw new Error("Configure SESSION_SEAL_PASSWORD");
|
|
38
|
+
const sessions = await OpaqueSessions.create({
|
|
39
|
+
scope: "local-browser",
|
|
40
|
+
password,
|
|
41
|
+
clock: { now: Time.currentTimeMillis },
|
|
42
|
+
ttlMilliseconds: 60 * 60 * 1_000,
|
|
43
|
+
});
|
|
34
44
|
try {
|
|
35
|
-
const created = await sessions.
|
|
45
|
+
const created = await sessions.issue({ id: "local-user" });
|
|
36
46
|
if (created.kind !== "created") throw new Error(`Session creation failed: ${created.reason}`);
|
|
37
47
|
const resolved = await sessions.resolve(created.credential);
|
|
38
48
|
if (resolved === undefined) throw new Error("New local session was not resolvable");
|
|
@@ -42,6 +52,67 @@ try {
|
|
|
42
52
|
}
|
|
43
53
|
```
|
|
44
54
|
|
|
55
|
+
## Share opaque sessions through PostgreSQL
|
|
56
|
+
|
|
57
|
+
Install `@spine-event-engine/storage-postgres` alongside the auth package. Give
|
|
58
|
+
the session family a dedicated storage group. The database and schema must
|
|
59
|
+
already exist.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { OpaqueSessions, PersistentOpaqueSessionStore } from "@spine-event-engine/auth";
|
|
63
|
+
import { Time } from "@spine-event-engine/core/time";
|
|
64
|
+
import { StorageGroup } from "@spine-event-engine/storage";
|
|
65
|
+
import { PostgresStorageFactory } from "@spine-event-engine/storage-postgres";
|
|
66
|
+
|
|
67
|
+
const url = process.env.DATABASE_URL;
|
|
68
|
+
const password = process.env.SESSION_SEAL_PASSWORD;
|
|
69
|
+
if (!url || !password) throw new Error("Configure database and session credentials");
|
|
70
|
+
const factory = await PostgresStorageFactory.newBuilder().setOptions({ url }).build();
|
|
71
|
+
let store: PersistentOpaqueSessionStore | undefined;
|
|
72
|
+
try {
|
|
73
|
+
store = await PersistentOpaqueSessionStore.create({
|
|
74
|
+
storageFactory: factory,
|
|
75
|
+
group: new StorageGroup("auth_sessions"),
|
|
76
|
+
});
|
|
77
|
+
const sessions = await OpaqueSessions.create({
|
|
78
|
+
store,
|
|
79
|
+
scope: "orders-browser",
|
|
80
|
+
password,
|
|
81
|
+
clock: { now: Time.currentTimeMillis },
|
|
82
|
+
ttlMilliseconds: 60 * 60 * 1_000,
|
|
83
|
+
});
|
|
84
|
+
try {
|
|
85
|
+
const issued = await sessions.issue({ id: "user-42" });
|
|
86
|
+
if (issued.kind !== "created") throw new Error(`Session issue failed: ${issued.reason}`);
|
|
87
|
+
// Send issued.credential through the application's credential transport.
|
|
88
|
+
} finally {
|
|
89
|
+
await sessions.close();
|
|
90
|
+
}
|
|
91
|
+
} finally {
|
|
92
|
+
try {
|
|
93
|
+
await store?.close();
|
|
94
|
+
} finally {
|
|
95
|
+
await factory.close();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The strategy leaves an injected store open; close the strategy, store, and
|
|
101
|
+
factory in that order. Use the same group and seal policy in each process.
|
|
102
|
+
|
|
103
|
+
## Signed bearer sessions
|
|
104
|
+
|
|
105
|
+
`SignedSessions` issues and verifies ES256 bearer tokens with an application
|
|
106
|
+
P-256 key pair. Without a revocation source, logout reports expiry-only.
|
|
107
|
+
`PersistentTokenRevocations.create` supplies shared scoped revocation through
|
|
108
|
+
the selected storage factory and group; pass the resulting store as the
|
|
109
|
+
strategy's `revocation`. The store prepares its indexed record family by
|
|
110
|
+
default. Its explicit `purgeExpired` method removes records only after their
|
|
111
|
+
full inclusive acceptance deadline, including configured clock skew. The
|
|
112
|
+
application closes the strategy, store, and factory separately. See the
|
|
113
|
+
[signed session reference](REFERENCE.md) for exact retention and maintenance
|
|
114
|
+
behavior.
|
|
115
|
+
|
|
45
116
|
For a real gateway, construct `UnaryGateway` with exactly one admission mode:
|
|
46
117
|
`sessions`, or deliberate `publicAccess: true`. It requires a finite request
|
|
47
118
|
limit, policy, trusted-context resolver, clock, and forwarder. Every approved
|
|
@@ -82,12 +153,24 @@ for direct native authentication and managed forwarding configuration.
|
|
|
82
153
|
|
|
83
154
|
## Browser and OIDC extensions
|
|
84
155
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
156
|
+
`OidcFlow` is a component flow: the application provides its start, callback,
|
|
157
|
+
exchange, identity mapping, and session issuance routes. It does not supply
|
|
158
|
+
browser pages, users, permissions, TLS, or a production session database. An application can compose `OidcFlow` with
|
|
159
|
+
Google, GitHub, or another verified provider.
|
|
89
160
|
Keep provider access, refresh, and ID tokens server-side.
|
|
90
161
|
|
|
162
|
+
`OidcFlow.start()` is asynchronous: await it before redirecting the browser.
|
|
163
|
+
The default transaction and application-grant store is process-local. To share
|
|
164
|
+
one login flow across processes, create `PersistentOidcFlowStore` with a
|
|
165
|
+
`StorageFactory`, `StorageGroup`, and stable `flowId`, then pass it in
|
|
166
|
+
`OidcFlowOptions.store`. The factory prepares both record families by default;
|
|
167
|
+
`createMissingStructures: false` skips preparation. Close the flow, then its
|
|
168
|
+
injected store and factory when the application shuts down. Call
|
|
169
|
+
`purgeExpired(cutoff)` explicitly for expired records; no timer runs it.
|
|
170
|
+
|
|
171
|
+
The application must send the authorization URL returned by `OidcFlow.start()`
|
|
172
|
+
to the browser and supply the actual callback parameters.
|
|
173
|
+
|
|
91
174
|
For browser-facing hosting, install the server browser entry point and use
|
|
92
175
|
`BrowserServer` and `DurableSubscriptionBindings` from
|
|
93
176
|
`@spine-event-engine/server/browser`. That boundary requires exact origins,
|
|
@@ -96,8 +179,16 @@ durable authenticated bindings when applicable.
|
|
|
96
179
|
|
|
97
180
|
## Limits and next steps
|
|
98
181
|
|
|
99
|
-
|
|
100
|
-
|
|
182
|
+
The [Fieldnotes application](https://github.com/SpineEventEngine/spine-ts/blob/master/examples/fieldnotes/README.md)
|
|
183
|
+
connects a Next.js map interface to a single-tenant Bounded Context. Its two launch
|
|
184
|
+
options demonstrate direct Google OIDC and Google sign-in through Firebase Auth.
|
|
185
|
+
Both use persistent opaque application sessions stored through the PostgreSQL
|
|
186
|
+
storage factory. The application guide follows sign-in through authenticated
|
|
187
|
+
Commands, private queries and subscriptions, and logout.
|
|
188
|
+
|
|
189
|
+
Memory-selected `OpaqueSessions` is process-local; select durable shared storage
|
|
190
|
+
for sessions that must survive process restart. Signed-session revocation and
|
|
191
|
+
OIDC identity provisioning are application responsibilities. A gateway protects
|
|
101
192
|
only traffic that operators route through it; do not expose a backend route
|
|
102
193
|
around that boundary.
|
|
103
194
|
|
package/REFERENCE.md
CHANGED
|
@@ -83,12 +83,134 @@ receiving boundary. Credentials and provider tokens are not forwarding fields.
|
|
|
83
83
|
|
|
84
84
|
## Sessions and sign-in
|
|
85
85
|
|
|
86
|
-
`OpaqueSessions`
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
`OpaqueSessions.create` requires an application scope, iron-session password
|
|
87
|
+
configuration, trusted clock, and positive lifetime. `issue` seals a random
|
|
88
|
+
stable reference and generation before atomic absent insertion. `resolve`
|
|
89
|
+
checks the current stored generation and exact deadline without renewal.
|
|
90
|
+
The authenticated application deadline is authoritative: any grace period in
|
|
91
|
+
iron-session's seal validation cannot extend it. Rotation seals before
|
|
92
|
+
compare-and-set. An old unexpired seal can revoke the current generation, but
|
|
93
|
+
an expired seal cannot resolve or revoke.
|
|
94
|
+
|
|
95
|
+
Omitting the store selects process-local memory. `PersistentOpaqueSessionStore.create`
|
|
96
|
+
accepts a common storage factory and group; it prepares the indexed session
|
|
97
|
+
family before returning by default. `createMissingStructures: false` opens a
|
|
98
|
+
non-preparing handle for already prepared structures. The strategy leaves an
|
|
99
|
+
injected store open, so the application closes the strategy, store, and factory
|
|
100
|
+
separately. Explicit `purgeExpired(cutoff, signal)` traverses finite indexed
|
|
101
|
+
pages with conditional removal in the persistent store; process-local memory
|
|
102
|
+
scans its own records. If a row changes during conditional removal, the pass
|
|
103
|
+
finishes that expiry group and returns its removed count. The changed row and
|
|
104
|
+
other eligible rows in later groups can remain for another explicit purge.
|
|
105
|
+
Storage errors and cancellation reject, possibly after partial removal. No
|
|
106
|
+
timer calls maintenance automatically.
|
|
107
|
+
|
|
108
|
+
For cancellation after a confirmed insertion or replacement, the strategy
|
|
109
|
+
attempts conditional compensation and returns no credential. A storage error
|
|
110
|
+
that does not confirm whether a commit occurred cannot safely authorize removal:
|
|
111
|
+
another session may already occupy the same stable reference. The operation
|
|
112
|
+
fails without returning a credential, but a committed row may require later
|
|
113
|
+
explicit maintenance. This is a best-effort cleanup guarantee.
|
|
114
|
+
|
|
115
|
+
`SignedSessions` issues and verifies ES256 application bearer tokens using jose.
|
|
116
|
+
Without a `SignedTokenRevocation` source, logout is expiry-only. For shared
|
|
117
|
+
revocation, create `PersistentTokenRevocations` with a storage factory, group,
|
|
118
|
+
issuer, and audience, then inject it as `revocation`. Its asynchronous factory
|
|
119
|
+
prepares the indexed record family by default; `createMissingStructures: false`
|
|
120
|
+
opens a non-preparing handle with no physical schema checks or DDL at creation
|
|
121
|
+
or during later operations. If structures are missing, ordinary storage
|
|
122
|
+
operations fail. Close the strategy, revocation store, and shared
|
|
123
|
+
factory separately. The strategy passes the full inclusive acceptance deadline,
|
|
124
|
+
including clock skew, to the store. Reads ignore records after that deadline
|
|
125
|
+
even before maintenance. Explicit `purgeExpired(cutoff, signal)` removes only
|
|
126
|
+
records strictly before a cutoff no later than the store's trusted clock. It
|
|
127
|
+
uses scoped indexed pages and conditional deletion; a concurrent change can
|
|
128
|
+
leave eligible rows for a later invocation. No automatic cleanup runs.
|
|
129
|
+
|
|
130
|
+
`SessionResolver.resolve(credential, lifetime?)` accepts an optional operation
|
|
131
|
+
signal. Omitting it performs one validation without a retained monitor. With
|
|
132
|
+
one, standard opaque and signed strategies register by stable authenticated
|
|
133
|
+
identity before the authoritative storage or revocation read and return
|
|
134
|
+
`ResolvedSession.invalidated`. Local logout, the captured resolved deadline,
|
|
135
|
+
or strategy close aborts that signal. The supplied operation ending releases
|
|
136
|
+
the listener and expiry timer. Opaque rotation does not extend an existing
|
|
137
|
+
operation's captured deadline; signed token verification skew and durable
|
|
138
|
+
revocation retention do not extend it either. The Gateway links invalidation
|
|
139
|
+
to its backend cancellation and suppresses late updates. Logout errors remain
|
|
140
|
+
visible even when local forwarding has stopped. Another process receives no
|
|
141
|
+
local abort signal and must validate against shared durable state separately.
|
|
142
|
+
`OpaqueSessionCookies` binds its CSRF value to the complete sealed credential,
|
|
143
|
+
parses Cookie fields with cookie 2.0.1 after duplicate checks, and emits separate
|
|
144
|
+
secure `__Host-` session and CSRF `Set-Cookie` fields. Pass the actual issued
|
|
145
|
+
deadline to `issue`; `persistent: true` gives both cookies that deadline while
|
|
146
|
+
the default keeps them as browser-session cookies. `sameSite` accepts `lax`,
|
|
147
|
+
`strict`, or `none`; the session cookie remains `HttpOnly` and the CSRF cookie
|
|
148
|
+
remains readable by the browser.
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
import { OpaqueSessionCookies, type OpaqueSessions } from "@spine-event-engine/auth";
|
|
152
|
+
|
|
153
|
+
declare const sessions: OpaqueSessions;
|
|
154
|
+
const cookies = new OpaqueSessionCookies({
|
|
155
|
+
csrfSecret: crypto.getRandomValues(new Uint8Array(32)),
|
|
156
|
+
origins: ["https://app.example"],
|
|
157
|
+
sameSite: "strict",
|
|
158
|
+
persistent: true,
|
|
159
|
+
});
|
|
160
|
+
const issued = await sessions.issue({ id: "example-user" });
|
|
161
|
+
if (issued.kind === "created") {
|
|
162
|
+
const setCookieFields = cookies.issue(issued.credential.value, issued.session.expiresAt);
|
|
163
|
+
// Append each field separately to the HTTP response.
|
|
164
|
+
void setCookieFields;
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
After rotation, call `issue` again with the new sealed value and its deadline;
|
|
169
|
+
`clear()` emits matching host-only removal fields. `read` distinguishes missing
|
|
170
|
+
credentials from terminal rejection so browser hosting does not fall back to a
|
|
171
|
+
different reader after invalid input.
|
|
172
|
+
Neither strategy provisions users nor grants permissions.
|
|
89
173
|
|
|
90
174
|
`OidcFlow` is a bounded authorization-code and PKCE transaction manager. It works with `createGoogleProvider`, `createGitHubProvider`, or a discovered or configured OIDC provider. Applications expose start/callback/exchange endpoints, perform HTTP routing, map verified external identity through `IdentityMapping`, and issue an application session through `ApplicationSessionIssuer`. Provider access, refresh, and ID tokens remain sensitive server-side material; do not return them to browser application code.
|
|
91
175
|
|
|
176
|
+
`OidcFlow.start()` awaits transaction persistence before returning an
|
|
177
|
+
authorization URL. Callback binding and expiry are validated before the
|
|
178
|
+
transaction is atomically consumed; provider exchange and identity mapping
|
|
179
|
+
follow consumption. Browser PKCE proof and grant expiry are validated before
|
|
180
|
+
the grant is consumed; application session issuance follows consumption. A
|
|
181
|
+
trusted clock check after each confirmed consumption stops the next external
|
|
182
|
+
step if the record reached expiry while storage was pending. A
|
|
183
|
+
failed external step does not restore a consumed record. Independent flow
|
|
184
|
+
instances select the same one-use records through their configured store.
|
|
185
|
+
The optional second `AbortSignal` on start, callback, and exchange carries host
|
|
186
|
+
request cancellation. Ordinary abort rejects with that reason; a distinct
|
|
187
|
+
session issuer failure rejects the pending exchange or, after an abort or
|
|
188
|
+
timeout has returned, is reported by `close()`. Close waits for admitted work
|
|
189
|
+
and the original provider, mapping, and issuer promises to settle. A consumed
|
|
190
|
+
transaction or grant is never restored after cancellation.
|
|
191
|
+
|
|
192
|
+
The default `OidcFlow` store is process-local. `PersistentOidcFlowStore.create()`
|
|
193
|
+
selects two record families from the supplied `StorageFactory` and `StorageGroup`;
|
|
194
|
+
`flowId` qualifies state, grants, and indexed expiry queries. Preparation of
|
|
195
|
+
both families completes by default. `createMissingStructures: false` returns
|
|
196
|
+
non-preparing handles that do not probe for structures later. `OidcFlow.close()`
|
|
197
|
+
drains admitted work and closes only its default memory store. Close an injected
|
|
198
|
+
store and its factory separately. `purgeExpired(cutoff)` is explicit and uses a
|
|
199
|
+
flow-scoped exact expiry index in persistent storage. A concurrent row change
|
|
200
|
+
can leave eligible records for a later invocation. Cancellation or storage
|
|
201
|
+
failure rejects with partial progress possible. A known confirmed late insert
|
|
202
|
+
is conditionally removed after close; if another writer has replaced that
|
|
203
|
+
record, the replacement remains. An ambiguous thrown storage result cannot be
|
|
204
|
+
rolled back safely and may need later explicit maintenance.
|
|
205
|
+
|
|
206
|
+
`discoverOidcProvider()` uses the exact selected discovery URL, including an
|
|
207
|
+
application supplied path and query, and rejects a returned issuer mismatch.
|
|
208
|
+
The selected URL does not replace token or JWKS destinations. Authorization
|
|
209
|
+
URLs use S256 and replace reserved protocol parameters while retaining other
|
|
210
|
+
provider query values. Token exchange uses the configured client authentication
|
|
211
|
+
and exact callback URI; the provider returns an identity only after bounded
|
|
212
|
+
response parsing and JOSE ID-token verification.
|
|
213
|
+
|
|
92
214
|
## Subscription and native adapters
|
|
93
215
|
|
|
94
216
|
`SubscriptionGateway` and `InMemorySubscriptionBindings` compose subscription creation, activation, cancellation, and relaying at the gateway boundary. The Gateway accepts a logical `SubscriptionCoordinator`; native `SubscriptionCreator` instances remain a per-node implementation seam. This is an intentional replacement of the former public native-creator input, with no compatibility adapter because Spine TS has no deployed users. In-memory bindings are local to one process and have finite operation limits; they do not provide cross-machine propagation. `createNativeGatewayServices`, `NativeSubscriptionCreator`, and `SubscriptionUpdateRelay` adapt these public contracts to the native service layer. They do not make a deployment secure by themselves: applications choose how their listener accepts only gateway-routed traffic.
|
package/dist/index.d.ts
CHANGED
|
@@ -248,6 +248,10 @@ export interface ResolvedSession {
|
|
|
248
248
|
* Specifies when the resolved session expires.
|
|
249
249
|
*/
|
|
250
250
|
readonly expiresAt: Timestamp;
|
|
251
|
+
/**
|
|
252
|
+
* Ends this monitored operation on local logout, expiry, or strategy close.
|
|
253
|
+
*/
|
|
254
|
+
readonly invalidated?: AbortSignal;
|
|
251
255
|
}
|
|
252
256
|
/**
|
|
253
257
|
* Provider-neutral authentication boundary. Credentials do not reach policy request facts.
|
|
@@ -267,9 +271,10 @@ export interface SessionResolver {
|
|
|
267
271
|
/**
|
|
268
272
|
* Resolves a presented credential into a valid session.
|
|
269
273
|
* @param credential Supplies the credential to resolve.
|
|
274
|
+
* @param lifetime Optional operation signal; omission retains no monitor.
|
|
270
275
|
* @returns Returns the resolved session or `undefined` when it is invalid.
|
|
271
276
|
*/
|
|
272
|
-
resolve(credential: RequestCredential): Promise<ResolvedSession | undefined>;
|
|
277
|
+
resolve(credential: RequestCredential, lifetime?: AbortSignal): Promise<ResolvedSession | undefined>;
|
|
273
278
|
}
|
|
274
279
|
/**
|
|
275
280
|
* Authorization policy boundary evaluated separately for every incoming request.
|
|
@@ -466,6 +471,15 @@ export { IncomingRequests } from "./request/index.js";
|
|
|
466
471
|
export { UnaryGateway } from "./gateway/index.js";
|
|
467
472
|
export { OpaqueSessionCookies } from "./sessions/cookies.js";
|
|
468
473
|
export { OpaqueSessions } from "./sessions/opaque.js";
|
|
474
|
+
export { MemoryOpaqueSessionStore } from "./sessions/opaque-session-store.js";
|
|
475
|
+
export type { OpaqueSessionStore } from "./sessions/opaque-session-store.js";
|
|
476
|
+
export { PersistentOpaqueSessionStore } from "./sessions/persistent-opaque-session-store.js";
|
|
477
|
+
export type { PersistentOpaqueStoreOptions } from "./sessions/persistent-opaque-session-store.js";
|
|
478
|
+
export { PersistentOidcFlowStore } from "./oidc/persistent-flow-store.js";
|
|
479
|
+
export type { PersistentOidcFlowOptions } from "./oidc/persistent-flow-store.js";
|
|
480
|
+
export { PersistentTokenRevocations } from "./sessions/persistent-token-revocations.js";
|
|
481
|
+
export type { PersistentTokenRevocationsOptions } from "./sessions/persistent-token-revocations.js";
|
|
482
|
+
export type { OidcFlowStore } from "./oidc/flow-store.js";
|
|
469
483
|
export { SignedSessions } from "./sessions/signed.js";
|
|
470
484
|
export { OidcFlow } from "./oidc/index.js";
|
|
471
485
|
export { createGitHubProvider, createGoogleProvider, createOidcProvider, discoverOidcProvider, } from "./providers/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts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AAsB,EACtB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,2BAA2B,EAC3B,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,EACvB,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,6BAA6B,EAC7B,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,10 @@ const TransportFactsValues = Object.freeze({
|
|
|
51
51
|
export { UnaryGateway } from "./gateway/index.js";
|
|
52
52
|
export { OpaqueSessionCookies } from "./sessions/cookies.js";
|
|
53
53
|
export { OpaqueSessions } from "./sessions/opaque.js";
|
|
54
|
+
export { MemoryOpaqueSessionStore } from "./sessions/opaque-session-store.js";
|
|
55
|
+
export { PersistentOpaqueSessionStore } from "./sessions/persistent-opaque-session-store.js";
|
|
56
|
+
export { PersistentOidcFlowStore } from "./oidc/persistent-flow-store.js";
|
|
57
|
+
export { PersistentTokenRevocations } from "./sessions/persistent-token-revocations.js";
|
|
54
58
|
export { SignedSessions } from "./sessions/signed.js";
|
|
55
59
|
export { OidcFlow } from "./oidc/index.js";
|
|
56
60
|
export { createGitHubProvider, createGoogleProvider, createOidcProvider, discoverOidcProvider, } from "./providers/index.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAaH,OAAO,EAMN,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAaH,OAAO,EAMN,MAAM,kCAAkC,CAAC;AAmmB1C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgC,MAAM,CAAC,MAAM,CAAC;IACvE,kBAAkB;IAElB;;;;OAIG;IACH,IAAI,CAAC,KAA0B;QAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAChC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;aAChC,MAAM,CAAC,CAAC,KAAK,EAA6B,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;aACpE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC,CACvD,CAAC;QACF,OAAO,oBAAoB,CAAC,OAAO,CAAC;YAClC,OAAO,EAAE,KAAK,CAAC,OAA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mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAoF3B,OAAO,EACL,qBAAqB,GAGtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC"}
|
package/dist/oidc/contracts.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AuthenticatedPrincipal, RequestCredential, ResolvedSession } from "../index.js";
|
|
2
|
+
import type { OidcFlowStore } from "./flow-store.js";
|
|
2
3
|
/**
|
|
3
4
|
* Clock used to evaluate finite OIDC transactions.
|
|
4
5
|
*/
|
|
@@ -46,7 +47,7 @@ export interface ResolvedApplicationIdentity {
|
|
|
46
47
|
readonly principal: AuthenticatedPrincipal;
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
49
|
-
* Application-
|
|
50
|
+
* Application-supplied mapping from a verified external identity to a principal.
|
|
50
51
|
*/
|
|
51
52
|
export interface IdentityMapping {
|
|
52
53
|
/**
|
|
@@ -120,9 +121,16 @@ export interface ApplicationSessionIssue {
|
|
|
120
121
|
export interface ApplicationSessionIssuer {
|
|
121
122
|
/**
|
|
122
123
|
* Creates an application session for a mapped principal.
|
|
124
|
+
*
|
|
125
|
+
* Await durable issuance and any conditional cancellation compensation.
|
|
126
|
+
* Return `undefined` only for ordinary declined issuance. A distinct failure
|
|
127
|
+
* rejects; rejection with the exact supplied reason after abort is ordinary
|
|
128
|
+
* cancellation. The flow waits for this promise even after a caller-facing
|
|
129
|
+
* timeout or abort and reports late distinct failures at close.
|
|
130
|
+
*
|
|
123
131
|
* @param principal The mapped principal.
|
|
124
132
|
* @param signal The operation cancellation signal.
|
|
125
|
-
* @returns The issued session, or undefined
|
|
133
|
+
* @returns The issued session, or undefined for an ordinary decline.
|
|
126
134
|
*/
|
|
127
135
|
issue(principal: AuthenticatedPrincipal, signal: AbortSignal): Promise<ApplicationSessionIssue | undefined>;
|
|
128
136
|
}
|
|
@@ -162,6 +170,10 @@ export interface OidcFlowOptions {
|
|
|
162
170
|
* Issues application sessions.
|
|
163
171
|
*/
|
|
164
172
|
readonly sessionIssuer: ApplicationSessionIssuer;
|
|
173
|
+
/**
|
|
174
|
+
* Atomic flow state; omission selects process-local memory.
|
|
175
|
+
*/
|
|
176
|
+
readonly store?: OidcFlowStore;
|
|
165
177
|
/**
|
|
166
178
|
* Provides the optional flow clock.
|
|
167
179
|
*/
|
|
@@ -179,11 +191,13 @@ export interface OidcFlowOptions {
|
|
|
179
191
|
*/
|
|
180
192
|
readonly grantTtlMilliseconds?: number;
|
|
181
193
|
/**
|
|
182
|
-
* Limits
|
|
194
|
+
* Limits transactions in the default memory store.
|
|
195
|
+
* Supplying this option with an injected store is rejected.
|
|
183
196
|
*/
|
|
184
197
|
readonly maxTransactions?: number;
|
|
185
198
|
/**
|
|
186
|
-
* Limits
|
|
199
|
+
* Limits grants in the default memory store.
|
|
200
|
+
* Supplying this option with an injected store is rejected.
|
|
187
201
|
*/
|
|
188
202
|
readonly maxGrants?: number;
|
|
189
203
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/oidc/contracts.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/oidc/contracts.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,aAAa;IAG5B;;;OAGG;IACH,GAAG,IAAI,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MA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obuf/wkt";
|
|
2
|
+
import { type OidcLoginGrant, type OidcLoginTransaction } from "@spine-event-engine/proto/auth";
|
|
3
|
+
/**
|
|
4
|
+
* Atomic one-use transitions for one application-selected OIDC login flow.
|
|
5
|
+
*/
|
|
6
|
+
export interface OidcFlowStore {
|
|
7
|
+
/**
|
|
8
|
+
* Flow identity used to qualify state and grant digests.
|
|
9
|
+
*/
|
|
10
|
+
readonly flowId: string;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a transaction only if its qualified digest is absent.
|
|
13
|
+
*
|
|
14
|
+
* @param record Complete transaction with this flow identity.
|
|
15
|
+
* @param signal Optional cancellation.
|
|
16
|
+
* @returns True for confirmed insertion, false for confirmed no mutation.
|
|
17
|
+
*/
|
|
18
|
+
insertTransaction(record: OidcLoginTransaction, signal?: AbortSignal): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Reads a transaction by its qualified digest.
|
|
21
|
+
*
|
|
22
|
+
* @param digest Flow-qualified lookup digest.
|
|
23
|
+
* @param signal Optional cancellation.
|
|
24
|
+
* @returns Complete current transaction, if present for this flow.
|
|
25
|
+
*/
|
|
26
|
+
readTransaction(digest: string, signal?: AbortSignal): Promise<OidcLoginTransaction | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Deletes only the complete expected transaction before external exchange.
|
|
29
|
+
*
|
|
30
|
+
* @param expected Validated transaction snapshot.
|
|
31
|
+
* @param signal Optional cancellation.
|
|
32
|
+
* @returns True for one winning consumption, false for no mutation.
|
|
33
|
+
*/
|
|
34
|
+
consumeTransaction(expected: OidcLoginTransaction, signal?: AbortSignal): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a one-use application grant only if its digest is absent.
|
|
37
|
+
*
|
|
38
|
+
* @param record Complete grant with this flow identity.
|
|
39
|
+
* @param signal Optional cancellation.
|
|
40
|
+
* @returns True for confirmed insertion, false for confirmed no mutation.
|
|
41
|
+
*/
|
|
42
|
+
insertGrant(record: OidcLoginGrant, signal?: AbortSignal): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Reads a grant by its qualified digest.
|
|
45
|
+
*
|
|
46
|
+
* @param digest Flow-qualified lookup digest.
|
|
47
|
+
* @param signal Optional cancellation.
|
|
48
|
+
* @returns Complete current grant, if present for this flow.
|
|
49
|
+
*/
|
|
50
|
+
readGrant(digest: string, signal?: AbortSignal): Promise<OidcLoginGrant | undefined>;
|
|
51
|
+
/**
|
|
52
|
+
* Deletes only the complete expected grant before session issuance.
|
|
53
|
+
*
|
|
54
|
+
* @param expected Validated grant snapshot.
|
|
55
|
+
* @param signal Optional cancellation.
|
|
56
|
+
* @returns True for one winning consumption, false for no mutation.
|
|
57
|
+
*/
|
|
58
|
+
consumeGrant(expected: OidcLoginGrant, signal?: AbortSignal): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Removes expired records using the selected store's maintenance policy.
|
|
61
|
+
*
|
|
62
|
+
* @param cutoff Trusted current-or-earlier deadline.
|
|
63
|
+
* @param signal Optional cancellation.
|
|
64
|
+
* @returns Confirmed transaction and grant removals in this pass.
|
|
65
|
+
*/
|
|
66
|
+
purgeExpired(cutoff: Timestamp, signal?: AbortSignal): Promise<{
|
|
67
|
+
transactions: number;
|
|
68
|
+
grants: number;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Closes new work and drains admitted work; an injected factory remains open.
|
|
72
|
+
*
|
|
73
|
+
* @returns Completion after the store releases its acquired resources.
|
|
74
|
+
*/
|
|
75
|
+
close(): Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Process-local atomic transitions for one component login flow.
|
|
79
|
+
*/
|
|
80
|
+
export declare class MemoryOidcFlowStore implements OidcFlowStore {
|
|
81
|
+
#private;
|
|
82
|
+
/**
|
|
83
|
+
* Flow identity used in this process-local record family.
|
|
84
|
+
*/
|
|
85
|
+
readonly flowId: string;
|
|
86
|
+
/**
|
|
87
|
+
* Binds a flow identity, trusted clock and process-local capacity policy.
|
|
88
|
+
*
|
|
89
|
+
* @param flowId Identity qualifying all state and grant digests.
|
|
90
|
+
* @param clock Latest allowed maintenance cutoff.
|
|
91
|
+
* @param maxTransactions Existing memory transaction bound.
|
|
92
|
+
* @param maxGrants Existing memory grant bound.
|
|
93
|
+
*/
|
|
94
|
+
constructor(flowId: string, clock: () => Timestamp, maxTransactions: number, maxGrants: number);
|
|
95
|
+
/**
|
|
96
|
+
* Checks current process-local transaction capacity.
|
|
97
|
+
*
|
|
98
|
+
* @returns Whether another transaction needs explicit maintenance.
|
|
99
|
+
*/
|
|
100
|
+
transactionsFull(): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Checks current process-local grant capacity.
|
|
103
|
+
*
|
|
104
|
+
* @returns Whether another grant needs explicit maintenance.
|
|
105
|
+
*/
|
|
106
|
+
grantsFull(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* @inheritdoc
|
|
109
|
+
*/
|
|
110
|
+
insertTransaction(record: OidcLoginTransaction, signal?: AbortSignal): Promise<boolean>;
|
|
111
|
+
/**
|
|
112
|
+
* @inheritdoc
|
|
113
|
+
*/
|
|
114
|
+
readTransaction(digest: string, signal?: AbortSignal): Promise<OidcLoginTransaction | undefined>;
|
|
115
|
+
/**
|
|
116
|
+
* @inheritdoc
|
|
117
|
+
*/
|
|
118
|
+
consumeTransaction(expected: OidcLoginTransaction, signal?: AbortSignal): Promise<boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* @inheritdoc
|
|
121
|
+
*/
|
|
122
|
+
insertGrant(record: OidcLoginGrant, signal?: AbortSignal): Promise<boolean>;
|
|
123
|
+
/**
|
|
124
|
+
* @inheritdoc
|
|
125
|
+
*/
|
|
126
|
+
readGrant(digest: string, signal?: AbortSignal): Promise<OidcLoginGrant | undefined>;
|
|
127
|
+
/**
|
|
128
|
+
* @inheritdoc
|
|
129
|
+
*/
|
|
130
|
+
consumeGrant(expected: OidcLoginGrant, signal?: AbortSignal): Promise<boolean>;
|
|
131
|
+
/**
|
|
132
|
+
* @inheritdoc
|
|
133
|
+
*/
|
|
134
|
+
purgeExpired(cutoff: Timestamp, signal?: AbortSignal): Promise<{
|
|
135
|
+
transactions: number;
|
|
136
|
+
grants: number;
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* @inheritdoc
|
|
140
|
+
*/
|
|
141
|
+
close(): Promise<void>;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=flow-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-store.d.ts","sourceRoot":"","sources":["../../src/oidc/flow-store.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AAKxC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,iBAAiB,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAExF;;;;;;OAMG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAC;IAEjG;;;;;;OAMG;IACH,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3F;;;;;;OAMG;IACH,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5E;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cA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