@reallyme/jose 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,3 +1,30 @@
1
+ Except as otherwise noted, this project is licensed under either the MIT
2
+ License or the Apache License, Version 2.0, at your option. Both license texts
3
+ are reproduced below. Third-party and vendored components retain their own
4
+ license notices and terms.
5
+
6
+ MIT License
7
+
8
+ Copyright (c) 2026 ReallyMe LLC
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
1
28
  Apache License
2
29
  Version 2.0, January 2004
3
30
  http://www.apache.org/licenses/
package/NOTICE CHANGED
@@ -1,12 +1,12 @@
1
1
  SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
 
3
- SPDX-License-Identifier: Apache-2.0
4
3
 
5
4
  ReallyMe JOSE
6
5
  Copyright © 2026 ReallyMe LLC. All rights reserved.
7
6
 
8
- This package includes JOSE, JWT, and JWS helpers developed by ReallyMe LLC and
9
- distributed under the Apache License, Version 2.0.
7
+ This package includes JOSE, JWT, JWS, and JWE helpers developed by ReallyMe LLC.
8
+ Except as otherwise noted, they are distributed under either the MIT License
9
+ or the Apache License, Version 2.0, at your option.
10
10
 
11
11
  Dependency license terms are recorded in the package manifests and enforced by
12
12
  the repository dependency policy.
package/README.md CHANGED
@@ -1,9 +1,3 @@
1
- <!--
2
- SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
3
-
4
- SPDX-License-Identifier: Apache-2.0
5
- -->
6
-
7
1
  # `@reallyme/jose`
8
2
 
9
3
  Production TypeScript bindings for the ReallyMe JOSE operation contract. JWS,
@@ -12,23 +6,41 @@ Rust, Swift, Kotlin/JVM, and Android packages.
12
6
 
13
7
  ## Provider setup
14
8
 
9
+ The following Node.js example loads the packaged WASM asset directly:
10
+
15
11
  ```ts
12
+ import { readFile } from "node:fs/promises";
16
13
  import {
17
14
  ReallyMeJose,
18
15
  installReallyMeJoseWasmProvider,
19
16
  } from "@reallyme/jose";
20
- import init, * as wasm from "@reallyme/jose/wasm/reallyme_jose_wasm.js";
17
+ import * as wasm from "@reallyme/jose/wasm/reallyme_jose_wasm.js";
21
18
 
22
- await init();
19
+ const module = await readFile(new URL(
20
+ import.meta.resolve("@reallyme/jose/wasm/reallyme_jose_wasm_bg.wasm"),
21
+ ));
22
+ wasm.initSync({ module });
23
23
  installReallyMeJoseWasmProvider(wasm);
24
24
 
25
- const compact = ReallyMeJose.encodeUnsignedJwt(claimsJsonBytes);
25
+ const claimsJsonBytes = new TextEncoder().encode('{"sub":"example"}');
26
+ try {
27
+ const compact = ReallyMeJose.encodeUnsignedJwt(claimsJsonBytes);
28
+ // This parses an unsigned JWT; it does not authenticate its claims.
29
+ const decoded = ReallyMeJose.decodeUnsignedJwt(compact);
30
+ decoded.fill(0);
31
+ } finally {
32
+ claimsJsonBytes.fill(0);
33
+ }
26
34
  ```
27
35
 
28
- Provider installation is explicit. Calls fail closed when no reviewed WASM
29
- provider is installed. Sensitive inputs are copied into bounded owners and
30
- cleared after dispatch; callers remain responsible for clearing their own
31
- `Uint8Array` values.
36
+ In a browser, serve the exported `.wasm` asset through your bundler, read it
37
+ into a `Uint8Array`, and call `wasm.initSync({ module: bytes })` before provider
38
+ installation. Node.js integrations require version 20.19 or newer.
39
+
40
+ Provider installation is explicit. Calls fail closed when no WASM provider is
41
+ installed; applications must select a trusted module. Sensitive inputs are
42
+ copied into bounded owners and cleared after dispatch; callers remain
43
+ responsible for clearing their own `Uint8Array` values.
32
44
 
33
45
  The WASM provider supports compact JWS with EdDSA and ES256, JWT with EdDSA,
34
46
  ES256, and ES256K, direct-key JWE with A128GCM/A192GCM/A256GCM, and ECDH-ES
@@ -38,8 +50,15 @@ performed.
38
50
 
39
51
  ## Raw WASM Module Contract
40
52
 
41
- The raw module exports only `executeOperation` and `executeOperationJson`.
53
+ The raw module exposes `executeOperation` and `executeOperationJson` as its
54
+ operation entrypoints, alongside WASM initialization exports.
42
55
  Direct raw WASM calls are unsupported for application logic. Applications
43
56
  should use `ReallyMeJose`, whose generated protobuf decoding, response-shape
44
57
  validation, typed errors, size limits, and cleanup rules form the supported
45
- API. The module has no ambient global crypto-provider functions.
58
+ API. Cryptographic operations stay inside WASM; the host supplies secure
59
+ randomness.
60
+
61
+ ## License
62
+
63
+ Licensed under either the MIT License or the Apache License, Version 2.0, at your
64
+ option. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
package/dist/boundary.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
  //
3
- // SPDX-License-Identifier: Apache-2.0
4
3
  import { ReallyMeJoseError } from "./errors.js";
5
4
  import { requireReallyMeJoseWasmProvider } from "./provider.js";
6
5
  import { ensureBytes, ensureIndependentBytes, MAX_JOSE_BINARY_REQUEST_BYTES, MAX_JOSE_JSON_REQUEST_BYTES, MAX_JOSE_RESPONSE_BYTES, } from "./validate.js";
package/dist/errors.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
  //
3
- // SPDX-License-Identifier: Apache-2.0
4
3
  /** Audit-safe SDK error. It never retains caller input or backend text. */
5
4
  export class ReallyMeJoseError extends Error {
6
5
  code;
package/dist/facade.js CHANGED
@@ -1,19 +1,28 @@
1
1
  // SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
  //
3
- // SPDX-License-Identifier: Apache-2.0
4
3
  import { create, fromBinary, toBinary } from "@bufbuild/protobuf";
5
4
  import { executeOperation } from "./boundary.js";
6
5
  import { ReallyMeJoseError } from "./errors.js";
7
6
  import { JoseErrorReason, JoseJweContentEncryptionAlgorithm, JoseJweKeyManagementAlgorithm, JoseOperationContractVersion, JoseOperationRequestSchema, JoseOperationResponseSchema, JoseSignatureAlgorithm, } from "./proto/generated/reallyme/jose/v1/jose_pb.js";
8
- import { ensureAggregateLength, ensureBoolean, ensureBytes, ensureString, ensureUint64, invalidInput, utf8Length, } from "./validate.js";
7
+ import { ensureAggregateLength, ensureBoolean, ensureBytes, ensureObject, ensureString, ensureUint64, invalidInput, utf8Length, } from "./validate.js";
9
8
  const MAX_JWT_ACCEPTED_TYPE_VALUES = 32;
10
9
  const PROTOBUF_REPEATED_STRING_OVERHEAD_BYTES = 5;
11
10
  const malformedProviderResponse = () => {
12
11
  throw new ReallyMeJoseError("malformed-provider-response");
13
12
  };
14
- const ownedBytes = (value) => {
13
+ const requireClean = (message) => {
14
+ if (message.$unknown !== undefined && message.$unknown.length !== 0) {
15
+ malformedProviderResponse();
16
+ }
17
+ };
18
+ const ownedBytes = (value, owners) => {
15
19
  ensureBytes(value);
16
- return value.slice();
20
+ ensureAggregateLength(value.length);
21
+ // Buffer.slice() aliases its input. Always construct a plain Uint8Array so
22
+ // cleanup cannot erase caller storage, including Node.js Buffer inputs.
23
+ const owned = new Uint8Array(value);
24
+ owners.push(owned);
25
+ return owned;
17
26
  };
18
27
  const optionalString = (value) => {
19
28
  if (value === undefined)
@@ -38,6 +47,9 @@ const validateAlgorithm = (value, allowed) => {
38
47
  invalidInput();
39
48
  };
40
49
  const throwJoseError = (error) => {
50
+ requireClean(error);
51
+ if (error.error.case !== undefined)
52
+ requireClean(error.error.value);
41
53
  const branch = error.error.case;
42
54
  const failWithReason = (publicBranch, reason, minimum, maximum) => {
43
55
  if (reason === JoseErrorReason.UNSPECIFIED ||
@@ -73,11 +85,13 @@ const withResponse = (request, consume) => {
73
85
  try {
74
86
  responseBytes = executeOperation(requestBytes);
75
87
  const response = decodeResponse(responseBytes);
88
+ requireClean(response);
76
89
  if (response.contractVersion !== JoseOperationContractVersion.V1) {
77
90
  malformedProviderResponse();
78
91
  }
79
92
  if (response.response.case === undefined)
80
- malformedProviderResponse();
93
+ return malformedProviderResponse();
94
+ requireClean(response.response.value);
81
95
  if (response.response.case === "boundaryError") {
82
96
  throwJoseError(response.response.value);
83
97
  }
@@ -92,6 +106,7 @@ const compactOutcome = (outcome) => {
92
106
  if (outcome.case === "error")
93
107
  return throwJoseError(outcome.value);
94
108
  if (outcome.case === "result") {
109
+ requireClean(outcome.value);
95
110
  ensureString(outcome.value.compact);
96
111
  if (outcome.value.compact.length === 0)
97
112
  return malformedProviderResponse();
@@ -102,8 +117,10 @@ const compactOutcome = (outcome) => {
102
117
  const claimsOutcome = (outcome) => {
103
118
  if (outcome.case === "error")
104
119
  return throwJoseError(outcome.value);
105
- if (outcome.case === "result")
106
- return outcome.value.claimsJson.slice();
120
+ if (outcome.case === "result") {
121
+ requireClean(outcome.value);
122
+ return new Uint8Array(outcome.value.claimsJson);
123
+ }
107
124
  return malformedProviderResponse();
108
125
  };
109
126
  const verifyOutcome = (outcome) => {
@@ -111,21 +128,27 @@ const verifyOutcome = (outcome) => {
111
128
  return throwJoseError(outcome.value);
112
129
  if (outcome.case !== "result")
113
130
  return malformedProviderResponse();
131
+ requireClean(outcome.value);
114
132
  };
115
133
  const plaintextOutcome = (outcome) => {
116
134
  if (outcome.case === "error")
117
135
  return throwJoseError(outcome.value);
118
- if (outcome.case === "result")
119
- return outcome.value.plaintext.slice();
136
+ if (outcome.case === "result") {
137
+ requireClean(outcome.value);
138
+ return new Uint8Array(outcome.value.plaintext);
139
+ }
120
140
  return malformedProviderResponse();
121
141
  };
122
142
  const jwtHeaderPolicy = (policy) => {
123
143
  if (policy === undefined)
124
144
  return undefined;
145
+ ensureObject(policy);
125
146
  if (policy.acceptedTypes !== undefined &&
126
147
  policy.acceptedTypes.length > MAX_JWT_ACCEPTED_TYPE_VALUES) {
127
148
  invalidInput();
128
149
  }
150
+ if (policy.acceptedTypes !== undefined && !Array.isArray(policy.acceptedTypes))
151
+ invalidInput();
129
152
  const acceptedTypes = policy.acceptedTypes === undefined ? [] : [...policy.acceptedTypes];
130
153
  for (const value of acceptedTypes)
131
154
  ensureString(value);
@@ -154,6 +177,7 @@ const jwtTemporalPolicyLength = (policy) => {
154
177
  const jwtTemporalPolicy = (policy) => {
155
178
  if (policy === undefined)
156
179
  return undefined;
180
+ ensureObject(policy);
157
181
  ensureUint64(policy.verificationTimeUnixSeconds);
158
182
  if (policy.verificationTimeUnixSeconds === 0n)
159
183
  invalidInput();
@@ -175,6 +199,7 @@ const jwtTemporalPolicy = (policy) => {
175
199
  const jweHeaderPolicy = (policy, ownedApu, ownedApv) => {
176
200
  if (policy === undefined)
177
201
  return undefined;
202
+ ensureObject(policy);
178
203
  return {
179
204
  requireKid: optionalBoolean(policy.requireKeyIdentifier, false),
180
205
  expectedKid: policy.expectedKeyIdentifier === undefined
@@ -192,10 +217,12 @@ const jweHeaderPolicy = (policy, ownedApu, ownedApv) => {
192
217
  };
193
218
  export const ReallyMeJose = Object.freeze({
194
219
  signJws(options) {
220
+ ensureObject(options);
195
221
  validateAlgorithm(options.algorithm, [JoseSignatureAlgorithm.EDDSA, JoseSignatureAlgorithm.ES256]);
196
- const privateKey = ownedBytes(options.privateKey);
197
- const payload = ownedBytes(options.payload);
222
+ const owners = [];
198
223
  try {
224
+ const privateKey = ownedBytes(options.privateKey, owners);
225
+ const payload = ownedBytes(options.payload, owners);
199
226
  ensureAggregateLength(privateKey.length, payload.length);
200
227
  const request = create(JoseOperationRequestSchema, {
201
228
  operation: { case: "jwsSign", value: { algorithm: options.algorithm, privateKey, payload } },
@@ -208,15 +235,17 @@ export const ReallyMeJose = Object.freeze({
208
235
  });
209
236
  }
210
237
  finally {
211
- privateKey.fill(0);
212
- payload.fill(0);
238
+ for (const owned of owners)
239
+ owned.fill(0);
213
240
  }
214
241
  },
215
242
  verifyJws(options) {
243
+ ensureObject(options);
216
244
  validateAlgorithm(options.algorithm, [JoseSignatureAlgorithm.EDDSA, JoseSignatureAlgorithm.ES256]);
217
245
  ensureString(options.compact);
218
- const publicKey = ownedBytes(options.publicKey);
246
+ const owners = [];
219
247
  try {
248
+ const publicKey = ownedBytes(options.publicKey, owners);
220
249
  ensureAggregateLength(utf8Length(options.compact), publicKey.length);
221
250
  const request = create(JoseOperationRequestSchema, {
222
251
  operation: {
@@ -232,12 +261,14 @@ export const ReallyMeJose = Object.freeze({
232
261
  });
233
262
  }
234
263
  finally {
235
- publicKey.fill(0);
264
+ for (const owned of owners)
265
+ owned.fill(0);
236
266
  }
237
267
  },
238
268
  encodeUnsignedJwt(claimsJson) {
239
- const claims = ownedBytes(claimsJson);
269
+ const owners = [];
240
270
  try {
271
+ const claims = ownedBytes(claimsJson, owners);
241
272
  ensureAggregateLength(claims.length);
242
273
  const request = create(JoseOperationRequestSchema, {
243
274
  operation: { case: "jwtEncodeUnsigned", value: { claimsJson: claims } },
@@ -251,7 +282,8 @@ export const ReallyMeJose = Object.freeze({
251
282
  });
252
283
  }
253
284
  finally {
254
- claims.fill(0);
285
+ for (const owned of owners)
286
+ owned.fill(0);
255
287
  }
256
288
  },
257
289
  decodeUnsignedJwt(compact) {
@@ -268,11 +300,13 @@ export const ReallyMeJose = Object.freeze({
268
300
  });
269
301
  },
270
302
  signJwt(options) {
271
- const claims = ownedBytes(options.claimsJson);
272
- const jwk = ownedBytes(options.jwkJson);
273
- const privateKey = ownedBytes(options.privateKey);
274
- const type = optionalString(options.type);
303
+ ensureObject(options);
304
+ const owners = [];
275
305
  try {
306
+ const claims = ownedBytes(options.claimsJson, owners);
307
+ const jwk = ownedBytes(options.jwkJson, owners);
308
+ const privateKey = ownedBytes(options.privateKey, owners);
309
+ const type = optionalString(options.type);
276
310
  ensureAggregateLength(claims.length, jwk.length, privateKey.length, utf8Length(type));
277
311
  const request = create(JoseOperationRequestSchema, {
278
312
  operation: {
@@ -288,16 +322,17 @@ export const ReallyMeJose = Object.freeze({
288
322
  });
289
323
  }
290
324
  finally {
291
- claims.fill(0);
292
- jwk.fill(0);
293
- privateKey.fill(0);
325
+ for (const owned of owners)
326
+ owned.fill(0);
294
327
  }
295
328
  },
296
329
  verifyJwt(options) {
330
+ ensureObject(options);
297
331
  ensureString(options.compact);
298
- const jwk = ownedBytes(options.jwkJson);
299
- const publicKey = ownedBytes(options.publicKey);
332
+ const owners = [];
300
333
  try {
334
+ const jwk = ownedBytes(options.jwkJson, owners);
335
+ const publicKey = ownedBytes(options.publicKey, owners);
301
336
  const headerPolicy = jwtHeaderPolicy(options.headerPolicy);
302
337
  const temporalPolicy = jwtTemporalPolicy(options.temporalPolicy);
303
338
  ensureAggregateLength(utf8Length(options.compact), jwk.length, publicKey.length, jwtHeaderPolicyLength(headerPolicy), jwtTemporalPolicyLength(temporalPolicy));
@@ -322,11 +357,12 @@ export const ReallyMeJose = Object.freeze({
322
357
  });
323
358
  }
324
359
  finally {
325
- jwk.fill(0);
326
- publicKey.fill(0);
360
+ for (const owned of owners)
361
+ owned.fill(0);
327
362
  }
328
363
  },
329
364
  encryptJwe(options) {
365
+ ensureObject(options);
330
366
  validateAlgorithm(options.keyManagementAlgorithm, [
331
367
  JoseJweKeyManagementAlgorithm.DIRECT,
332
368
  JoseJweKeyManagementAlgorithm.ECDH_ES_P256,
@@ -338,14 +374,15 @@ export const ReallyMeJose = Object.freeze({
338
374
  JoseJweContentEncryptionAlgorithm.A192GCM,
339
375
  JoseJweContentEncryptionAlgorithm.A256GCM,
340
376
  ]);
341
- const key = ownedBytes(options.key);
342
- const plaintext = ownedBytes(options.plaintext);
343
- const apu = ownedBytes(options.agreementPartyUInfo ?? new Uint8Array());
344
- const apv = ownedBytes(options.agreementPartyVInfo ?? new Uint8Array());
345
- const keyIdentifier = optionalString(options.keyIdentifier);
346
- const type = optionalString(options.type);
347
- const contentType = optionalString(options.contentType);
377
+ const owners = [];
348
378
  try {
379
+ const key = ownedBytes(options.key, owners);
380
+ const plaintext = ownedBytes(options.plaintext, owners);
381
+ const apu = ownedBytes(options.agreementPartyUInfo === undefined ? new Uint8Array() : options.agreementPartyUInfo, owners);
382
+ const apv = ownedBytes(options.agreementPartyVInfo === undefined ? new Uint8Array() : options.agreementPartyVInfo, owners);
383
+ const keyIdentifier = optionalString(options.keyIdentifier);
384
+ const type = optionalString(options.type);
385
+ const contentType = optionalString(options.contentType);
349
386
  ensureAggregateLength(key.length, plaintext.length, apu.length, apv.length, utf8Length(keyIdentifier), utf8Length(type), utf8Length(contentType));
350
387
  const request = create(JoseOperationRequestSchema, {
351
388
  operation: {
@@ -371,14 +408,15 @@ export const ReallyMeJose = Object.freeze({
371
408
  });
372
409
  }
373
410
  finally {
374
- key.fill(0);
375
- plaintext.fill(0);
376
- apu.fill(0);
377
- apv.fill(0);
411
+ for (const owned of owners)
412
+ owned.fill(0);
378
413
  }
379
414
  },
380
415
  decryptJwe(options) {
416
+ ensureObject(options);
381
417
  ensureString(options.compact);
418
+ if (options.headerPolicy !== undefined)
419
+ ensureObject(options.headerPolicy);
382
420
  validateAlgorithm(options.keyManagementAlgorithm, [
383
421
  JoseJweKeyManagementAlgorithm.DIRECT,
384
422
  JoseJweKeyManagementAlgorithm.ECDH_ES_P256,
@@ -390,14 +428,15 @@ export const ReallyMeJose = Object.freeze({
390
428
  JoseJweContentEncryptionAlgorithm.A192GCM,
391
429
  JoseJweContentEncryptionAlgorithm.A256GCM,
392
430
  ]);
393
- const key = ownedBytes(options.key);
394
- const expectedApu = options.headerPolicy?.expectedAgreementPartyUInfo === undefined
395
- ? undefined
396
- : ownedBytes(options.headerPolicy.expectedAgreementPartyUInfo);
397
- const expectedApv = options.headerPolicy?.expectedAgreementPartyVInfo === undefined
398
- ? undefined
399
- : ownedBytes(options.headerPolicy.expectedAgreementPartyVInfo);
431
+ const owners = [];
400
432
  try {
433
+ const key = ownedBytes(options.key, owners);
434
+ const expectedApu = options.headerPolicy?.expectedAgreementPartyUInfo === undefined
435
+ ? undefined
436
+ : ownedBytes(options.headerPolicy.expectedAgreementPartyUInfo, owners);
437
+ const expectedApv = options.headerPolicy?.expectedAgreementPartyVInfo === undefined
438
+ ? undefined
439
+ : ownedBytes(options.headerPolicy.expectedAgreementPartyVInfo, owners);
401
440
  ensureAggregateLength(utf8Length(options.compact), key.length, expectedApu?.length ?? 0, expectedApv?.length ?? 0, options.headerPolicy?.expectedKeyIdentifier === undefined
402
441
  ? 0
403
442
  : utf8Length(options.headerPolicy.expectedKeyIdentifier), options.headerPolicy?.expectedType === undefined
@@ -425,9 +464,8 @@ export const ReallyMeJose = Object.freeze({
425
464
  });
426
465
  }
427
466
  finally {
428
- key.fill(0);
429
- expectedApu?.fill(0);
430
- expectedApv?.fill(0);
467
+ for (const owned of owners)
468
+ owned.fill(0);
431
469
  }
432
470
  },
433
471
  });
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
  //
3
- // SPDX-License-Identifier: Apache-2.0
4
3
  export { executeOperation, executeOperationJson } from "./boundary.js";
5
4
  export { ReallyMeJoseError } from "./errors.js";
6
5
  export { ReallyMeJose } from "./facade.js";
package/dist/memory.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
  //
3
- // SPDX-License-Identifier: Apache-2.0
4
3
  import { invalidInput } from "./validate.js";
5
4
  /** Best-effort cleanup for caller-controlled mutable byte storage. */
6
5
  export const bestEffortClear = (value) => {
@@ -1,6 +1,5 @@
1
1
  // SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
  //
3
- // SPDX-License-Identifier: Apache-2.0
4
3
  import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
5
4
  /**
6
5
  * Describes the file reallyme/jose/v1/jose.proto.
package/dist/proto.js CHANGED
@@ -1,4 +1,3 @@
1
1
  // SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
  //
3
- // SPDX-License-Identifier: Apache-2.0
4
3
  export * from "./proto/generated/reallyme/jose/v1/jose_pb.js";
package/dist/provider.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
  //
3
- // SPDX-License-Identifier: Apache-2.0
4
3
  import { ReallyMeJoseError } from "./errors.js";
5
4
  let installedProvider;
6
5
  const requireObject = (value) => {
@@ -2,6 +2,7 @@ export declare const MAX_JOSE_BINARY_REQUEST_BYTES = 1048576;
2
2
  export declare const MAX_JOSE_JSON_REQUEST_BYTES = 1572864;
3
3
  export declare const MAX_JOSE_RESPONSE_BYTES = 1048608;
4
4
  export declare const invalidInput: () => never;
5
+ export declare const ensureObject: (value: unknown) => void;
5
6
  export declare const ensureBytes: (value: Uint8Array) => void;
6
7
  export declare const ensureString: (value: string) => void;
7
8
  export declare const ensureBoolean: (value: boolean) => void;
package/dist/validate.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
  //
3
- // SPDX-License-Identifier: Apache-2.0
4
3
  import { ReallyMeJoseError } from "./errors.js";
5
4
  export const MAX_JOSE_BINARY_REQUEST_BYTES = 1_048_576;
6
5
  export const MAX_JOSE_JSON_REQUEST_BYTES = 1_572_864;
@@ -8,6 +7,11 @@ export const MAX_JOSE_RESPONSE_BYTES = 1_048_608;
8
7
  export const invalidInput = () => {
9
8
  throw new ReallyMeJoseError("invalid-input");
10
9
  };
10
+ export const ensureObject = (value) => {
11
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
12
+ invalidInput();
13
+ }
14
+ };
11
15
  export const ensureBytes = (value) => {
12
16
  if (!(value instanceof Uint8Array)) {
13
17
  invalidInput();
package/dist/wasm/LICENSE CHANGED
@@ -1,3 +1,30 @@
1
+ Except as otherwise noted, this project is licensed under either the MIT
2
+ License or the Apache License, Version 2.0, at your option. Both license texts
3
+ are reproduced below. Third-party and vendored components retain their own
4
+ license notices and terms.
5
+
6
+ MIT License
7
+
8
+ Copyright (c) 2026 ReallyMe LLC
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
1
28
  Apache License
2
29
  Version 2.0, January 2004
3
30
  http://www.apache.org/licenses/
@@ -1,4 +1,3 @@
1
1
  // SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2
2
  //
3
- // SPDX-License-Identifier: Apache-2.0
4
3
  export {};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@reallyme/jose",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Strict JOSE, JWT, JWS, and JWE for TypeScript through the canonical ReallyMe Rust/WASM operation contract.",
5
- "license": "Apache-2.0",
5
+ "license": "MIT OR Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/reallyme/jose.git",