@naylence/runtime 0.4.16 → 0.4.17

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.
@@ -525,12 +525,12 @@ async function ensureRuntimeFactoriesRegistered(registry = factory.Registry) {
525
525
  }
526
526
 
527
527
  // This file is auto-generated during build - do not edit manually
528
- // Generated from package.json version: 0.4.16
528
+ // Generated from package.json version: 0.4.17
529
529
  /**
530
530
  * The package version, injected at build time.
531
531
  * @internal
532
532
  */
533
- const VERSION = '0.4.16';
533
+ const VERSION = '0.4.17';
534
534
 
535
535
  let initialized = false;
536
536
  const runtimePlugin = {
@@ -4497,7 +4497,7 @@ function toHex(data) {
4497
4497
  .map((byte) => byte.toString(16).padStart(2, '0'))
4498
4498
  .join('');
4499
4499
  }
4500
- function toArrayBuffer$1(view) {
4500
+ function toArrayBuffer(view) {
4501
4501
  const slice = view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength);
4502
4502
  return slice;
4503
4503
  }
@@ -4553,11 +4553,11 @@ class StorageAESEncryptionManager {
4553
4553
  async encrypt(plaintext, key) {
4554
4554
  const subtle = await getSubtleCrypto();
4555
4555
  const normalizedKey = normalizeKey(key);
4556
- const keyBuffer = toArrayBuffer$1(normalizedKey);
4556
+ const keyBuffer = toArrayBuffer(normalizedKey);
4557
4557
  const cryptoKey = await subtle.importKey('raw', keyBuffer, { name: 'AES-GCM' }, false, ['encrypt']);
4558
4558
  const iv = await getRandomBytes$2(GCM_IV_LENGTH$1);
4559
- const ivBuffer = toArrayBuffer$1(iv);
4560
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, toArrayBuffer$1(plaintext));
4559
+ const ivBuffer = toArrayBuffer(iv);
4560
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, toArrayBuffer(plaintext));
4561
4561
  const ciphertext = new Uint8Array(ciphertextBuffer);
4562
4562
  const result = new Uint8Array(iv.length + ciphertext.length);
4563
4563
  result.set(iv, 0);
@@ -4570,12 +4570,12 @@ class StorageAESEncryptionManager {
4570
4570
  }
4571
4571
  const subtle = await getSubtleCrypto();
4572
4572
  const normalizedKey = normalizeKey(key);
4573
- const keyBuffer = toArrayBuffer$1(normalizedKey);
4573
+ const keyBuffer = toArrayBuffer(normalizedKey);
4574
4574
  const cryptoKey = await subtle.importKey('raw', keyBuffer, { name: 'AES-GCM' }, false, ['decrypt']);
4575
4575
  const iv = ciphertext.slice(0, GCM_IV_LENGTH$1);
4576
4576
  const actualCiphertext = ciphertext.slice(GCM_IV_LENGTH$1);
4577
- const ivBuffer = toArrayBuffer$1(iv);
4578
- const cipherBuffer = toArrayBuffer$1(actualCiphertext);
4577
+ const ivBuffer = toArrayBuffer(iv);
4578
+ const cipherBuffer = toArrayBuffer(actualCiphertext);
4579
4579
  const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, cipherBuffer);
4580
4580
  return new Uint8Array(plaintextBuffer);
4581
4581
  }
@@ -29371,11 +29371,6 @@ async function getRandomBytes$1(length) {
29371
29371
  }
29372
29372
  throw new Error('Unable to generate secure random bytes in this environment');
29373
29373
  }
29374
- function toArrayBuffer(data) {
29375
- const buffer = new ArrayBuffer(data.byteLength);
29376
- new Uint8Array(buffer).set(data);
29377
- return buffer;
29378
- }
29379
29374
  function base64Encode(data) {
29380
29375
  if (typeof btoa === 'function') {
29381
29376
  let binary = '';
@@ -29410,7 +29405,7 @@ async function deriveKEK(passphrase, salt, iterations) {
29410
29405
  const baseKey = await subtle.importKey('raw', UTF8_ENCODER.encode(passphrase), { name: 'PBKDF2' }, false, ['deriveKey']);
29411
29406
  return subtle.deriveKey({
29412
29407
  name: 'PBKDF2',
29413
- salt: toArrayBuffer(salt),
29408
+ salt: salt,
29414
29409
  iterations,
29415
29410
  hash: 'SHA-256',
29416
29411
  }, baseKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
@@ -29419,13 +29414,13 @@ async function aesGcmEncrypt(key, data) {
29419
29414
  const cryptoObject = await getCrypto();
29420
29415
  const subtle = cryptoObject.subtle;
29421
29416
  const iv = await getRandomBytes$1(GCM_IV_LENGTH);
29422
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
29417
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: iv }, key, data);
29423
29418
  return { iv, ciphertext: new Uint8Array(ciphertextBuffer) };
29424
29419
  }
29425
29420
  async function aesGcmDecrypt(key, iv, data) {
29426
29421
  const cryptoObject = await getCrypto();
29427
29422
  const subtle = cryptoObject.subtle;
29428
- const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
29423
+ const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: iv }, key, data);
29429
29424
  return new Uint8Array(plaintextBuffer);
29430
29425
  }
29431
29426
  async function openDatabase(factory, dbName, storeName) {
@@ -37640,11 +37635,14 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
37640
37635
  if (!shouldCreate) {
37641
37636
  return null;
37642
37637
  }
37643
- const tokenVerifier = new NoopTokenVerifier();
37644
- return ((await AuthorizerFactory.createAuthorizer(null, {
37645
- ...createOptions,
37646
- factoryArgs: [tokenVerifier],
37647
- })) ?? null);
37638
+ // If authorization is required but no config provided, return null
37639
+ // The caller should explicitly configure an authorizer with policy
37640
+ // rather than relying on auto-creation which requires policy config
37641
+ logger$h.debug('skipping_authorizer_auto_creation', {
37642
+ reason: 'no_config_provided',
37643
+ authorization_required: shouldCreate,
37644
+ });
37645
+ return null;
37648
37646
  }
37649
37647
  catch (error) {
37650
37648
  logger$h.error('failed_to_auto_create_authorizer', {
@@ -523,12 +523,12 @@ async function ensureRuntimeFactoriesRegistered(registry = Registry) {
523
523
  }
524
524
 
525
525
  // This file is auto-generated during build - do not edit manually
526
- // Generated from package.json version: 0.4.16
526
+ // Generated from package.json version: 0.4.17
527
527
  /**
528
528
  * The package version, injected at build time.
529
529
  * @internal
530
530
  */
531
- const VERSION = '0.4.16';
531
+ const VERSION = '0.4.17';
532
532
 
533
533
  let initialized = false;
534
534
  const runtimePlugin = {
@@ -4495,7 +4495,7 @@ function toHex(data) {
4495
4495
  .map((byte) => byte.toString(16).padStart(2, '0'))
4496
4496
  .join('');
4497
4497
  }
4498
- function toArrayBuffer$1(view) {
4498
+ function toArrayBuffer(view) {
4499
4499
  const slice = view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength);
4500
4500
  return slice;
4501
4501
  }
@@ -4551,11 +4551,11 @@ class StorageAESEncryptionManager {
4551
4551
  async encrypt(plaintext, key) {
4552
4552
  const subtle = await getSubtleCrypto();
4553
4553
  const normalizedKey = normalizeKey(key);
4554
- const keyBuffer = toArrayBuffer$1(normalizedKey);
4554
+ const keyBuffer = toArrayBuffer(normalizedKey);
4555
4555
  const cryptoKey = await subtle.importKey('raw', keyBuffer, { name: 'AES-GCM' }, false, ['encrypt']);
4556
4556
  const iv = await getRandomBytes$2(GCM_IV_LENGTH$1);
4557
- const ivBuffer = toArrayBuffer$1(iv);
4558
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, toArrayBuffer$1(plaintext));
4557
+ const ivBuffer = toArrayBuffer(iv);
4558
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, toArrayBuffer(plaintext));
4559
4559
  const ciphertext = new Uint8Array(ciphertextBuffer);
4560
4560
  const result = new Uint8Array(iv.length + ciphertext.length);
4561
4561
  result.set(iv, 0);
@@ -4568,12 +4568,12 @@ class StorageAESEncryptionManager {
4568
4568
  }
4569
4569
  const subtle = await getSubtleCrypto();
4570
4570
  const normalizedKey = normalizeKey(key);
4571
- const keyBuffer = toArrayBuffer$1(normalizedKey);
4571
+ const keyBuffer = toArrayBuffer(normalizedKey);
4572
4572
  const cryptoKey = await subtle.importKey('raw', keyBuffer, { name: 'AES-GCM' }, false, ['decrypt']);
4573
4573
  const iv = ciphertext.slice(0, GCM_IV_LENGTH$1);
4574
4574
  const actualCiphertext = ciphertext.slice(GCM_IV_LENGTH$1);
4575
- const ivBuffer = toArrayBuffer$1(iv);
4576
- const cipherBuffer = toArrayBuffer$1(actualCiphertext);
4575
+ const ivBuffer = toArrayBuffer(iv);
4576
+ const cipherBuffer = toArrayBuffer(actualCiphertext);
4577
4577
  const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, cipherBuffer);
4578
4578
  return new Uint8Array(plaintextBuffer);
4579
4579
  }
@@ -29369,11 +29369,6 @@ async function getRandomBytes$1(length) {
29369
29369
  }
29370
29370
  throw new Error('Unable to generate secure random bytes in this environment');
29371
29371
  }
29372
- function toArrayBuffer(data) {
29373
- const buffer = new ArrayBuffer(data.byteLength);
29374
- new Uint8Array(buffer).set(data);
29375
- return buffer;
29376
- }
29377
29372
  function base64Encode(data) {
29378
29373
  if (typeof btoa === 'function') {
29379
29374
  let binary = '';
@@ -29408,7 +29403,7 @@ async function deriveKEK(passphrase, salt, iterations) {
29408
29403
  const baseKey = await subtle.importKey('raw', UTF8_ENCODER.encode(passphrase), { name: 'PBKDF2' }, false, ['deriveKey']);
29409
29404
  return subtle.deriveKey({
29410
29405
  name: 'PBKDF2',
29411
- salt: toArrayBuffer(salt),
29406
+ salt: salt,
29412
29407
  iterations,
29413
29408
  hash: 'SHA-256',
29414
29409
  }, baseKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
@@ -29417,13 +29412,13 @@ async function aesGcmEncrypt(key, data) {
29417
29412
  const cryptoObject = await getCrypto();
29418
29413
  const subtle = cryptoObject.subtle;
29419
29414
  const iv = await getRandomBytes$1(GCM_IV_LENGTH);
29420
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
29415
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: iv }, key, data);
29421
29416
  return { iv, ciphertext: new Uint8Array(ciphertextBuffer) };
29422
29417
  }
29423
29418
  async function aesGcmDecrypt(key, iv, data) {
29424
29419
  const cryptoObject = await getCrypto();
29425
29420
  const subtle = cryptoObject.subtle;
29426
- const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
29421
+ const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: iv }, key, data);
29427
29422
  return new Uint8Array(plaintextBuffer);
29428
29423
  }
29429
29424
  async function openDatabase(factory, dbName, storeName) {
@@ -37638,11 +37633,14 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
37638
37633
  if (!shouldCreate) {
37639
37634
  return null;
37640
37635
  }
37641
- const tokenVerifier = new NoopTokenVerifier();
37642
- return ((await AuthorizerFactory.createAuthorizer(null, {
37643
- ...createOptions,
37644
- factoryArgs: [tokenVerifier],
37645
- })) ?? null);
37636
+ // If authorization is required but no config provided, return null
37637
+ // The caller should explicitly configure an authorizer with policy
37638
+ // rather than relying on auto-creation which requires policy config
37639
+ logger$h.debug('skipping_authorizer_auto_creation', {
37640
+ reason: 'no_config_provided',
37641
+ authorization_required: shouldCreate,
37642
+ });
37643
+ return null;
37646
37644
  }
37647
37645
  catch (error) {
37648
37646
  logger$h.error('failed_to_auto_create_authorizer', {
@@ -95,6 +95,7 @@ async function getRandomBytes(length) {
95
95
  }
96
96
  throw new Error('Unable to generate secure random bytes in this environment');
97
97
  }
98
+ // @ts-expect-error Kept for potential browser compatibility - Node.js prefers TypedArray
98
99
  function toArrayBuffer(data) {
99
100
  const buffer = new ArrayBuffer(data.byteLength);
100
101
  new Uint8Array(buffer).set(data);
@@ -134,7 +135,7 @@ async function deriveKEK(passphrase, salt, iterations) {
134
135
  const baseKey = await subtle.importKey('raw', UTF8_ENCODER.encode(passphrase), { name: 'PBKDF2' }, false, ['deriveKey']);
135
136
  return subtle.deriveKey({
136
137
  name: 'PBKDF2',
137
- salt: toArrayBuffer(salt),
138
+ salt: salt,
138
139
  iterations,
139
140
  hash: 'SHA-256',
140
141
  }, baseKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
@@ -143,13 +144,13 @@ async function aesGcmEncrypt(key, data) {
143
144
  const cryptoObject = await getCrypto();
144
145
  const subtle = cryptoObject.subtle;
145
146
  const iv = await getRandomBytes(GCM_IV_LENGTH);
146
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
147
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: iv }, key, data);
147
148
  return { iv, ciphertext: new Uint8Array(ciphertextBuffer) };
148
149
  }
149
150
  async function aesGcmDecrypt(key, iv, data) {
150
151
  const cryptoObject = await getCrypto();
151
152
  const subtle = cryptoObject.subtle;
152
- const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
153
+ const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: iv }, key, data);
153
154
  return new Uint8Array(plaintextBuffer);
154
155
  }
155
156
  async function openDatabase(factory, dbName, storeName) {
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DefaultSecurityManagerFactory = exports.FACTORY_META = void 0;
4
4
  const authorizer_factory_js_1 = require("./auth/authorizer-factory.js");
5
- const noop_token_verifier_js_1 = require("./auth/noop-token-verifier.js");
6
5
  const certificate_manager_factory_js_1 = require("./cert/certificate-manager-factory.js");
7
6
  const encryption_manager_factory_js_1 = require("./encryption/encryption-manager-factory.js");
8
7
  const secure_channel_manager_factory_js_1 = require("./encryption/secure-channel-manager-factory.js");
@@ -411,11 +410,14 @@ class DefaultSecurityManagerFactory extends security_manager_factory_js_1.Securi
411
410
  if (!shouldCreate) {
412
411
  return null;
413
412
  }
414
- const tokenVerifier = new noop_token_verifier_js_1.NoopTokenVerifier();
415
- return ((await authorizer_factory_js_1.AuthorizerFactory.createAuthorizer(null, {
416
- ...createOptions,
417
- factoryArgs: [tokenVerifier],
418
- })) ?? null);
413
+ // If authorization is required but no config provided, return null
414
+ // The caller should explicitly configure an authorizer with policy
415
+ // rather than relying on auto-creation which requires policy config
416
+ logger.debug('skipping_authorizer_auto_creation', {
417
+ reason: 'no_config_provided',
418
+ authorization_required: shouldCreate,
419
+ });
420
+ return null;
419
421
  }
420
422
  catch (error) {
421
423
  logger.error('failed_to_auto_create_authorizer', {
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  // This file is auto-generated during build - do not edit manually
3
- // Generated from package.json version: 0.4.16
3
+ // Generated from package.json version: 0.4.17
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.VERSION = void 0;
6
6
  /**
7
7
  * The package version, injected at build time.
8
8
  * @internal
9
9
  */
10
- exports.VERSION = '0.4.16';
10
+ exports.VERSION = '0.4.17';
@@ -58,6 +58,7 @@ async function getRandomBytes(length) {
58
58
  }
59
59
  throw new Error('Unable to generate secure random bytes in this environment');
60
60
  }
61
+ // @ts-expect-error Kept for potential browser compatibility - Node.js prefers TypedArray
61
62
  function toArrayBuffer(data) {
62
63
  const buffer = new ArrayBuffer(data.byteLength);
63
64
  new Uint8Array(buffer).set(data);
@@ -97,7 +98,7 @@ async function deriveKEK(passphrase, salt, iterations) {
97
98
  const baseKey = await subtle.importKey('raw', UTF8_ENCODER.encode(passphrase), { name: 'PBKDF2' }, false, ['deriveKey']);
98
99
  return subtle.deriveKey({
99
100
  name: 'PBKDF2',
100
- salt: toArrayBuffer(salt),
101
+ salt: salt,
101
102
  iterations,
102
103
  hash: 'SHA-256',
103
104
  }, baseKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
@@ -106,13 +107,13 @@ async function aesGcmEncrypt(key, data) {
106
107
  const cryptoObject = await getCrypto();
107
108
  const subtle = cryptoObject.subtle;
108
109
  const iv = await getRandomBytes(GCM_IV_LENGTH);
109
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
110
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: iv }, key, data);
110
111
  return { iv, ciphertext: new Uint8Array(ciphertextBuffer) };
111
112
  }
112
113
  async function aesGcmDecrypt(key, iv, data) {
113
114
  const cryptoObject = await getCrypto();
114
115
  const subtle = cryptoObject.subtle;
115
- const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
116
+ const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: iv }, key, data);
116
117
  return new Uint8Array(plaintextBuffer);
117
118
  }
118
119
  async function openDatabase(factory, dbName, storeName) {
@@ -1,5 +1,4 @@
1
1
  import { AuthorizerFactory } from './auth/authorizer-factory.js';
2
- import { NoopTokenVerifier } from './auth/noop-token-verifier.js';
3
2
  import { CertificateManagerFactory } from './cert/certificate-manager-factory.js';
4
3
  import { EncryptionManagerFactory } from './encryption/encryption-manager-factory.js';
5
4
  import { SecureChannelManagerFactory } from './encryption/secure-channel-manager-factory.js';
@@ -408,11 +407,14 @@ export class DefaultSecurityManagerFactory extends SecurityManagerFactory {
408
407
  if (!shouldCreate) {
409
408
  return null;
410
409
  }
411
- const tokenVerifier = new NoopTokenVerifier();
412
- return ((await AuthorizerFactory.createAuthorizer(null, {
413
- ...createOptions,
414
- factoryArgs: [tokenVerifier],
415
- })) ?? null);
410
+ // If authorization is required but no config provided, return null
411
+ // The caller should explicitly configure an authorizer with policy
412
+ // rather than relying on auto-creation which requires policy config
413
+ logger.debug('skipping_authorizer_auto_creation', {
414
+ reason: 'no_config_provided',
415
+ authorization_required: shouldCreate,
416
+ });
417
+ return null;
416
418
  }
417
419
  catch (error) {
418
420
  logger.error('failed_to_auto_create_authorizer', {
@@ -1,7 +1,7 @@
1
1
  // This file is auto-generated during build - do not edit manually
2
- // Generated from package.json version: 0.4.16
2
+ // Generated from package.json version: 0.4.17
3
3
  /**
4
4
  * The package version, injected at build time.
5
5
  * @internal
6
6
  */
7
- export const VERSION = '0.4.16';
7
+ export const VERSION = '0.4.17';
@@ -14,12 +14,12 @@ var fastify = require('fastify');
14
14
  var websocketPlugin = require('@fastify/websocket');
15
15
 
16
16
  // This file is auto-generated during build - do not edit manually
17
- // Generated from package.json version: 0.4.16
17
+ // Generated from package.json version: 0.4.17
18
18
  /**
19
19
  * The package version, injected at build time.
20
20
  * @internal
21
21
  */
22
- const VERSION = '0.4.16';
22
+ const VERSION = '0.4.17';
23
23
 
24
24
  /**
25
25
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -3959,7 +3959,7 @@ function toHex(data) {
3959
3959
  .map((byte) => byte.toString(16).padStart(2, '0'))
3960
3960
  .join('');
3961
3961
  }
3962
- function toArrayBuffer$1(view) {
3962
+ function toArrayBuffer(view) {
3963
3963
  const slice = view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength);
3964
3964
  return slice;
3965
3965
  }
@@ -4015,11 +4015,11 @@ class StorageAESEncryptionManager {
4015
4015
  async encrypt(plaintext, key) {
4016
4016
  const subtle = await getSubtleCrypto();
4017
4017
  const normalizedKey = normalizeKey(key);
4018
- const keyBuffer = toArrayBuffer$1(normalizedKey);
4018
+ const keyBuffer = toArrayBuffer(normalizedKey);
4019
4019
  const cryptoKey = await subtle.importKey('raw', keyBuffer, { name: 'AES-GCM' }, false, ['encrypt']);
4020
4020
  const iv = await getRandomBytes$2(GCM_IV_LENGTH$1);
4021
- const ivBuffer = toArrayBuffer$1(iv);
4022
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, toArrayBuffer$1(plaintext));
4021
+ const ivBuffer = toArrayBuffer(iv);
4022
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, toArrayBuffer(plaintext));
4023
4023
  const ciphertext = new Uint8Array(ciphertextBuffer);
4024
4024
  const result = new Uint8Array(iv.length + ciphertext.length);
4025
4025
  result.set(iv, 0);
@@ -4032,12 +4032,12 @@ class StorageAESEncryptionManager {
4032
4032
  }
4033
4033
  const subtle = await getSubtleCrypto();
4034
4034
  const normalizedKey = normalizeKey(key);
4035
- const keyBuffer = toArrayBuffer$1(normalizedKey);
4035
+ const keyBuffer = toArrayBuffer(normalizedKey);
4036
4036
  const cryptoKey = await subtle.importKey('raw', keyBuffer, { name: 'AES-GCM' }, false, ['decrypt']);
4037
4037
  const iv = ciphertext.slice(0, GCM_IV_LENGTH$1);
4038
4038
  const actualCiphertext = ciphertext.slice(GCM_IV_LENGTH$1);
4039
- const ivBuffer = toArrayBuffer$1(iv);
4040
- const cipherBuffer = toArrayBuffer$1(actualCiphertext);
4039
+ const ivBuffer = toArrayBuffer(iv);
4040
+ const cipherBuffer = toArrayBuffer(actualCiphertext);
4041
4041
  const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, cipherBuffer);
4042
4042
  return new Uint8Array(plaintextBuffer);
4043
4043
  }
@@ -29258,11 +29258,6 @@ async function getRandomBytes$1(length) {
29258
29258
  }
29259
29259
  throw new Error('Unable to generate secure random bytes in this environment');
29260
29260
  }
29261
- function toArrayBuffer(data) {
29262
- const buffer = new ArrayBuffer(data.byteLength);
29263
- new Uint8Array(buffer).set(data);
29264
- return buffer;
29265
- }
29266
29261
  function base64Encode(data) {
29267
29262
  if (typeof btoa === 'function') {
29268
29263
  let binary = '';
@@ -29297,7 +29292,7 @@ async function deriveKEK(passphrase, salt, iterations) {
29297
29292
  const baseKey = await subtle.importKey('raw', UTF8_ENCODER.encode(passphrase), { name: 'PBKDF2' }, false, ['deriveKey']);
29298
29293
  return subtle.deriveKey({
29299
29294
  name: 'PBKDF2',
29300
- salt: toArrayBuffer(salt),
29295
+ salt: salt,
29301
29296
  iterations,
29302
29297
  hash: 'SHA-256',
29303
29298
  }, baseKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
@@ -29306,13 +29301,13 @@ async function aesGcmEncrypt(key, data) {
29306
29301
  const cryptoObject = await getCrypto();
29307
29302
  const subtle = cryptoObject.subtle;
29308
29303
  const iv = await getRandomBytes$1(GCM_IV_LENGTH);
29309
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
29304
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: iv }, key, data);
29310
29305
  return { iv, ciphertext: new Uint8Array(ciphertextBuffer) };
29311
29306
  }
29312
29307
  async function aesGcmDecrypt(key, iv, data) {
29313
29308
  const cryptoObject = await getCrypto();
29314
29309
  const subtle = cryptoObject.subtle;
29315
- const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
29310
+ const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: iv }, key, data);
29316
29311
  return new Uint8Array(plaintextBuffer);
29317
29312
  }
29318
29313
  async function openDatabase(factory, dbName, storeName) {
@@ -36190,11 +36185,14 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
36190
36185
  if (!shouldCreate) {
36191
36186
  return null;
36192
36187
  }
36193
- const tokenVerifier = new NoopTokenVerifier();
36194
- return ((await AuthorizerFactory.createAuthorizer(null, {
36195
- ...createOptions,
36196
- factoryArgs: [tokenVerifier],
36197
- })) ?? null);
36188
+ // If authorization is required but no config provided, return null
36189
+ // The caller should explicitly configure an authorizer with policy
36190
+ // rather than relying on auto-creation which requires policy config
36191
+ logger$k.debug('skipping_authorizer_auto_creation', {
36192
+ reason: 'no_config_provided',
36193
+ authorization_required: shouldCreate,
36194
+ });
36195
+ return null;
36198
36196
  }
36199
36197
  catch (error) {
36200
36198
  logger$k.error('failed_to_auto_create_authorizer', {
@@ -13,12 +13,12 @@ import fastify from 'fastify';
13
13
  import websocketPlugin from '@fastify/websocket';
14
14
 
15
15
  // This file is auto-generated during build - do not edit manually
16
- // Generated from package.json version: 0.4.16
16
+ // Generated from package.json version: 0.4.17
17
17
  /**
18
18
  * The package version, injected at build time.
19
19
  * @internal
20
20
  */
21
- const VERSION = '0.4.16';
21
+ const VERSION = '0.4.17';
22
22
 
23
23
  /**
24
24
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -3958,7 +3958,7 @@ function toHex(data) {
3958
3958
  .map((byte) => byte.toString(16).padStart(2, '0'))
3959
3959
  .join('');
3960
3960
  }
3961
- function toArrayBuffer$1(view) {
3961
+ function toArrayBuffer(view) {
3962
3962
  const slice = view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength);
3963
3963
  return slice;
3964
3964
  }
@@ -4014,11 +4014,11 @@ class StorageAESEncryptionManager {
4014
4014
  async encrypt(plaintext, key) {
4015
4015
  const subtle = await getSubtleCrypto();
4016
4016
  const normalizedKey = normalizeKey(key);
4017
- const keyBuffer = toArrayBuffer$1(normalizedKey);
4017
+ const keyBuffer = toArrayBuffer(normalizedKey);
4018
4018
  const cryptoKey = await subtle.importKey('raw', keyBuffer, { name: 'AES-GCM' }, false, ['encrypt']);
4019
4019
  const iv = await getRandomBytes$2(GCM_IV_LENGTH$1);
4020
- const ivBuffer = toArrayBuffer$1(iv);
4021
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, toArrayBuffer$1(plaintext));
4020
+ const ivBuffer = toArrayBuffer(iv);
4021
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, toArrayBuffer(plaintext));
4022
4022
  const ciphertext = new Uint8Array(ciphertextBuffer);
4023
4023
  const result = new Uint8Array(iv.length + ciphertext.length);
4024
4024
  result.set(iv, 0);
@@ -4031,12 +4031,12 @@ class StorageAESEncryptionManager {
4031
4031
  }
4032
4032
  const subtle = await getSubtleCrypto();
4033
4033
  const normalizedKey = normalizeKey(key);
4034
- const keyBuffer = toArrayBuffer$1(normalizedKey);
4034
+ const keyBuffer = toArrayBuffer(normalizedKey);
4035
4035
  const cryptoKey = await subtle.importKey('raw', keyBuffer, { name: 'AES-GCM' }, false, ['decrypt']);
4036
4036
  const iv = ciphertext.slice(0, GCM_IV_LENGTH$1);
4037
4037
  const actualCiphertext = ciphertext.slice(GCM_IV_LENGTH$1);
4038
- const ivBuffer = toArrayBuffer$1(iv);
4039
- const cipherBuffer = toArrayBuffer$1(actualCiphertext);
4038
+ const ivBuffer = toArrayBuffer(iv);
4039
+ const cipherBuffer = toArrayBuffer(actualCiphertext);
4040
4040
  const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, cipherBuffer);
4041
4041
  return new Uint8Array(plaintextBuffer);
4042
4042
  }
@@ -29257,11 +29257,6 @@ async function getRandomBytes$1(length) {
29257
29257
  }
29258
29258
  throw new Error('Unable to generate secure random bytes in this environment');
29259
29259
  }
29260
- function toArrayBuffer(data) {
29261
- const buffer = new ArrayBuffer(data.byteLength);
29262
- new Uint8Array(buffer).set(data);
29263
- return buffer;
29264
- }
29265
29260
  function base64Encode(data) {
29266
29261
  if (typeof btoa === 'function') {
29267
29262
  let binary = '';
@@ -29296,7 +29291,7 @@ async function deriveKEK(passphrase, salt, iterations) {
29296
29291
  const baseKey = await subtle.importKey('raw', UTF8_ENCODER.encode(passphrase), { name: 'PBKDF2' }, false, ['deriveKey']);
29297
29292
  return subtle.deriveKey({
29298
29293
  name: 'PBKDF2',
29299
- salt: toArrayBuffer(salt),
29294
+ salt: salt,
29300
29295
  iterations,
29301
29296
  hash: 'SHA-256',
29302
29297
  }, baseKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
@@ -29305,13 +29300,13 @@ async function aesGcmEncrypt(key, data) {
29305
29300
  const cryptoObject = await getCrypto();
29306
29301
  const subtle = cryptoObject.subtle;
29307
29302
  const iv = await getRandomBytes$1(GCM_IV_LENGTH);
29308
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
29303
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: iv }, key, data);
29309
29304
  return { iv, ciphertext: new Uint8Array(ciphertextBuffer) };
29310
29305
  }
29311
29306
  async function aesGcmDecrypt(key, iv, data) {
29312
29307
  const cryptoObject = await getCrypto();
29313
29308
  const subtle = cryptoObject.subtle;
29314
- const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
29309
+ const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: iv }, key, data);
29315
29310
  return new Uint8Array(plaintextBuffer);
29316
29311
  }
29317
29312
  async function openDatabase(factory, dbName, storeName) {
@@ -36189,11 +36184,14 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
36189
36184
  if (!shouldCreate) {
36190
36185
  return null;
36191
36186
  }
36192
- const tokenVerifier = new NoopTokenVerifier();
36193
- return ((await AuthorizerFactory.createAuthorizer(null, {
36194
- ...createOptions,
36195
- factoryArgs: [tokenVerifier],
36196
- })) ?? null);
36187
+ // If authorization is required but no config provided, return null
36188
+ // The caller should explicitly configure an authorizer with policy
36189
+ // rather than relying on auto-creation which requires policy config
36190
+ logger$k.debug('skipping_authorizer_auto_creation', {
36191
+ reason: 'no_config_provided',
36192
+ authorization_required: shouldCreate,
36193
+ });
36194
+ return null;
36197
36195
  }
36198
36196
  catch (error) {
36199
36197
  logger$k.error('failed_to_auto_create_authorizer', {
@@ -4436,12 +4436,12 @@ async function ensureRuntimeFactoriesRegistered(registry = factory.Registry) {
4436
4436
  }
4437
4437
 
4438
4438
  // This file is auto-generated during build - do not edit manually
4439
- // Generated from package.json version: 0.4.16
4439
+ // Generated from package.json version: 0.4.17
4440
4440
  /**
4441
4441
  * The package version, injected at build time.
4442
4442
  * @internal
4443
4443
  */
4444
- const VERSION = '0.4.16';
4444
+ const VERSION = '0.4.17';
4445
4445
 
4446
4446
  let initialized = false;
4447
4447
  const runtimePlugin = {
@@ -30480,6 +30480,7 @@ async function getRandomBytes$1(length) {
30480
30480
  }
30481
30481
  throw new Error('Unable to generate secure random bytes in this environment');
30482
30482
  }
30483
+ // @ts-expect-error Kept for potential browser compatibility - Node.js prefers TypedArray
30483
30484
  function toArrayBuffer(data) {
30484
30485
  const buffer = new ArrayBuffer(data.byteLength);
30485
30486
  new Uint8Array(buffer).set(data);
@@ -30519,7 +30520,7 @@ async function deriveKEK(passphrase, salt, iterations) {
30519
30520
  const baseKey = await subtle.importKey('raw', UTF8_ENCODER.encode(passphrase), { name: 'PBKDF2' }, false, ['deriveKey']);
30520
30521
  return subtle.deriveKey({
30521
30522
  name: 'PBKDF2',
30522
- salt: toArrayBuffer(salt),
30523
+ salt: salt,
30523
30524
  iterations,
30524
30525
  hash: 'SHA-256',
30525
30526
  }, baseKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
@@ -30528,13 +30529,13 @@ async function aesGcmEncrypt(key, data) {
30528
30529
  const cryptoObject = await getCrypto();
30529
30530
  const subtle = cryptoObject.subtle;
30530
30531
  const iv = await getRandomBytes$1(GCM_IV_LENGTH);
30531
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
30532
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: iv }, key, data);
30532
30533
  return { iv, ciphertext: new Uint8Array(ciphertextBuffer) };
30533
30534
  }
30534
30535
  async function aesGcmDecrypt(key, iv, data) {
30535
30536
  const cryptoObject = await getCrypto();
30536
30537
  const subtle = cryptoObject.subtle;
30537
- const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
30538
+ const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: iv }, key, data);
30538
30539
  return new Uint8Array(plaintextBuffer);
30539
30540
  }
30540
30541
  async function openDatabase(factory, dbName, storeName) {
@@ -40949,11 +40950,14 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
40949
40950
  if (!shouldCreate) {
40950
40951
  return null;
40951
40952
  }
40952
- const tokenVerifier = new NoopTokenVerifier();
40953
- return ((await AuthorizerFactory.createAuthorizer(null, {
40954
- ...createOptions,
40955
- factoryArgs: [tokenVerifier],
40956
- })) ?? null);
40953
+ // If authorization is required but no config provided, return null
40954
+ // The caller should explicitly configure an authorizer with policy
40955
+ // rather than relying on auto-creation which requires policy config
40956
+ logger$e.debug('skipping_authorizer_auto_creation', {
40957
+ reason: 'no_config_provided',
40958
+ authorization_required: shouldCreate,
40959
+ });
40960
+ return null;
40957
40961
  }
40958
40962
  catch (error) {
40959
40963
  logger$e.error('failed_to_auto_create_authorizer', {
@@ -4435,12 +4435,12 @@ async function ensureRuntimeFactoriesRegistered(registry = Registry) {
4435
4435
  }
4436
4436
 
4437
4437
  // This file is auto-generated during build - do not edit manually
4438
- // Generated from package.json version: 0.4.16
4438
+ // Generated from package.json version: 0.4.17
4439
4439
  /**
4440
4440
  * The package version, injected at build time.
4441
4441
  * @internal
4442
4442
  */
4443
- const VERSION = '0.4.16';
4443
+ const VERSION = '0.4.17';
4444
4444
 
4445
4445
  let initialized = false;
4446
4446
  const runtimePlugin = {
@@ -30479,6 +30479,7 @@ async function getRandomBytes$1(length) {
30479
30479
  }
30480
30480
  throw new Error('Unable to generate secure random bytes in this environment');
30481
30481
  }
30482
+ // @ts-expect-error Kept for potential browser compatibility - Node.js prefers TypedArray
30482
30483
  function toArrayBuffer(data) {
30483
30484
  const buffer = new ArrayBuffer(data.byteLength);
30484
30485
  new Uint8Array(buffer).set(data);
@@ -30518,7 +30519,7 @@ async function deriveKEK(passphrase, salt, iterations) {
30518
30519
  const baseKey = await subtle.importKey('raw', UTF8_ENCODER.encode(passphrase), { name: 'PBKDF2' }, false, ['deriveKey']);
30519
30520
  return subtle.deriveKey({
30520
30521
  name: 'PBKDF2',
30521
- salt: toArrayBuffer(salt),
30522
+ salt: salt,
30522
30523
  iterations,
30523
30524
  hash: 'SHA-256',
30524
30525
  }, baseKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
@@ -30527,13 +30528,13 @@ async function aesGcmEncrypt(key, data) {
30527
30528
  const cryptoObject = await getCrypto();
30528
30529
  const subtle = cryptoObject.subtle;
30529
30530
  const iv = await getRandomBytes$1(GCM_IV_LENGTH);
30530
- const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
30531
+ const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: iv }, key, data);
30531
30532
  return { iv, ciphertext: new Uint8Array(ciphertextBuffer) };
30532
30533
  }
30533
30534
  async function aesGcmDecrypt(key, iv, data) {
30534
30535
  const cryptoObject = await getCrypto();
30535
30536
  const subtle = cryptoObject.subtle;
30536
- const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: toArrayBuffer(iv) }, key, toArrayBuffer(data));
30537
+ const plaintextBuffer = await subtle.decrypt({ name: 'AES-GCM', iv: iv }, key, data);
30537
30538
  return new Uint8Array(plaintextBuffer);
30538
30539
  }
30539
30540
  async function openDatabase(factory, dbName, storeName) {
@@ -40948,11 +40949,14 @@ class DefaultSecurityManagerFactory extends SecurityManagerFactory {
40948
40949
  if (!shouldCreate) {
40949
40950
  return null;
40950
40951
  }
40951
- const tokenVerifier = new NoopTokenVerifier();
40952
- return ((await AuthorizerFactory.createAuthorizer(null, {
40953
- ...createOptions,
40954
- factoryArgs: [tokenVerifier],
40955
- })) ?? null);
40952
+ // If authorization is required but no config provided, return null
40953
+ // The caller should explicitly configure an authorizer with policy
40954
+ // rather than relying on auto-creation which requires policy config
40955
+ logger$e.debug('skipping_authorizer_auto_creation', {
40956
+ reason: 'no_config_provided',
40957
+ authorization_required: shouldCreate,
40958
+ });
40959
+ return null;
40956
40960
  }
40957
40961
  catch (error) {
40958
40962
  logger$e.error('failed_to_auto_create_authorizer', {
@@ -2,4 +2,4 @@
2
2
  * The package version, injected at build time.
3
3
  * @internal
4
4
  */
5
- export declare const VERSION = "0.4.16";
5
+ export declare const VERSION = "0.4.17";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naylence/runtime",
3
- "version": "0.4.16",
3
+ "version": "0.4.17",
4
4
  "type": "module",
5
5
  "description": "Naylence Runtime - Complete TypeScript runtime",
6
6
  "author": "Naylence Dev <naylencedev@gmail.com>",