@janssenproject/cedarling_wasm 0.0.420-nodejs → 0.0.421-nodejs
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/cedarling_wasm.d.ts +152 -0
- package/cedarling_wasm.js +427 -15
- package/cedarling_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/cedarling_wasm.d.ts
CHANGED
|
@@ -56,6 +56,116 @@ export class AuthorizeResultResponse {
|
|
|
56
56
|
readonly diagnostics: Diagnostics;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* WASM wrapper for
|
|
61
|
+
* `cedarling::BatchAuthorizeResponse<Result<MultiIssuerAuthorizeResult, BatchItemError>>`.
|
|
62
|
+
* Same shape as [`BatchAuthorizeUnsignedResponse`] with multi-issuer results.
|
|
63
|
+
*/
|
|
64
|
+
export class BatchAuthorizeMultiIssuerResponse {
|
|
65
|
+
private constructor();
|
|
66
|
+
free(): void;
|
|
67
|
+
[Symbol.dispose](): void;
|
|
68
|
+
/**
|
|
69
|
+
* Shared correlation id stamped on every per-item decision log entry.
|
|
70
|
+
*/
|
|
71
|
+
readonly batch_id: string;
|
|
72
|
+
/**
|
|
73
|
+
* Per-item results in input order — each slot is a
|
|
74
|
+
* [`BatchItemMultiIssuerResult`].
|
|
75
|
+
*/
|
|
76
|
+
readonly results: BatchItemMultiIssuerResult[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* WASM wrapper for `cedarling::BatchAuthorizeResponse<Result<AuthorizeResult, BatchItemError>>`.
|
|
81
|
+
*
|
|
82
|
+
* Carries a shared `batch_id` (UUIDv7) alongside per-item results. Each result
|
|
83
|
+
* is a [`BatchItemUnsignedResult`] — Cedar decision on `is_ok()`, per-item
|
|
84
|
+
* build failure on `error`. `results[i]` corresponds to `items[i]`.
|
|
85
|
+
*/
|
|
86
|
+
export class BatchAuthorizeUnsignedResponse {
|
|
87
|
+
private constructor();
|
|
88
|
+
free(): void;
|
|
89
|
+
[Symbol.dispose](): void;
|
|
90
|
+
/**
|
|
91
|
+
* Shared correlation id stamped on every per-item decision log entry.
|
|
92
|
+
*/
|
|
93
|
+
readonly batch_id: string;
|
|
94
|
+
/**
|
|
95
|
+
* Per-item results in input order — each slot is a
|
|
96
|
+
* [`BatchItemUnsignedResult`].
|
|
97
|
+
*/
|
|
98
|
+
readonly results: BatchItemUnsignedResult[];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Per-item build failure surfaced inside a batch response at `results[i]`
|
|
103
|
+
* when Cedar couldn't be reached for that item.
|
|
104
|
+
*/
|
|
105
|
+
export class BatchItemError {
|
|
106
|
+
private constructor();
|
|
107
|
+
free(): void;
|
|
108
|
+
[Symbol.dispose](): void;
|
|
109
|
+
/**
|
|
110
|
+
* Stable variant slug — `action_parse`, `resource_build`, `context_build`,
|
|
111
|
+
* `principal_build`, `schema_validation`, `multi_issuer_entity`,
|
|
112
|
+
* `request_validation`.
|
|
113
|
+
*/
|
|
114
|
+
readonly category: string;
|
|
115
|
+
/**
|
|
116
|
+
* Position of the failing item in the original `items` vector.
|
|
117
|
+
*/
|
|
118
|
+
readonly item_index: number;
|
|
119
|
+
/**
|
|
120
|
+
* Human-readable diagnostic. Safe to log.
|
|
121
|
+
*/
|
|
122
|
+
readonly message: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Multi-issuer analog of [`BatchItemUnsignedResult`].
|
|
127
|
+
*/
|
|
128
|
+
export class BatchItemMultiIssuerResult {
|
|
129
|
+
private constructor();
|
|
130
|
+
free(): void;
|
|
131
|
+
[Symbol.dispose](): void;
|
|
132
|
+
/**
|
|
133
|
+
* The multi-issuer decision if `is_ok()`; throws otherwise.
|
|
134
|
+
*/
|
|
135
|
+
unwrap(): MultiIssuerAuthorizeResult;
|
|
136
|
+
/**
|
|
137
|
+
* The per-item error if `!is_ok()`; `undefined` otherwise.
|
|
138
|
+
*/
|
|
139
|
+
readonly error: BatchItemError | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* `true` when Cedar evaluated this item.
|
|
142
|
+
*/
|
|
143
|
+
readonly is_ok: boolean;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* One slot in a batch response's `results` array. Callers switch on
|
|
148
|
+
* `is_ok()` — on `true`, read `unwrap()`; on `false`, read `error()`.
|
|
149
|
+
*/
|
|
150
|
+
export class BatchItemUnsignedResult {
|
|
151
|
+
private constructor();
|
|
152
|
+
free(): void;
|
|
153
|
+
[Symbol.dispose](): void;
|
|
154
|
+
/**
|
|
155
|
+
* The Cedar decision if `is_ok()`; throws otherwise.
|
|
156
|
+
*/
|
|
157
|
+
unwrap(): AuthorizeResult;
|
|
158
|
+
/**
|
|
159
|
+
* The per-item error if `!is_ok()`; `undefined` otherwise.
|
|
160
|
+
*/
|
|
161
|
+
readonly error: BatchItemError | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* `true` when Cedar evaluated this item (Allow or Deny); `false` when it
|
|
164
|
+
* failed to build.
|
|
165
|
+
*/
|
|
166
|
+
readonly is_ok: boolean;
|
|
167
|
+
}
|
|
168
|
+
|
|
59
169
|
/**
|
|
60
170
|
* The instance of the Cedarling application.
|
|
61
171
|
*/
|
|
@@ -139,6 +249,27 @@ export class Cedarling {
|
|
|
139
249
|
* ```
|
|
140
250
|
*/
|
|
141
251
|
authorize_multi_issuer(request: string): Promise<MultiIssuerAuthorizeResult>;
|
|
252
|
+
/**
|
|
253
|
+
* Authorize a batch of multi-issuer requests against one shared token set.
|
|
254
|
+
*
|
|
255
|
+
* Tokens are validated and token/issuer entities are built once, then
|
|
256
|
+
* each item is evaluated in input order. Batch-level failures (validation,
|
|
257
|
+
* JWT verification, status-list refresh) reject the whole call; per-item
|
|
258
|
+
* failures are returned as `BatchItemError` results and exposed by WASM
|
|
259
|
+
* with `is_ok=false` and `error`, while genuine Cedar denials remain
|
|
260
|
+
* `AuthorizeResult` values with `decision=false`.
|
|
261
|
+
*
|
|
262
|
+
* # Arguments
|
|
263
|
+
*
|
|
264
|
+
* * `request` - JSON string representation of [`BatchAuthorizeMultiIssuerRequest`].
|
|
265
|
+
*
|
|
266
|
+
* # Example
|
|
267
|
+
*
|
|
268
|
+
* ```javascript
|
|
269
|
+
* const result = await cedarling.authorize_multi_issuer_batch(JSON.stringify(batchRequest));
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
authorize_multi_issuer_batch(request: string): Promise<BatchAuthorizeMultiIssuerResponse>;
|
|
142
273
|
/**
|
|
143
274
|
* Authorize an unsigned request carrying an optional single principal.
|
|
144
275
|
* Makes an authorization decision based on the [`RequestUnsigned`].
|
|
@@ -159,6 +290,27 @@ export class Cedarling {
|
|
|
159
290
|
* ```
|
|
160
291
|
*/
|
|
161
292
|
authorize_unsigned(request: string): Promise<AuthorizeResult>;
|
|
293
|
+
/**
|
|
294
|
+
* Authorize a batch of unsigned requests against one shared principal.
|
|
295
|
+
*
|
|
296
|
+
* Setup work (principal build + pushed-data snapshot) runs once and each
|
|
297
|
+
* item is evaluated in input order. Results are returned inside a
|
|
298
|
+
* [`BatchAuthorizeUnsignedResponse`] carrying the shared `batch_id`.
|
|
299
|
+
* Batch-level failures (validation, principal parse) reject the whole
|
|
300
|
+
* call; per-item failures are returned as `BatchItemError` results and
|
|
301
|
+
* exposed by WASM with `is_ok=false` and `error`, while genuine Cedar
|
|
302
|
+
* denials remain `AuthorizeResult` values with `decision=false`.
|
|
303
|
+
* # Arguments
|
|
304
|
+
*
|
|
305
|
+
* * `request` - JSON string representation of [`BatchAuthorizeUnsignedRequest`].
|
|
306
|
+
*
|
|
307
|
+
* # Example
|
|
308
|
+
*
|
|
309
|
+
* ```javascript
|
|
310
|
+
* const result = await cedarling.authorize_unsigned_batch(JSON.stringify(batchRequest));
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
authorize_unsigned_batch(request: string): Promise<BatchAuthorizeUnsignedResponse>;
|
|
162
314
|
/**
|
|
163
315
|
* Clear all entries from the data store.
|
|
164
316
|
*
|
package/cedarling_wasm.js
CHANGED
|
@@ -155,6 +155,331 @@ class AuthorizeResultResponse {
|
|
|
155
155
|
if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
|
|
156
156
|
exports.AuthorizeResultResponse = AuthorizeResultResponse;
|
|
157
157
|
|
|
158
|
+
/**
|
|
159
|
+
* WASM wrapper for
|
|
160
|
+
* `cedarling::BatchAuthorizeResponse<Result<MultiIssuerAuthorizeResult, BatchItemError>>`.
|
|
161
|
+
* Same shape as [`BatchAuthorizeUnsignedResponse`] with multi-issuer results.
|
|
162
|
+
*/
|
|
163
|
+
class BatchAuthorizeMultiIssuerResponse {
|
|
164
|
+
static __wrap(ptr) {
|
|
165
|
+
const obj = Object.create(BatchAuthorizeMultiIssuerResponse.prototype);
|
|
166
|
+
obj.__wbg_ptr = ptr;
|
|
167
|
+
BatchAuthorizeMultiIssuerResponseFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
168
|
+
return obj;
|
|
169
|
+
}
|
|
170
|
+
__destroy_into_raw() {
|
|
171
|
+
const ptr = this.__wbg_ptr;
|
|
172
|
+
this.__wbg_ptr = 0;
|
|
173
|
+
BatchAuthorizeMultiIssuerResponseFinalization.unregister(this);
|
|
174
|
+
return ptr;
|
|
175
|
+
}
|
|
176
|
+
free() {
|
|
177
|
+
const ptr = this.__destroy_into_raw();
|
|
178
|
+
wasm.__wbg_batchauthorizemultiissuerresponse_free(ptr, 0);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Shared correlation id stamped on every per-item decision log entry.
|
|
182
|
+
* @returns {string}
|
|
183
|
+
*/
|
|
184
|
+
get batch_id() {
|
|
185
|
+
let deferred1_0;
|
|
186
|
+
let deferred1_1;
|
|
187
|
+
try {
|
|
188
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
189
|
+
wasm.batchauthorizemultiissuerresponse_batch_id(retptr, this.__wbg_ptr);
|
|
190
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
191
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
192
|
+
deferred1_0 = r0;
|
|
193
|
+
deferred1_1 = r1;
|
|
194
|
+
return getStringFromWasm0(r0, r1);
|
|
195
|
+
} finally {
|
|
196
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
197
|
+
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Per-item results in input order — each slot is a
|
|
202
|
+
* [`BatchItemMultiIssuerResult`].
|
|
203
|
+
* @returns {BatchItemMultiIssuerResult[]}
|
|
204
|
+
*/
|
|
205
|
+
get results() {
|
|
206
|
+
try {
|
|
207
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
208
|
+
wasm.batchauthorizemultiissuerresponse_results(retptr, this.__wbg_ptr);
|
|
209
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
210
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
211
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
212
|
+
wasm.__wbindgen_export5(r0, r1 * 4, 4);
|
|
213
|
+
return v1;
|
|
214
|
+
} finally {
|
|
215
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (Symbol.dispose) BatchAuthorizeMultiIssuerResponse.prototype[Symbol.dispose] = BatchAuthorizeMultiIssuerResponse.prototype.free;
|
|
220
|
+
exports.BatchAuthorizeMultiIssuerResponse = BatchAuthorizeMultiIssuerResponse;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* WASM wrapper for `cedarling::BatchAuthorizeResponse<Result<AuthorizeResult, BatchItemError>>`.
|
|
224
|
+
*
|
|
225
|
+
* Carries a shared `batch_id` (UUIDv7) alongside per-item results. Each result
|
|
226
|
+
* is a [`BatchItemUnsignedResult`] — Cedar decision on `is_ok()`, per-item
|
|
227
|
+
* build failure on `error`. `results[i]` corresponds to `items[i]`.
|
|
228
|
+
*/
|
|
229
|
+
class BatchAuthorizeUnsignedResponse {
|
|
230
|
+
static __wrap(ptr) {
|
|
231
|
+
const obj = Object.create(BatchAuthorizeUnsignedResponse.prototype);
|
|
232
|
+
obj.__wbg_ptr = ptr;
|
|
233
|
+
BatchAuthorizeUnsignedResponseFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
234
|
+
return obj;
|
|
235
|
+
}
|
|
236
|
+
__destroy_into_raw() {
|
|
237
|
+
const ptr = this.__wbg_ptr;
|
|
238
|
+
this.__wbg_ptr = 0;
|
|
239
|
+
BatchAuthorizeUnsignedResponseFinalization.unregister(this);
|
|
240
|
+
return ptr;
|
|
241
|
+
}
|
|
242
|
+
free() {
|
|
243
|
+
const ptr = this.__destroy_into_raw();
|
|
244
|
+
wasm.__wbg_batchauthorizeunsignedresponse_free(ptr, 0);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Shared correlation id stamped on every per-item decision log entry.
|
|
248
|
+
* @returns {string}
|
|
249
|
+
*/
|
|
250
|
+
get batch_id() {
|
|
251
|
+
let deferred1_0;
|
|
252
|
+
let deferred1_1;
|
|
253
|
+
try {
|
|
254
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
255
|
+
wasm.batchauthorizeunsignedresponse_batch_id(retptr, this.__wbg_ptr);
|
|
256
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
257
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
258
|
+
deferred1_0 = r0;
|
|
259
|
+
deferred1_1 = r1;
|
|
260
|
+
return getStringFromWasm0(r0, r1);
|
|
261
|
+
} finally {
|
|
262
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
263
|
+
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Per-item results in input order — each slot is a
|
|
268
|
+
* [`BatchItemUnsignedResult`].
|
|
269
|
+
* @returns {BatchItemUnsignedResult[]}
|
|
270
|
+
*/
|
|
271
|
+
get results() {
|
|
272
|
+
try {
|
|
273
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
274
|
+
wasm.batchauthorizeunsignedresponse_results(retptr, this.__wbg_ptr);
|
|
275
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
276
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
277
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
278
|
+
wasm.__wbindgen_export5(r0, r1 * 4, 4);
|
|
279
|
+
return v1;
|
|
280
|
+
} finally {
|
|
281
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (Symbol.dispose) BatchAuthorizeUnsignedResponse.prototype[Symbol.dispose] = BatchAuthorizeUnsignedResponse.prototype.free;
|
|
286
|
+
exports.BatchAuthorizeUnsignedResponse = BatchAuthorizeUnsignedResponse;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Per-item build failure surfaced inside a batch response at `results[i]`
|
|
290
|
+
* when Cedar couldn't be reached for that item.
|
|
291
|
+
*/
|
|
292
|
+
class BatchItemError {
|
|
293
|
+
static __wrap(ptr) {
|
|
294
|
+
const obj = Object.create(BatchItemError.prototype);
|
|
295
|
+
obj.__wbg_ptr = ptr;
|
|
296
|
+
BatchItemErrorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
297
|
+
return obj;
|
|
298
|
+
}
|
|
299
|
+
__destroy_into_raw() {
|
|
300
|
+
const ptr = this.__wbg_ptr;
|
|
301
|
+
this.__wbg_ptr = 0;
|
|
302
|
+
BatchItemErrorFinalization.unregister(this);
|
|
303
|
+
return ptr;
|
|
304
|
+
}
|
|
305
|
+
free() {
|
|
306
|
+
const ptr = this.__destroy_into_raw();
|
|
307
|
+
wasm.__wbg_batchitemerror_free(ptr, 0);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Stable variant slug — `action_parse`, `resource_build`, `context_build`,
|
|
311
|
+
* `principal_build`, `schema_validation`, `multi_issuer_entity`,
|
|
312
|
+
* `request_validation`.
|
|
313
|
+
* @returns {string}
|
|
314
|
+
*/
|
|
315
|
+
get category() {
|
|
316
|
+
let deferred1_0;
|
|
317
|
+
let deferred1_1;
|
|
318
|
+
try {
|
|
319
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
320
|
+
wasm.batchitemerror_category(retptr, this.__wbg_ptr);
|
|
321
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
322
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
323
|
+
deferred1_0 = r0;
|
|
324
|
+
deferred1_1 = r1;
|
|
325
|
+
return getStringFromWasm0(r0, r1);
|
|
326
|
+
} finally {
|
|
327
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
328
|
+
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Position of the failing item in the original `items` vector.
|
|
333
|
+
* @returns {number}
|
|
334
|
+
*/
|
|
335
|
+
get item_index() {
|
|
336
|
+
const ret = wasm.batchitemerror_item_index(this.__wbg_ptr);
|
|
337
|
+
return ret >>> 0;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Human-readable diagnostic. Safe to log.
|
|
341
|
+
* @returns {string}
|
|
342
|
+
*/
|
|
343
|
+
get message() {
|
|
344
|
+
let deferred1_0;
|
|
345
|
+
let deferred1_1;
|
|
346
|
+
try {
|
|
347
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
348
|
+
wasm.batchitemerror_message(retptr, this.__wbg_ptr);
|
|
349
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
350
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
351
|
+
deferred1_0 = r0;
|
|
352
|
+
deferred1_1 = r1;
|
|
353
|
+
return getStringFromWasm0(r0, r1);
|
|
354
|
+
} finally {
|
|
355
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
356
|
+
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (Symbol.dispose) BatchItemError.prototype[Symbol.dispose] = BatchItemError.prototype.free;
|
|
361
|
+
exports.BatchItemError = BatchItemError;
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Multi-issuer analog of [`BatchItemUnsignedResult`].
|
|
365
|
+
*/
|
|
366
|
+
class BatchItemMultiIssuerResult {
|
|
367
|
+
static __wrap(ptr) {
|
|
368
|
+
const obj = Object.create(BatchItemMultiIssuerResult.prototype);
|
|
369
|
+
obj.__wbg_ptr = ptr;
|
|
370
|
+
BatchItemMultiIssuerResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
371
|
+
return obj;
|
|
372
|
+
}
|
|
373
|
+
__destroy_into_raw() {
|
|
374
|
+
const ptr = this.__wbg_ptr;
|
|
375
|
+
this.__wbg_ptr = 0;
|
|
376
|
+
BatchItemMultiIssuerResultFinalization.unregister(this);
|
|
377
|
+
return ptr;
|
|
378
|
+
}
|
|
379
|
+
free() {
|
|
380
|
+
const ptr = this.__destroy_into_raw();
|
|
381
|
+
wasm.__wbg_batchitemmultiissuerresult_free(ptr, 0);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* The per-item error if `!is_ok()`; `undefined` otherwise.
|
|
385
|
+
* @returns {BatchItemError | undefined}
|
|
386
|
+
*/
|
|
387
|
+
get error() {
|
|
388
|
+
const ret = wasm.batchitemmultiissuerresult_error(this.__wbg_ptr);
|
|
389
|
+
return ret === 0 ? undefined : BatchItemError.__wrap(ret);
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* `true` when Cedar evaluated this item.
|
|
393
|
+
* @returns {boolean}
|
|
394
|
+
*/
|
|
395
|
+
get is_ok() {
|
|
396
|
+
const ret = wasm.batchitemmultiissuerresult_is_ok(this.__wbg_ptr);
|
|
397
|
+
return ret !== 0;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* The multi-issuer decision if `is_ok()`; throws otherwise.
|
|
401
|
+
* @returns {MultiIssuerAuthorizeResult}
|
|
402
|
+
*/
|
|
403
|
+
unwrap() {
|
|
404
|
+
try {
|
|
405
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
406
|
+
wasm.batchitemmultiissuerresult_unwrap(retptr, this.__wbg_ptr);
|
|
407
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
408
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
409
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
410
|
+
if (r2) {
|
|
411
|
+
throw takeObject(r1);
|
|
412
|
+
}
|
|
413
|
+
return MultiIssuerAuthorizeResult.__wrap(r0);
|
|
414
|
+
} finally {
|
|
415
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (Symbol.dispose) BatchItemMultiIssuerResult.prototype[Symbol.dispose] = BatchItemMultiIssuerResult.prototype.free;
|
|
420
|
+
exports.BatchItemMultiIssuerResult = BatchItemMultiIssuerResult;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* One slot in a batch response's `results` array. Callers switch on
|
|
424
|
+
* `is_ok()` — on `true`, read `unwrap()`; on `false`, read `error()`.
|
|
425
|
+
*/
|
|
426
|
+
class BatchItemUnsignedResult {
|
|
427
|
+
static __wrap(ptr) {
|
|
428
|
+
const obj = Object.create(BatchItemUnsignedResult.prototype);
|
|
429
|
+
obj.__wbg_ptr = ptr;
|
|
430
|
+
BatchItemUnsignedResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
431
|
+
return obj;
|
|
432
|
+
}
|
|
433
|
+
__destroy_into_raw() {
|
|
434
|
+
const ptr = this.__wbg_ptr;
|
|
435
|
+
this.__wbg_ptr = 0;
|
|
436
|
+
BatchItemUnsignedResultFinalization.unregister(this);
|
|
437
|
+
return ptr;
|
|
438
|
+
}
|
|
439
|
+
free() {
|
|
440
|
+
const ptr = this.__destroy_into_raw();
|
|
441
|
+
wasm.__wbg_batchitemunsignedresult_free(ptr, 0);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* The per-item error if `!is_ok()`; `undefined` otherwise.
|
|
445
|
+
* @returns {BatchItemError | undefined}
|
|
446
|
+
*/
|
|
447
|
+
get error() {
|
|
448
|
+
const ret = wasm.batchitemunsignedresult_error(this.__wbg_ptr);
|
|
449
|
+
return ret === 0 ? undefined : BatchItemError.__wrap(ret);
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* `true` when Cedar evaluated this item (Allow or Deny); `false` when it
|
|
453
|
+
* failed to build.
|
|
454
|
+
* @returns {boolean}
|
|
455
|
+
*/
|
|
456
|
+
get is_ok() {
|
|
457
|
+
const ret = wasm.batchitemunsignedresult_is_ok(this.__wbg_ptr);
|
|
458
|
+
return ret !== 0;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* The Cedar decision if `is_ok()`; throws otherwise.
|
|
462
|
+
* @returns {AuthorizeResult}
|
|
463
|
+
*/
|
|
464
|
+
unwrap() {
|
|
465
|
+
try {
|
|
466
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
467
|
+
wasm.batchitemunsignedresult_unwrap(retptr, this.__wbg_ptr);
|
|
468
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
469
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
470
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
471
|
+
if (r2) {
|
|
472
|
+
throw takeObject(r1);
|
|
473
|
+
}
|
|
474
|
+
return AuthorizeResult.__wrap(r0);
|
|
475
|
+
} finally {
|
|
476
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (Symbol.dispose) BatchItemUnsignedResult.prototype[Symbol.dispose] = BatchItemUnsignedResult.prototype.free;
|
|
481
|
+
exports.BatchItemUnsignedResult = BatchItemUnsignedResult;
|
|
482
|
+
|
|
158
483
|
/**
|
|
159
484
|
* The instance of the Cedarling application.
|
|
160
485
|
*/
|
|
@@ -313,6 +638,34 @@ class Cedarling {
|
|
|
313
638
|
const ret = wasm.cedarling_authorize_multi_issuer(this.__wbg_ptr, ptr0, len0);
|
|
314
639
|
return takeObject(ret);
|
|
315
640
|
}
|
|
641
|
+
/**
|
|
642
|
+
* Authorize a batch of multi-issuer requests against one shared token set.
|
|
643
|
+
*
|
|
644
|
+
* Tokens are validated and token/issuer entities are built once, then
|
|
645
|
+
* each item is evaluated in input order. Batch-level failures (validation,
|
|
646
|
+
* JWT verification, status-list refresh) reject the whole call; per-item
|
|
647
|
+
* failures are returned as `BatchItemError` results and exposed by WASM
|
|
648
|
+
* with `is_ok=false` and `error`, while genuine Cedar denials remain
|
|
649
|
+
* `AuthorizeResult` values with `decision=false`.
|
|
650
|
+
*
|
|
651
|
+
* # Arguments
|
|
652
|
+
*
|
|
653
|
+
* * `request` - JSON string representation of [`BatchAuthorizeMultiIssuerRequest`].
|
|
654
|
+
*
|
|
655
|
+
* # Example
|
|
656
|
+
*
|
|
657
|
+
* ```javascript
|
|
658
|
+
* const result = await cedarling.authorize_multi_issuer_batch(JSON.stringify(batchRequest));
|
|
659
|
+
* ```
|
|
660
|
+
* @param {string} request
|
|
661
|
+
* @returns {Promise<BatchAuthorizeMultiIssuerResponse>}
|
|
662
|
+
*/
|
|
663
|
+
authorize_multi_issuer_batch(request) {
|
|
664
|
+
const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
665
|
+
const len0 = WASM_VECTOR_LEN;
|
|
666
|
+
const ret = wasm.cedarling_authorize_multi_issuer_batch(this.__wbg_ptr, ptr0, len0);
|
|
667
|
+
return takeObject(ret);
|
|
668
|
+
}
|
|
316
669
|
/**
|
|
317
670
|
* Authorize an unsigned request carrying an optional single principal.
|
|
318
671
|
* Makes an authorization decision based on the [`RequestUnsigned`].
|
|
@@ -340,6 +693,34 @@ class Cedarling {
|
|
|
340
693
|
const ret = wasm.cedarling_authorize_unsigned(this.__wbg_ptr, ptr0, len0);
|
|
341
694
|
return takeObject(ret);
|
|
342
695
|
}
|
|
696
|
+
/**
|
|
697
|
+
* Authorize a batch of unsigned requests against one shared principal.
|
|
698
|
+
*
|
|
699
|
+
* Setup work (principal build + pushed-data snapshot) runs once and each
|
|
700
|
+
* item is evaluated in input order. Results are returned inside a
|
|
701
|
+
* [`BatchAuthorizeUnsignedResponse`] carrying the shared `batch_id`.
|
|
702
|
+
* Batch-level failures (validation, principal parse) reject the whole
|
|
703
|
+
* call; per-item failures are returned as `BatchItemError` results and
|
|
704
|
+
* exposed by WASM with `is_ok=false` and `error`, while genuine Cedar
|
|
705
|
+
* denials remain `AuthorizeResult` values with `decision=false`.
|
|
706
|
+
* # Arguments
|
|
707
|
+
*
|
|
708
|
+
* * `request` - JSON string representation of [`BatchAuthorizeUnsignedRequest`].
|
|
709
|
+
*
|
|
710
|
+
* # Example
|
|
711
|
+
*
|
|
712
|
+
* ```javascript
|
|
713
|
+
* const result = await cedarling.authorize_unsigned_batch(JSON.stringify(batchRequest));
|
|
714
|
+
* ```
|
|
715
|
+
* @param {string} request
|
|
716
|
+
* @returns {Promise<BatchAuthorizeUnsignedResponse>}
|
|
717
|
+
*/
|
|
718
|
+
authorize_unsigned_batch(request) {
|
|
719
|
+
const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
720
|
+
const len0 = WASM_VECTOR_LEN;
|
|
721
|
+
const ret = wasm.cedarling_authorize_unsigned_batch(this.__wbg_ptr, ptr0, len0);
|
|
722
|
+
return takeObject(ret);
|
|
723
|
+
}
|
|
343
724
|
/**
|
|
344
725
|
* Clear all entries from the data store.
|
|
345
726
|
*
|
|
@@ -1699,6 +2080,22 @@ function __wbg_get_imports() {
|
|
|
1699
2080
|
const ret = AuthorizeResult.__wrap(arg0);
|
|
1700
2081
|
return addHeapObject(ret);
|
|
1701
2082
|
},
|
|
2083
|
+
__wbg_batchauthorizemultiissuerresponse_new: function(arg0) {
|
|
2084
|
+
const ret = BatchAuthorizeMultiIssuerResponse.__wrap(arg0);
|
|
2085
|
+
return addHeapObject(ret);
|
|
2086
|
+
},
|
|
2087
|
+
__wbg_batchauthorizeunsignedresponse_new: function(arg0) {
|
|
2088
|
+
const ret = BatchAuthorizeUnsignedResponse.__wrap(arg0);
|
|
2089
|
+
return addHeapObject(ret);
|
|
2090
|
+
},
|
|
2091
|
+
__wbg_batchitemmultiissuerresult_new: function(arg0) {
|
|
2092
|
+
const ret = BatchItemMultiIssuerResult.__wrap(arg0);
|
|
2093
|
+
return addHeapObject(ret);
|
|
2094
|
+
},
|
|
2095
|
+
__wbg_batchitemunsignedresult_new: function(arg0) {
|
|
2096
|
+
const ret = BatchItemUnsignedResult.__wrap(arg0);
|
|
2097
|
+
return addHeapObject(ret);
|
|
2098
|
+
},
|
|
1702
2099
|
__wbg_body_18c9f2ac15ead4b2: function(arg0) {
|
|
1703
2100
|
const ret = getObject(arg0).body;
|
|
1704
2101
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
@@ -1999,7 +2396,7 @@ function __wbg_get_imports() {
|
|
|
1999
2396
|
const a = state0.a;
|
|
2000
2397
|
state0.a = 0;
|
|
2001
2398
|
try {
|
|
2002
|
-
return
|
|
2399
|
+
return __wasm_bindgen_func_elem_8836(a, state0.b, arg0, arg1);
|
|
2003
2400
|
} finally {
|
|
2004
2401
|
state0.a = a;
|
|
2005
2402
|
}
|
|
@@ -2208,18 +2605,18 @@ function __wbg_get_imports() {
|
|
|
2208
2605
|
console.warn(...getObject(arg0));
|
|
2209
2606
|
},
|
|
2210
2607
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2211
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2212
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2608
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1193, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2609
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12258);
|
|
2213
2610
|
return addHeapObject(ret);
|
|
2214
2611
|
},
|
|
2215
2612
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2216
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2217
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2613
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 992, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2614
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8781);
|
|
2218
2615
|
return addHeapObject(ret);
|
|
2219
2616
|
},
|
|
2220
2617
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
2221
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
2222
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2618
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 876, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2619
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8616);
|
|
2223
2620
|
return addHeapObject(ret);
|
|
2224
2621
|
},
|
|
2225
2622
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
@@ -2261,18 +2658,18 @@ function __wbg_get_imports() {
|
|
|
2261
2658
|
};
|
|
2262
2659
|
}
|
|
2263
2660
|
|
|
2264
|
-
function
|
|
2265
|
-
wasm.
|
|
2661
|
+
function __wasm_bindgen_func_elem_8616(arg0, arg1) {
|
|
2662
|
+
wasm.__wasm_bindgen_func_elem_8616(arg0, arg1);
|
|
2266
2663
|
}
|
|
2267
2664
|
|
|
2268
|
-
function
|
|
2269
|
-
wasm.
|
|
2665
|
+
function __wasm_bindgen_func_elem_12258(arg0, arg1, arg2) {
|
|
2666
|
+
wasm.__wasm_bindgen_func_elem_12258(arg0, arg1, addHeapObject(arg2));
|
|
2270
2667
|
}
|
|
2271
2668
|
|
|
2272
|
-
function
|
|
2669
|
+
function __wasm_bindgen_func_elem_8781(arg0, arg1, arg2) {
|
|
2273
2670
|
try {
|
|
2274
2671
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2275
|
-
wasm.
|
|
2672
|
+
wasm.__wasm_bindgen_func_elem_8781(retptr, arg0, arg1, addHeapObject(arg2));
|
|
2276
2673
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2277
2674
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2278
2675
|
if (r1) {
|
|
@@ -2283,8 +2680,8 @@ function __wasm_bindgen_func_elem_8695(arg0, arg1, arg2) {
|
|
|
2283
2680
|
}
|
|
2284
2681
|
}
|
|
2285
2682
|
|
|
2286
|
-
function
|
|
2287
|
-
wasm.
|
|
2683
|
+
function __wasm_bindgen_func_elem_8836(arg0, arg1, arg2, arg3) {
|
|
2684
|
+
wasm.__wasm_bindgen_func_elem_8836(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
2288
2685
|
}
|
|
2289
2686
|
|
|
2290
2687
|
|
|
@@ -2310,6 +2707,21 @@ const AuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined'
|
|
|
2310
2707
|
const AuthorizeResultResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2311
2708
|
? { register: () => {}, unregister: () => {} }
|
|
2312
2709
|
: new FinalizationRegistry(ptr => wasm.__wbg_authorizeresultresponse_free(ptr, 1));
|
|
2710
|
+
const BatchAuthorizeMultiIssuerResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2711
|
+
? { register: () => {}, unregister: () => {} }
|
|
2712
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_batchauthorizemultiissuerresponse_free(ptr, 1));
|
|
2713
|
+
const BatchAuthorizeUnsignedResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2714
|
+
? { register: () => {}, unregister: () => {} }
|
|
2715
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_batchauthorizeunsignedresponse_free(ptr, 1));
|
|
2716
|
+
const BatchItemErrorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2717
|
+
? { register: () => {}, unregister: () => {} }
|
|
2718
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_batchitemerror_free(ptr, 1));
|
|
2719
|
+
const BatchItemMultiIssuerResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2720
|
+
? { register: () => {}, unregister: () => {} }
|
|
2721
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_batchitemmultiissuerresult_free(ptr, 1));
|
|
2722
|
+
const BatchItemUnsignedResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2723
|
+
? { register: () => {}, unregister: () => {} }
|
|
2724
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_batchitemunsignedresult_free(ptr, 1));
|
|
2313
2725
|
const CedarlingFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2314
2726
|
? { register: () => {}, unregister: () => {} }
|
|
2315
2727
|
: new FinalizationRegistry(ptr => wasm.__wbg_cedarling_free(ptr, 1));
|
package/cedarling_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@janssenproject/cedarling_wasm",
|
|
3
3
|
"description": "The Cedarling is a performant local authorization service that runs the Rust Cedar Engine",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.421-nodejs",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|