@forgezero/access 0.1.4 → 0.1.5
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 +314 -70
- package/dist/conditions.js +1 -1
- package/dist/effects.js +1 -1
- package/dist/elysia.js +1 -1
- package/dist/fetch.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/pipeline.js +1 -1
- package/dist/principal-session.js +1 -1
- package/dist/principal.js +1 -1
- package/dist/testing.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,18 +62,62 @@ bun add @forgezero/access
|
|
|
62
62
|
<a id="forgezero-access"></a>
|
|
63
63
|
## @forgezero/access
|
|
64
64
|
|
|
65
|
-
Declare routes, factors and policies as orthogonal lists; authorise against them.
|
|
65
|
+
Declare routes, factors and policies as orthogonal lists; authorise against them. This entry exposes 21 named value exports and 27 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
66
66
|
|
|
67
67
|
```text
|
|
68
|
-
import {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
import {
|
|
69
|
+
AccessError,
|
|
70
|
+
Refusal,
|
|
71
|
+
SCHEMA_VERSION,
|
|
72
|
+
Settled,
|
|
73
|
+
VERSION,
|
|
74
|
+
action,
|
|
75
|
+
assertReadable,
|
|
76
|
+
authorise,
|
|
77
|
+
codePolicy,
|
|
78
|
+
defineAccessControl,
|
|
79
|
+
defineFactors,
|
|
80
|
+
defineRoutes,
|
|
81
|
+
externalPolicy,
|
|
82
|
+
fulfilledActionFactors,
|
|
83
|
+
grantsRoute,
|
|
84
|
+
impactOfDisabling,
|
|
85
|
+
isRefusal,
|
|
86
|
+
isSettled,
|
|
87
|
+
page,
|
|
88
|
+
resolveActionFactors,
|
|
89
|
+
stemOf,
|
|
90
|
+
} from '@forgezero/access';
|
|
91
|
+
|
|
92
|
+
import type {
|
|
93
|
+
AccessControl,
|
|
94
|
+
AccessControlConfig,
|
|
95
|
+
ActionPolicy,
|
|
96
|
+
ActionRoute,
|
|
97
|
+
AfterHandler,
|
|
98
|
+
BeforeHandler,
|
|
99
|
+
Binding,
|
|
100
|
+
FactorContext,
|
|
101
|
+
FactorKind,
|
|
102
|
+
FactorRegistry,
|
|
103
|
+
FactorSpec,
|
|
104
|
+
GrantOptions,
|
|
105
|
+
Method,
|
|
106
|
+
Outcome,
|
|
107
|
+
PageRoute,
|
|
108
|
+
PolicySource,
|
|
109
|
+
Problem,
|
|
110
|
+
RatePolicy,
|
|
111
|
+
RequestContext,
|
|
112
|
+
Role,
|
|
113
|
+
RouteBase,
|
|
114
|
+
RouteContract,
|
|
115
|
+
RouteRegistry,
|
|
116
|
+
RouteSpec,
|
|
117
|
+
SessionContext,
|
|
118
|
+
SessionPolicy,
|
|
119
|
+
Versioned,
|
|
120
|
+
} from '@forgezero/access';
|
|
77
121
|
```
|
|
78
122
|
|
|
79
123
|
## @forgezero/access — Declare routes before handlers
|
|
@@ -81,7 +125,11 @@ import type { SessionContext, SessionPolicy, Versioned } from '@forgezero/access
|
|
|
81
125
|
Routes and their access policy are data; Fetch and Elysia adapters enforce the same declaration.
|
|
82
126
|
|
|
83
127
|
```text
|
|
84
|
-
import {
|
|
128
|
+
import {
|
|
129
|
+
defineRoutes,
|
|
130
|
+
action,
|
|
131
|
+
page,
|
|
132
|
+
} from '@forgezero/access';
|
|
85
133
|
|
|
86
134
|
export const routes = defineRoutes({
|
|
87
135
|
orders: page('Orders'),
|
|
@@ -92,153 +140,333 @@ export const routes = defineRoutes({
|
|
|
92
140
|
<a id="forgezero-access-conditions"></a>
|
|
93
141
|
## @forgezero/access/conditions
|
|
94
142
|
|
|
95
|
-
The twelve guards every project writes into `before`, each with the status its refusal deserves.
|
|
143
|
+
The twelve guards every project writes into `before`, each with the status its refusal deserves. This entry exposes 14 named value exports and 16 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
96
144
|
|
|
97
145
|
```text
|
|
98
|
-
import {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
146
|
+
import {
|
|
147
|
+
assertDeclaredRefusals,
|
|
148
|
+
loadTarget,
|
|
149
|
+
refusalsFor,
|
|
150
|
+
requireApproval,
|
|
151
|
+
requireBalance,
|
|
152
|
+
requireIdempotency,
|
|
153
|
+
requireNotFrozen,
|
|
154
|
+
requireOwner,
|
|
155
|
+
requireQuota,
|
|
156
|
+
requireService,
|
|
157
|
+
requireState,
|
|
158
|
+
requireTier,
|
|
159
|
+
requireUnlocked,
|
|
160
|
+
requireVersion,
|
|
161
|
+
} from '@forgezero/access/conditions';
|
|
162
|
+
|
|
163
|
+
import type {
|
|
164
|
+
ApprovalState,
|
|
165
|
+
Condition,
|
|
166
|
+
IdempotencyStore,
|
|
167
|
+
LoadTargetOptions,
|
|
168
|
+
RefusalSpec,
|
|
169
|
+
RequireApprovalOptions,
|
|
170
|
+
RequireBalanceOptions,
|
|
171
|
+
RequireIdempotencyOptions,
|
|
172
|
+
RequireNotFrozenOptions,
|
|
173
|
+
RequireOwnerOptions,
|
|
174
|
+
RequireQuotaOptions,
|
|
175
|
+
RequireServiceOptions,
|
|
176
|
+
RequireStateOptions,
|
|
177
|
+
RequireTierOptions,
|
|
178
|
+
RequireUnlockedOptions,
|
|
179
|
+
RequireVersionOptions,
|
|
180
|
+
} from '@forgezero/access/conditions';
|
|
104
181
|
```
|
|
105
182
|
|
|
106
183
|
<a id="forgezero-access-effects"></a>
|
|
107
184
|
## @forgezero/access/effects
|
|
108
185
|
|
|
109
|
-
Audit, emit, meter, invalidate and notify — what happens after a request is decided, never failing it.
|
|
186
|
+
Audit, emit, meter, invalidate and notify — what happens after a request is decided, never failing it. This entry exposes 6 named value exports and 15 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
110
187
|
|
|
111
188
|
```text
|
|
112
|
-
import {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
189
|
+
import {
|
|
190
|
+
audit,
|
|
191
|
+
emit,
|
|
192
|
+
invalidate,
|
|
193
|
+
meter,
|
|
194
|
+
notify,
|
|
195
|
+
settlementOf,
|
|
196
|
+
} from '@forgezero/access/effects';
|
|
197
|
+
|
|
198
|
+
import type {
|
|
199
|
+
AuditOptions,
|
|
200
|
+
AuditRecord,
|
|
201
|
+
AuditSink,
|
|
202
|
+
CacheInvalidator,
|
|
203
|
+
Effect,
|
|
204
|
+
EmitOptions,
|
|
205
|
+
InvalidateOptions,
|
|
206
|
+
MeterOptions,
|
|
207
|
+
Notification,
|
|
208
|
+
Notifier,
|
|
209
|
+
NotifyOptions,
|
|
210
|
+
Outbox,
|
|
211
|
+
OutboxEvent,
|
|
212
|
+
Settlement,
|
|
213
|
+
UsageMeter,
|
|
214
|
+
} from '@forgezero/access/effects';
|
|
116
215
|
```
|
|
117
216
|
|
|
118
217
|
<a id="forgezero-access-security"></a>
|
|
119
218
|
## @forgezero/access/security
|
|
120
219
|
|
|
121
|
-
Constant-time comparison, CSPRNG tokens, HMAC, HKDF, AES-GCM sealing and redaction. Web Crypto only.
|
|
220
|
+
Constant-time comparison, CSPRNG tokens, HMAC, HKDF, AES-GCM sealing and redaction. Web Crypto only. This entry exposes 20 named value exports and 1 named type export. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
122
221
|
|
|
123
222
|
```text
|
|
124
|
-
import {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
223
|
+
import {
|
|
224
|
+
fromBase64Url,
|
|
225
|
+
fromHex,
|
|
226
|
+
hashToken,
|
|
227
|
+
hkdf,
|
|
228
|
+
hmacSha256,
|
|
229
|
+
isLive,
|
|
230
|
+
nowSeconds,
|
|
231
|
+
open,
|
|
232
|
+
randomDigits,
|
|
233
|
+
randomHex,
|
|
234
|
+
randomInt,
|
|
235
|
+
randomToken,
|
|
236
|
+
redact,
|
|
237
|
+
seal,
|
|
238
|
+
secretFieldPattern,
|
|
239
|
+
sha256,
|
|
240
|
+
timingSafeEqual,
|
|
241
|
+
toBase64Url,
|
|
242
|
+
toHex,
|
|
243
|
+
verifyHmac,
|
|
244
|
+
} from '@forgezero/access/security';
|
|
245
|
+
|
|
246
|
+
import type {
|
|
247
|
+
Sealed,
|
|
248
|
+
} from '@forgezero/access/security';
|
|
129
249
|
```
|
|
130
250
|
|
|
131
251
|
<a id="forgezero-access-rate-limit"></a>
|
|
132
252
|
## @forgezero/access/rate-limit
|
|
133
253
|
|
|
134
|
-
Request counters over a window — in memory, in Redis, or in a Durable Object.
|
|
254
|
+
Request counters over a window — in memory, in Redis, or in a Durable Object. This entry exposes 4 named value exports and 2 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
135
255
|
|
|
136
256
|
```text
|
|
137
|
-
import {
|
|
138
|
-
|
|
257
|
+
import {
|
|
258
|
+
durableObjectStore,
|
|
259
|
+
memoryStore,
|
|
260
|
+
redisStore,
|
|
261
|
+
slidingWindowStore,
|
|
262
|
+
} from '@forgezero/access/rate-limit';
|
|
263
|
+
|
|
264
|
+
import type {
|
|
265
|
+
DurableStorageLike,
|
|
266
|
+
RedisLike,
|
|
267
|
+
} from '@forgezero/access/rate-limit';
|
|
139
268
|
```
|
|
140
269
|
|
|
141
270
|
<a id="forgezero-access-fetch"></a>
|
|
142
271
|
## @forgezero/access/fetch
|
|
143
272
|
|
|
144
|
-
A Fetch-native adapter over the declared access pipeline.
|
|
273
|
+
A Fetch-native adapter over the declared access pipeline. This entry exposes 3 named value exports and 1 named type export. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
145
274
|
|
|
146
275
|
```text
|
|
147
|
-
import {
|
|
148
|
-
|
|
276
|
+
import {
|
|
277
|
+
compileRoute,
|
|
278
|
+
matchRoute,
|
|
279
|
+
toFetch,
|
|
280
|
+
} from '@forgezero/access/fetch';
|
|
281
|
+
|
|
282
|
+
import type {
|
|
283
|
+
FetchHandler,
|
|
284
|
+
} from '@forgezero/access/fetch';
|
|
149
285
|
```
|
|
150
286
|
|
|
151
287
|
<a id="forgezero-access-pipeline"></a>
|
|
152
288
|
## @forgezero/access/pipeline
|
|
153
289
|
|
|
154
|
-
The framework-neutral route, principal, factor, policy, rate-limit and effects pipeline.
|
|
290
|
+
The framework-neutral route, principal, factor, policy, rate-limit and effects pipeline. This entry exposes 3 named value exports and 9 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
155
291
|
|
|
156
292
|
```text
|
|
157
|
-
import {
|
|
158
|
-
|
|
159
|
-
|
|
293
|
+
import {
|
|
294
|
+
createPipeline,
|
|
295
|
+
defineHandlers,
|
|
296
|
+
windowSeconds,
|
|
297
|
+
} from '@forgezero/access/pipeline';
|
|
298
|
+
|
|
299
|
+
import type {
|
|
300
|
+
Handler,
|
|
301
|
+
HandlerRegistry,
|
|
302
|
+
Pipeline,
|
|
303
|
+
PipelineOptions,
|
|
304
|
+
RateStore,
|
|
305
|
+
SessionResolver,
|
|
306
|
+
StepUpStore,
|
|
307
|
+
Telemetry,
|
|
308
|
+
Validator,
|
|
309
|
+
} from '@forgezero/access/pipeline';
|
|
160
310
|
```
|
|
161
311
|
|
|
162
312
|
<a id="forgezero-access-elysia"></a>
|
|
163
313
|
## @forgezero/access/elysia
|
|
164
314
|
|
|
165
|
-
Elysia integration over the same access pipeline and route declarations.
|
|
315
|
+
Elysia integration over the same access pipeline and route declarations. This entry exposes 4 named value exports and 2 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
166
316
|
|
|
167
317
|
```text
|
|
168
|
-
import {
|
|
169
|
-
|
|
318
|
+
import {
|
|
319
|
+
elysia,
|
|
320
|
+
forbiddenTelemetryAttribute,
|
|
321
|
+
telemetryFrom,
|
|
322
|
+
toElysiaPath,
|
|
323
|
+
} from '@forgezero/access/elysia';
|
|
324
|
+
|
|
325
|
+
import type {
|
|
326
|
+
ElysiaAdapterOptions,
|
|
327
|
+
OtelTracer,
|
|
328
|
+
} from '@forgezero/access/elysia';
|
|
170
329
|
```
|
|
171
330
|
|
|
172
331
|
<a id="forgezero-access-client"></a>
|
|
173
332
|
## @forgezero/access/client
|
|
174
333
|
|
|
175
|
-
Typed client helpers that fulfil factors without duplicating the security matrix.
|
|
334
|
+
Typed client helpers that fulfil factors without duplicating the security matrix. This entry exposes 2 named value exports and 6 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
176
335
|
|
|
177
336
|
```text
|
|
178
|
-
import {
|
|
179
|
-
|
|
337
|
+
import {
|
|
338
|
+
buildPath,
|
|
339
|
+
createClient,
|
|
340
|
+
} from '@forgezero/access/client';
|
|
341
|
+
|
|
342
|
+
import type {
|
|
343
|
+
ChallengeHandler,
|
|
344
|
+
ClientOptions,
|
|
345
|
+
ClientResult,
|
|
346
|
+
Problem,
|
|
347
|
+
RequestArgs,
|
|
348
|
+
SecurityChallenge,
|
|
349
|
+
} from '@forgezero/access/client';
|
|
180
350
|
```
|
|
181
351
|
|
|
182
352
|
<a id="forgezero-access-testing"></a>
|
|
183
353
|
## @forgezero/access/testing
|
|
184
354
|
|
|
185
|
-
Deterministic access-pipeline fixtures and assertions for consumer tests.
|
|
355
|
+
Deterministic access-pipeline fixtures and assertions for consumer tests. This entry exposes 3 named value exports and 2 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
186
356
|
|
|
187
357
|
```text
|
|
188
|
-
import {
|
|
189
|
-
|
|
358
|
+
import {
|
|
359
|
+
reachableRoutes,
|
|
360
|
+
simulate,
|
|
361
|
+
unreachableRoutes,
|
|
362
|
+
} from '@forgezero/access/testing';
|
|
363
|
+
|
|
364
|
+
import type {
|
|
365
|
+
SimulateArgs,
|
|
366
|
+
Verdict,
|
|
367
|
+
} from '@forgezero/access/testing';
|
|
190
368
|
```
|
|
191
369
|
|
|
192
370
|
<a id="forgezero-access-header"></a>
|
|
193
371
|
## @forgezero/access/header
|
|
194
372
|
|
|
195
|
-
Strict configurable header-identity extraction with canonical names and bounded values.
|
|
373
|
+
Strict configurable header-identity extraction with canonical names and bounded values. This entry exposes 2 named value exports and 4 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
196
374
|
|
|
197
375
|
```text
|
|
198
|
-
import {
|
|
199
|
-
|
|
376
|
+
import {
|
|
377
|
+
defineHeaderIdentitySources,
|
|
378
|
+
headerIdentityResolver,
|
|
379
|
+
} from '@forgezero/access/header';
|
|
380
|
+
|
|
381
|
+
import type {
|
|
382
|
+
HeaderAssignmentResolver,
|
|
383
|
+
HeaderIdentity,
|
|
384
|
+
HeaderIdentitySource,
|
|
385
|
+
HeaderPrincipal,
|
|
386
|
+
} from '@forgezero/access/header';
|
|
200
387
|
```
|
|
201
388
|
|
|
202
389
|
<a id="forgezero-access-principal"></a>
|
|
203
390
|
## @forgezero/access/principal
|
|
204
391
|
|
|
205
|
-
Generic principal-source resolution for browser, API-key, attestation or future identity adapters.
|
|
392
|
+
Generic principal-source resolution for browser, API-key, attestation or future identity adapters. This entry exposes 4 named value exports and 3 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
206
393
|
|
|
207
394
|
```text
|
|
208
|
-
import {
|
|
209
|
-
|
|
395
|
+
import {
|
|
396
|
+
assignmentIsActive,
|
|
397
|
+
decidePrincipalAccess,
|
|
398
|
+
defineRbacPrincipal,
|
|
399
|
+
touchPrincipalAssignment,
|
|
400
|
+
} from '@forgezero/access/principal';
|
|
401
|
+
|
|
402
|
+
import type {
|
|
403
|
+
PrincipalAccessDecision,
|
|
404
|
+
PrincipalAssignment,
|
|
405
|
+
RbacPrincipal,
|
|
406
|
+
} from '@forgezero/access/principal';
|
|
210
407
|
```
|
|
211
408
|
|
|
212
409
|
<a id="forgezero-access-principal-session"></a>
|
|
213
410
|
## @forgezero/access/principal-session
|
|
214
411
|
|
|
215
|
-
Short-lived scope-bound delegated-principal sessions with sliding and absolute expiry.
|
|
412
|
+
Short-lived scope-bound delegated-principal sessions with sliding and absolute expiry. This entry exposes 8 named value exports and 2 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
216
413
|
|
|
217
414
|
```text
|
|
218
|
-
import {
|
|
219
|
-
|
|
220
|
-
|
|
415
|
+
import {
|
|
416
|
+
DEFAULT_PRINCIPAL_ABSOLUTE_TTL_MS,
|
|
417
|
+
DEFAULT_PRINCIPAL_IDLE_TTL_MS,
|
|
418
|
+
MAX_PRINCIPAL_ABSOLUTE_TTL_MS,
|
|
419
|
+
MAX_PRINCIPAL_IDLE_TTL_MS,
|
|
420
|
+
authenticatePrincipalSession,
|
|
421
|
+
issuePrincipalSession,
|
|
422
|
+
principalSessionIsActive,
|
|
423
|
+
touchPrincipalSession,
|
|
424
|
+
} from '@forgezero/access/principal-session';
|
|
425
|
+
|
|
426
|
+
import type {
|
|
427
|
+
IssuedPrincipalSession,
|
|
428
|
+
PrincipalSessionRecord,
|
|
429
|
+
} from '@forgezero/access/principal-session';
|
|
221
430
|
```
|
|
222
431
|
|
|
223
432
|
<a id="forgezero-access-authenticator"></a>
|
|
224
433
|
## @forgezero/access/authenticator
|
|
225
434
|
|
|
226
|
-
Authentication-source contracts for adding identity mechanisms without changing route policy.
|
|
435
|
+
Authentication-source contracts for adding identity mechanisms without changing route policy. This entry exposes 2 named value exports and 7 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
227
436
|
|
|
228
437
|
```text
|
|
229
|
-
import {
|
|
230
|
-
|
|
231
|
-
|
|
438
|
+
import {
|
|
439
|
+
createAuthenticator,
|
|
440
|
+
encoding,
|
|
441
|
+
} from '@forgezero/access/authenticator';
|
|
442
|
+
|
|
443
|
+
import type {
|
|
444
|
+
AuthenticationOptions,
|
|
445
|
+
AuthenticationResponse,
|
|
446
|
+
Authenticator,
|
|
447
|
+
AuthenticatorOptions,
|
|
448
|
+
Credential,
|
|
449
|
+
RegistrationOptions,
|
|
450
|
+
RegistrationResponse,
|
|
451
|
+
} from '@forgezero/access/authenticator';
|
|
232
452
|
```
|
|
233
453
|
|
|
234
454
|
<a id="forgezero-access-ceremony-modes"></a>
|
|
235
455
|
## @forgezero/access/ceremony-modes
|
|
236
456
|
|
|
237
|
-
Named security-ceremony modes and their session/action fulfilment semantics.
|
|
457
|
+
Named security-ceremony modes and their session/action fulfilment semantics. This entry exposes 3 named value exports and 2 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
238
458
|
|
|
239
459
|
```text
|
|
240
|
-
import {
|
|
241
|
-
|
|
460
|
+
import {
|
|
461
|
+
MAX_CUSTODIANS,
|
|
462
|
+
THRESHOLD_MODES,
|
|
463
|
+
thresholdMode,
|
|
464
|
+
} from '@forgezero/access/ceremony-modes';
|
|
465
|
+
|
|
466
|
+
import type {
|
|
467
|
+
ThresholdMode,
|
|
468
|
+
ThresholdModeId,
|
|
469
|
+
} from '@forgezero/access/ceremony-modes';
|
|
242
470
|
```
|
|
243
471
|
|
|
244
472
|
## 1. Install
|
|
@@ -254,7 +482,12 @@ bun add @forgezero/access
|
|
|
254
482
|
Routes carry their contract — label, method, and the shapes they accept and return. WHO may reach them is a separate list, because the two change for different reasons and on different schedules.
|
|
255
483
|
|
|
256
484
|
```text
|
|
257
|
-
import {
|
|
485
|
+
import {
|
|
486
|
+
defineRoutes,
|
|
487
|
+
defineAccessControl,
|
|
488
|
+
page,
|
|
489
|
+
action,
|
|
490
|
+
} from '@forgezero/access';
|
|
258
491
|
|
|
259
492
|
export const ROUTES = defineRoutes({
|
|
260
493
|
orders: page('Orders'),
|
|
@@ -278,11 +511,15 @@ One line per runtime. The pipeline is written once and shared, so an adapter nev
|
|
|
278
511
|
|
|
279
512
|
```text
|
|
280
513
|
// anywhere fetch exists — Workers, Deno, Node, Bun
|
|
281
|
-
import {
|
|
514
|
+
import {
|
|
515
|
+
toFetch,
|
|
516
|
+
} from '@forgezero/access/fetch';
|
|
282
517
|
export default { fetch: toFetch({ access: ACCESS, handlers: HANDLERS }) };
|
|
283
518
|
|
|
284
519
|
// Elysia
|
|
285
|
-
import {
|
|
520
|
+
import {
|
|
521
|
+
elysia,
|
|
522
|
+
} from '@forgezero/access/elysia';
|
|
286
523
|
app.use(elysia({ access: ACCESS, handlers: HANDLERS, Elysia }));
|
|
287
524
|
```
|
|
288
525
|
|
|
@@ -328,7 +565,10 @@ impactOfDisabling(ACCESS, ['passkey'])
|
|
|
328
565
|
simulate() reports which policy decided, which a browser 403 never tells you. reachableRoutes() answers what a role can actually do — worth running, because stem inheritance grants more than a grant list reads like.
|
|
329
566
|
|
|
330
567
|
```text
|
|
331
|
-
import {
|
|
568
|
+
import {
|
|
569
|
+
simulate,
|
|
570
|
+
reachableRoutes,
|
|
571
|
+
} from '@forgezero/access/testing';
|
|
332
572
|
|
|
333
573
|
simulate(ACCESS, { route: 'api/settings', roles, as: 'member' });
|
|
334
574
|
// { allowed: false, status: 403, reason: 'ACCESS_DENIED', sessionPolicy: 'admin' }
|
|
@@ -379,7 +619,11 @@ assertDeclaredRefusals({ routes: ROUTES, conditions: CONDITIONS });
|
|
|
379
619
|
Audit, emit, meter, invalidate and notify. None can fail the request — a dead audit sink must not turn a completed transfer into a 500. Audit records denials as well as successes, because a run of 403s from one session is the signal an incident is reconstructed from. Every payload is redacted first.
|
|
380
620
|
|
|
381
621
|
```text
|
|
382
|
-
import {
|
|
622
|
+
import {
|
|
623
|
+
audit,
|
|
624
|
+
emit,
|
|
625
|
+
meter,
|
|
626
|
+
} from '@forgezero/access/effects';
|
|
383
627
|
|
|
384
628
|
afterHandlers: {
|
|
385
629
|
trail: audit({ routes: [...], sink }),
|
package/dist/conditions.js
CHANGED
package/dist/effects.js
CHANGED
|
@@ -275,7 +275,7 @@ function impactOfDisabling(access, enabledAfter) {
|
|
|
275
275
|
}
|
|
276
276
|
return broken;
|
|
277
277
|
}
|
|
278
|
-
var VERSION = "0.1.
|
|
278
|
+
var VERSION = "0.1.5";
|
|
279
279
|
|
|
280
280
|
// src/security.ts
|
|
281
281
|
var HEX = Array.from({ length: 256 }, (_, index) => index.toString(16).padStart(2, "0"));
|
package/dist/elysia.js
CHANGED
package/dist/fetch.js
CHANGED
package/dist/header.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/pipeline.js
CHANGED
|
@@ -275,7 +275,7 @@ function impactOfDisabling(access, enabledAfter) {
|
|
|
275
275
|
}
|
|
276
276
|
return broken;
|
|
277
277
|
}
|
|
278
|
-
var VERSION = "0.1.
|
|
278
|
+
var VERSION = "0.1.5";
|
|
279
279
|
|
|
280
280
|
// src/security.ts
|
|
281
281
|
var HEX = Array.from({ length: 256 }, (_, index) => index.toString(16).padStart(2, "0"));
|
package/dist/principal.js
CHANGED
package/dist/testing.js
CHANGED