@spine-event-engine/auth 2.0.0-snapshot.26 → 2.0.0-snapshot.28
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
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
+
* the License.
|
|
13
|
+
*/
|
|
14
|
+
import { clone, equals } from "@bufbuild/protobuf";
|
|
15
|
+
import { OidcLoginGrantSchema, OidcLoginTransactionSchema, } from "@spine-event-engine/proto/auth";
|
|
16
|
+
import { OidcFlowKeys } from "./records.js";
|
|
17
|
+
import { SessionRecords } from "../sessions/session-record.js";
|
|
18
|
+
/**
|
|
19
|
+
* Process-local atomic transitions for one component login flow.
|
|
20
|
+
*/
|
|
21
|
+
export class MemoryOidcFlowStore {
|
|
22
|
+
/**
|
|
23
|
+
* Flow identity used in this process-local record family.
|
|
24
|
+
*/
|
|
25
|
+
flowId;
|
|
26
|
+
#transactions = new Map();
|
|
27
|
+
#grants = new Map();
|
|
28
|
+
#clock;
|
|
29
|
+
#maxTransactions;
|
|
30
|
+
#maxGrants;
|
|
31
|
+
#closed = false;
|
|
32
|
+
/**
|
|
33
|
+
* Binds a flow identity, trusted clock and process-local capacity policy.
|
|
34
|
+
*
|
|
35
|
+
* @param flowId Identity qualifying all state and grant digests.
|
|
36
|
+
* @param clock Latest allowed maintenance cutoff.
|
|
37
|
+
* @param maxTransactions Existing memory transaction bound.
|
|
38
|
+
* @param maxGrants Existing memory grant bound.
|
|
39
|
+
*/
|
|
40
|
+
constructor(flowId, clock, maxTransactions, maxGrants) {
|
|
41
|
+
if (!flowId ||
|
|
42
|
+
!Number.isSafeInteger(maxTransactions) ||
|
|
43
|
+
maxTransactions <= 0 ||
|
|
44
|
+
!Number.isSafeInteger(maxGrants) ||
|
|
45
|
+
maxGrants <= 0)
|
|
46
|
+
throw new TypeError("Invalid process-local OIDC flow configuration.");
|
|
47
|
+
this.flowId = flowId;
|
|
48
|
+
this.#clock = clock;
|
|
49
|
+
this.#maxTransactions = maxTransactions;
|
|
50
|
+
this.#maxGrants = maxGrants;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Checks current process-local transaction capacity.
|
|
54
|
+
*
|
|
55
|
+
* @returns Whether another transaction needs explicit maintenance.
|
|
56
|
+
*/
|
|
57
|
+
transactionsFull() {
|
|
58
|
+
return this.#transactions.size >= this.#maxTransactions;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Checks current process-local grant capacity.
|
|
62
|
+
*
|
|
63
|
+
* @returns Whether another grant needs explicit maintenance.
|
|
64
|
+
*/
|
|
65
|
+
grantsFull() {
|
|
66
|
+
return this.#grants.size >= this.#maxGrants;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @inheritdoc
|
|
70
|
+
*/
|
|
71
|
+
insertTransaction(record, signal) {
|
|
72
|
+
this.#check(record, signal);
|
|
73
|
+
if (this.transactionsFull() || this.#transactions.has(record.lookupDigest))
|
|
74
|
+
return Promise.resolve(false);
|
|
75
|
+
this.#transactions.set(record.lookupDigest, clone(OidcLoginTransactionSchema, record));
|
|
76
|
+
return Promise.resolve(true);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @inheritdoc
|
|
80
|
+
*/
|
|
81
|
+
readTransaction(digest, signal) {
|
|
82
|
+
this.#check(undefined, signal);
|
|
83
|
+
const record = this.#transactions.get(digest);
|
|
84
|
+
return Promise.resolve(record === undefined ? undefined : clone(OidcLoginTransactionSchema, record));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @inheritdoc
|
|
88
|
+
*/
|
|
89
|
+
consumeTransaction(expected, signal) {
|
|
90
|
+
this.#check(expected, signal);
|
|
91
|
+
const current = this.#transactions.get(expected.lookupDigest);
|
|
92
|
+
if (current === undefined || !equals(OidcLoginTransactionSchema, current, expected))
|
|
93
|
+
return Promise.resolve(false);
|
|
94
|
+
this.#transactions.delete(expected.lookupDigest);
|
|
95
|
+
return Promise.resolve(true);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @inheritdoc
|
|
99
|
+
*/
|
|
100
|
+
insertGrant(record, signal) {
|
|
101
|
+
this.#check(record, signal);
|
|
102
|
+
if (this.grantsFull() || this.#grants.has(record.lookupDigest))
|
|
103
|
+
return Promise.resolve(false);
|
|
104
|
+
this.#grants.set(record.lookupDigest, clone(OidcLoginGrantSchema, record));
|
|
105
|
+
return Promise.resolve(true);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @inheritdoc
|
|
109
|
+
*/
|
|
110
|
+
readGrant(digest, signal) {
|
|
111
|
+
this.#check(undefined, signal);
|
|
112
|
+
const record = this.#grants.get(digest);
|
|
113
|
+
return Promise.resolve(record === undefined ? undefined : clone(OidcLoginGrantSchema, record));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @inheritdoc
|
|
117
|
+
*/
|
|
118
|
+
consumeGrant(expected, signal) {
|
|
119
|
+
this.#check(expected, signal);
|
|
120
|
+
const current = this.#grants.get(expected.lookupDigest);
|
|
121
|
+
if (current === undefined || !equals(OidcLoginGrantSchema, current, expected))
|
|
122
|
+
return Promise.resolve(false);
|
|
123
|
+
this.#grants.delete(expected.lookupDigest);
|
|
124
|
+
return Promise.resolve(true);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @inheritdoc
|
|
128
|
+
*/
|
|
129
|
+
purgeExpired(cutoff, signal) {
|
|
130
|
+
this.#check(undefined, signal);
|
|
131
|
+
const valid = SessionRecords.deadline(cutoff);
|
|
132
|
+
if (SessionRecords.compare(valid, SessionRecords.deadline(this.#clock())) > 0)
|
|
133
|
+
throw new RangeError("Purge cutoff cannot be later than the trusted clock.");
|
|
134
|
+
const transactions = this.#purge(this.#transactions, valid, signal);
|
|
135
|
+
const grants = this.#purge(this.#grants, valid, signal);
|
|
136
|
+
return Promise.resolve({ transactions, grants });
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @inheritdoc
|
|
140
|
+
*/
|
|
141
|
+
close() {
|
|
142
|
+
this.#closed = true;
|
|
143
|
+
this.#transactions.clear();
|
|
144
|
+
this.#grants.clear();
|
|
145
|
+
return Promise.resolve();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Checks lifecycle, cancellation and flow binding.
|
|
149
|
+
*
|
|
150
|
+
* @param record Optional record being mutated.
|
|
151
|
+
* @param signal Optional cancellation.
|
|
152
|
+
*/
|
|
153
|
+
#check(record, signal) {
|
|
154
|
+
if (this.#closed)
|
|
155
|
+
throw new Error("OIDC flow store is closed.");
|
|
156
|
+
signal?.throwIfAborted();
|
|
157
|
+
if (record !== undefined) {
|
|
158
|
+
if (record.flowId !== this.flowId)
|
|
159
|
+
throw new TypeError("OIDC flow identity differs.");
|
|
160
|
+
OidcFlowKeys.expiry(record);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Removes expired records from one local family.
|
|
165
|
+
*
|
|
166
|
+
* @typeParam R Transaction or grant record.
|
|
167
|
+
* @param records Selected local family.
|
|
168
|
+
* @param cutoff Trusted maximum deadline.
|
|
169
|
+
* @param signal Optional cancellation.
|
|
170
|
+
* @returns Number removed in this invocation.
|
|
171
|
+
*/
|
|
172
|
+
#purge(records, cutoff, signal) {
|
|
173
|
+
let removed = 0;
|
|
174
|
+
for (const [key, record] of records) {
|
|
175
|
+
signal?.throwIfAborted();
|
|
176
|
+
if (SessionRecords.compare(OidcFlowKeys.expiry(record), cutoff) <= 0) {
|
|
177
|
+
records.delete(key);
|
|
178
|
+
removed += 1;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return removed;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=flow-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-store.js","sourceRoot":"","sources":["../../src/oidc/flow-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAG3B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAA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QAChB,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACpC,MAAM,EAAE,cAAc,EAAE,CAAC;YACzB,IAAI,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACpB,OAAO,IAAI,CAAC,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
package/dist/oidc/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { type Timestamp } from "@bufbuild/protobuf/wkt";
|
|
1
2
|
import type { OidcFlowCallbackInput, OidcFlowCallbackResult, OidcFlowExchangeInput, OidcFlowExchangeResult, OidcFlowOptions, OidcFlowStartInput, OidcFlowStartResult } from "./contracts.js";
|
|
2
3
|
export type * from "./contracts.js";
|
|
3
4
|
/**
|
|
4
5
|
* Bounded, framework-neutral authorization-code transaction manager.
|
|
5
6
|
*
|
|
6
|
-
* It
|
|
7
|
+
* It manages finite start, callback, and one-time application-session exchange
|
|
7
8
|
* transitions; HTTP endpoints and provider discovery remain application work.
|
|
8
9
|
*/
|
|
9
10
|
export declare class OidcFlow {
|
|
@@ -15,27 +16,46 @@ export declare class OidcFlow {
|
|
|
15
16
|
constructor(options: OidcFlowOptions);
|
|
16
17
|
/**
|
|
17
18
|
* Starts one finite authorization-code transaction without exposing any application credential.
|
|
18
|
-
* @param input The browser
|
|
19
|
+
* @param input The browser challenge and post-login redirect.
|
|
20
|
+
* @param signal Optional host request cancellation; ordinary abort rejects with its reason.
|
|
19
21
|
* @returns The authorization URL and state, or a rejection.
|
|
20
22
|
*/
|
|
21
|
-
start(input: OidcFlowStartInput): OidcFlowStartResult
|
|
23
|
+
start(input: OidcFlowStartInput, signal?: AbortSignal): Promise<OidcFlowStartResult>;
|
|
22
24
|
/**
|
|
23
25
|
* Processes a callback state before provider verification or mapping.
|
|
24
26
|
* A rejected callback never restores its transaction.
|
|
25
27
|
* @param input The callback state and provider response.
|
|
28
|
+
* @param signal Optional host request cancellation; a consumed state remains consumed.
|
|
26
29
|
* @returns The callback result, including a one-time grant when accepted.
|
|
27
30
|
*/
|
|
28
|
-
callback(input: OidcFlowCallbackInput): Promise<OidcFlowCallbackResult>;
|
|
31
|
+
callback(input: OidcFlowCallbackInput, signal?: AbortSignal): Promise<OidcFlowCallbackResult>;
|
|
29
32
|
/**
|
|
30
|
-
*
|
|
31
|
-
* All failures deliberately have the same result to avoid grant
|
|
33
|
+
* Validates and consumes a grant before issuing an application session.
|
|
34
|
+
* All failures deliberately have the same result to avoid grant enumeration.
|
|
32
35
|
* @param input The grant and browser PKCE proof.
|
|
36
|
+
* @param signal Optional host request cancellation; a consumed grant remains consumed.
|
|
33
37
|
* @returns The issued application session or an enumeration-safe rejection.
|
|
34
38
|
*/
|
|
35
|
-
exchange(input: OidcFlowExchangeInput): Promise<OidcFlowExchangeResult>;
|
|
39
|
+
exchange(input: OidcFlowExchangeInput, signal?: AbortSignal): Promise<OidcFlowExchangeResult>;
|
|
36
40
|
/**
|
|
37
|
-
* Closes the flow and
|
|
41
|
+
* Closes the flow after admitted work and original collaborator promises settle.
|
|
42
|
+
*
|
|
43
|
+
* An injected store and factory remain open. A late distinct issuer failure
|
|
44
|
+
* rejects this close operation; repeated calls retain that result.
|
|
45
|
+
*
|
|
46
|
+
* @returns Completion after raw work drains and local memory closes.
|
|
38
47
|
*/
|
|
39
|
-
close(): void
|
|
48
|
+
close(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Removes eligible records through the selected flow store.
|
|
51
|
+
*
|
|
52
|
+
* @param cutoff Trusted current-or-earlier exact deadline.
|
|
53
|
+
* @param signal Optional cancellation.
|
|
54
|
+
* @returns Confirmed transaction and grant removals in this pass.
|
|
55
|
+
*/
|
|
56
|
+
purgeExpired(cutoff: Timestamp, signal?: AbortSignal): Promise<{
|
|
57
|
+
transactions: number;
|
|
58
|
+
grants: number;
|
|
59
|
+
}>;
|
|
40
60
|
}
|
|
41
61
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/oidc/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/oidc/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/oidc/index.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAazE,OAAO,KAAK,EAKV,qBAAqB,EACrB,sBAAsB,EAEtB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EAEf,kBAAkB,EAClB,mBAAmB,EAGpB,MAAM,gBAAgB,CAAC;AAExB,mBAAmB,gBAAgB,CAAC;AAapC;;;;;GAKG;AACH,qBAAa,QAAQ;;IAuDnB;;;OAGG;gBACS,OAAO,EAAE,eAAe;IAkDpC;;;;;OAKG;IACG,KAAK,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA0I1F;;;;;;OAMG;IACG,QAAQ,CACZ,KAAK,EAAE,qBAAqB,EAC5B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC;IA4QlC;;;;;;OAMG;IACG,QAAQ,CACZ,KAAK,EAAE,qBAAqB,EAC5B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC;IA0FlC;;;;;;;OAOG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAatB;;;;;;OAMG;IACH,YAAY,CACV,MAAM,EAAE,SAAS,EACjB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CA2TrD"}
|