@naylence/runtime 0.3.5-test.920 → 0.3.5-test.922

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.
@@ -44,6 +44,8 @@ export { SECURITY_MANAGER_FACTORY_BASE_TYPE } from './security-manager-factory.j
44
44
  export * from './signing/envelope-signer.js';
45
45
  export * from './signing/envelope-verifier.js';
46
46
  export { SigningConfig as SigningConfigClass, } from './signing/signing-config.js';
47
+ export { canonicalJson, decodeBase64Url, frameDigest, immutableHeaders, } from './signing/eddsa-signer-verifier.js';
48
+ export { encodeUtf8, } from './signing/eddsa-utils.js';
47
49
  export * from './crypto/providers/crypto-provider.js';
48
50
  export * from './crypto/providers/default-crypto-provider.js';
49
51
  export * from './credential/credential-provider.js';
@@ -287,15 +287,22 @@ function getInitialLogLevel() {
287
287
  return LogLevel.OFF;
288
288
  }
289
289
  // Check FAME_LOG_LEVEL environment variable
290
- if (isNode && typeof process !== 'undefined' && process.env.FAME_LOG_LEVEL) {
290
+ let envLevel;
291
+ if (isNode && typeof process !== 'undefined') {
292
+ envLevel = process.env.FAME_LOG_LEVEL;
293
+ }
294
+ else if (typeof window !== 'undefined' && window.__ENV__) {
295
+ envLevel = window.__ENV__.FAME_LOG_LEVEL;
296
+ }
297
+ if (envLevel) {
291
298
  try {
292
- const envLevel = process.env.FAME_LOG_LEVEL.trim().toUpperCase();
299
+ const normalized = envLevel.trim().toUpperCase();
293
300
  // Direct enum name match (e.g., "DEBUG", "INFO")
294
- if (envLevel in LogLevel) {
295
- return LogLevel[envLevel];
301
+ if (normalized in LogLevel) {
302
+ return LogLevel[normalized];
296
303
  }
297
304
  // Try alternative mappings
298
- if (envLevel === 'WARN')
305
+ if (normalized === 'WARN')
299
306
  return LogLevel.WARNING;
300
307
  }
301
308
  catch {
@@ -1,7 +1,7 @@
1
1
  // This file is auto-generated during build - do not edit manually
2
- // Generated from package.json version: 0.3.5-test.920
2
+ // Generated from package.json version: 0.3.5-test.922
3
3
  /**
4
4
  * The package version, injected at build time.
5
5
  * @internal
6
6
  */
7
- export const VERSION = '0.3.5-test.920';
7
+ export const VERSION = '0.3.5-test.922';
@@ -14,12 +14,12 @@ var websocketPlugin = require('@fastify/websocket');
14
14
  var ed25519 = require('@noble/ed25519');
15
15
 
16
16
  // This file is auto-generated during build - do not edit manually
17
- // Generated from package.json version: 0.3.5-test.920
17
+ // Generated from package.json version: 0.3.5-test.922
18
18
  /**
19
19
  * The package version, injected at build time.
20
20
  * @internal
21
21
  */
22
- const VERSION = '0.3.5-test.920';
22
+ const VERSION = '0.3.5-test.922';
23
23
 
24
24
  /**
25
25
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -599,15 +599,22 @@ function getInitialLogLevel() {
599
599
  return exports.LogLevel.OFF;
600
600
  }
601
601
  // Check FAME_LOG_LEVEL environment variable
602
- if (isNode && typeof process !== 'undefined' && process.env.FAME_LOG_LEVEL) {
602
+ let envLevel;
603
+ if (isNode && typeof process !== 'undefined') {
604
+ envLevel = process.env.FAME_LOG_LEVEL;
605
+ }
606
+ else if (typeof window !== 'undefined' && window.__ENV__) {
607
+ envLevel = window.__ENV__.FAME_LOG_LEVEL;
608
+ }
609
+ if (envLevel) {
603
610
  try {
604
- const envLevel = process.env.FAME_LOG_LEVEL.trim().toUpperCase();
611
+ const normalized = envLevel.trim().toUpperCase();
605
612
  // Direct enum name match (e.g., "DEBUG", "INFO")
606
- if (envLevel in exports.LogLevel) {
607
- return exports.LogLevel[envLevel];
613
+ if (normalized in exports.LogLevel) {
614
+ return exports.LogLevel[normalized];
608
615
  }
609
616
  // Try alternative mappings
610
- if (envLevel === 'WARN')
617
+ if (normalized === 'WARN')
611
618
  return exports.LogLevel.WARNING;
612
619
  }
613
620
  catch {
@@ -25154,6 +25161,111 @@ class SigningConfig {
25154
25161
  }
25155
25162
  }
25156
25163
 
25164
+ function hasBuffer() {
25165
+ return typeof Buffer !== 'undefined';
25166
+ }
25167
+ function readStringProperty(source, ...names) {
25168
+ if (!source || typeof source !== 'object') {
25169
+ return undefined;
25170
+ }
25171
+ for (const name of names) {
25172
+ const value = source[name];
25173
+ if (typeof value === 'string' && value.length > 0) {
25174
+ return value;
25175
+ }
25176
+ }
25177
+ return undefined;
25178
+ }
25179
+ function decodePem(pem) {
25180
+ const base64 = pem
25181
+ .replace(/-----BEGIN[^-]+-----/g, '')
25182
+ .replace(/-----END[^-]+-----/g, '')
25183
+ .replace(/\s+/g, '');
25184
+ if (typeof atob === 'function') {
25185
+ const binary = atob(base64);
25186
+ const bytes = new Uint8Array(binary.length);
25187
+ for (let i = 0; i < binary.length; i += 1) {
25188
+ bytes[i] = binary.charCodeAt(i);
25189
+ }
25190
+ return bytes;
25191
+ }
25192
+ if (hasBuffer()) {
25193
+ return Uint8Array.from(Buffer.from(base64, 'base64'));
25194
+ }
25195
+ throw new Error('Base64 decoding is not available in this environment');
25196
+ }
25197
+ function readLength(data, offset) {
25198
+ const initial = data[offset];
25199
+ if (initial === undefined) {
25200
+ throw new Error('Unexpected end of ASN.1 data');
25201
+ }
25202
+ if ((initial & 0x80) === 0) {
25203
+ return { length: initial, nextOffset: offset + 1 };
25204
+ }
25205
+ const lengthOfLength = initial & 0x7f;
25206
+ if (lengthOfLength === 0 || lengthOfLength > 4) {
25207
+ throw new Error('Unsupported ASN.1 length encoding');
25208
+ }
25209
+ let length = 0;
25210
+ let position = offset + 1;
25211
+ for (let i = 0; i < lengthOfLength; i += 1) {
25212
+ const byte = data[position];
25213
+ if (byte === undefined) {
25214
+ throw new Error('Unexpected end of ASN.1 data');
25215
+ }
25216
+ length = (length << 8) | byte;
25217
+ position += 1;
25218
+ }
25219
+ return { length, nextOffset: position };
25220
+ }
25221
+ function readElement(data, offset, tag) {
25222
+ if (data[offset] !== tag) {
25223
+ throw new Error(`Unexpected ASN.1 tag: expected 0x${tag.toString(16)}, got 0x${(data[offset] ?? 0).toString(16)}`);
25224
+ }
25225
+ const { length, nextOffset } = readLength(data, offset + 1);
25226
+ const contentOffset = nextOffset;
25227
+ return {
25228
+ length,
25229
+ contentOffset,
25230
+ nextOffset: contentOffset + length,
25231
+ };
25232
+ }
25233
+ function parseEd25519PrivateKey(pem) {
25234
+ const raw = decodePem(pem);
25235
+ if (raw.length === 32) {
25236
+ return raw.slice();
25237
+ }
25238
+ // Handle PKCS#8 structure defined in RFC 8410
25239
+ const sequence = readElement(raw, 0, 0x30);
25240
+ const version = readElement(raw, sequence.contentOffset, 0x02);
25241
+ let offset = version.nextOffset;
25242
+ const algorithm = readElement(raw, offset, 0x30);
25243
+ offset = algorithm.nextOffset;
25244
+ const privateKey = readElement(raw, offset, 0x04);
25245
+ const privateContent = raw.subarray(privateKey.contentOffset, privateKey.contentOffset + privateKey.length);
25246
+ if (privateContent.length === 32) {
25247
+ return privateContent.slice();
25248
+ }
25249
+ if (privateContent.length >= 34 && privateContent[0] === 0x04) {
25250
+ const innerLength = privateContent[1];
25251
+ if (innerLength !== 32 || privateContent.length < innerLength + 2) {
25252
+ throw new Error('Unexpected Ed25519 private key length');
25253
+ }
25254
+ return privateContent.subarray(2, 34);
25255
+ }
25256
+ throw new Error('Unsupported Ed25519 private key structure');
25257
+ }
25258
+ const textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : undefined;
25259
+ function encodeUtf8(value) {
25260
+ if (textEncoder) {
25261
+ return textEncoder.encode(value);
25262
+ }
25263
+ if (hasBuffer()) {
25264
+ return Uint8Array.from(Buffer.from(value, 'utf8'));
25265
+ }
25266
+ throw new Error('No UTF-8 encoder available in this environment');
25267
+ }
25268
+
25157
25269
  const logger$x = getLogger('naylence.fame.security.auth.jwt_token_issuer');
25158
25270
  let joseModulePromise = null;
25159
25271
  async function requireJose() {
@@ -39259,111 +39371,6 @@ var sharedSecretTokenVerifier = /*#__PURE__*/Object.freeze({
39259
39371
  SharedSecretTokenVerifier: SharedSecretTokenVerifier
39260
39372
  });
39261
39373
 
39262
- function hasBuffer() {
39263
- return typeof Buffer !== 'undefined';
39264
- }
39265
- function readStringProperty(source, ...names) {
39266
- if (!source || typeof source !== 'object') {
39267
- return undefined;
39268
- }
39269
- for (const name of names) {
39270
- const value = source[name];
39271
- if (typeof value === 'string' && value.length > 0) {
39272
- return value;
39273
- }
39274
- }
39275
- return undefined;
39276
- }
39277
- function decodePem(pem) {
39278
- const base64 = pem
39279
- .replace(/-----BEGIN[^-]+-----/g, '')
39280
- .replace(/-----END[^-]+-----/g, '')
39281
- .replace(/\s+/g, '');
39282
- if (typeof atob === 'function') {
39283
- const binary = atob(base64);
39284
- const bytes = new Uint8Array(binary.length);
39285
- for (let i = 0; i < binary.length; i += 1) {
39286
- bytes[i] = binary.charCodeAt(i);
39287
- }
39288
- return bytes;
39289
- }
39290
- if (hasBuffer()) {
39291
- return Uint8Array.from(Buffer.from(base64, 'base64'));
39292
- }
39293
- throw new Error('Base64 decoding is not available in this environment');
39294
- }
39295
- function readLength(data, offset) {
39296
- const initial = data[offset];
39297
- if (initial === undefined) {
39298
- throw new Error('Unexpected end of ASN.1 data');
39299
- }
39300
- if ((initial & 0x80) === 0) {
39301
- return { length: initial, nextOffset: offset + 1 };
39302
- }
39303
- const lengthOfLength = initial & 0x7f;
39304
- if (lengthOfLength === 0 || lengthOfLength > 4) {
39305
- throw new Error('Unsupported ASN.1 length encoding');
39306
- }
39307
- let length = 0;
39308
- let position = offset + 1;
39309
- for (let i = 0; i < lengthOfLength; i += 1) {
39310
- const byte = data[position];
39311
- if (byte === undefined) {
39312
- throw new Error('Unexpected end of ASN.1 data');
39313
- }
39314
- length = (length << 8) | byte;
39315
- position += 1;
39316
- }
39317
- return { length, nextOffset: position };
39318
- }
39319
- function readElement(data, offset, tag) {
39320
- if (data[offset] !== tag) {
39321
- throw new Error(`Unexpected ASN.1 tag: expected 0x${tag.toString(16)}, got 0x${(data[offset] ?? 0).toString(16)}`);
39322
- }
39323
- const { length, nextOffset } = readLength(data, offset + 1);
39324
- const contentOffset = nextOffset;
39325
- return {
39326
- length,
39327
- contentOffset,
39328
- nextOffset: contentOffset + length,
39329
- };
39330
- }
39331
- function parseEd25519PrivateKey(pem) {
39332
- const raw = decodePem(pem);
39333
- if (raw.length === 32) {
39334
- return raw.slice();
39335
- }
39336
- // Handle PKCS#8 structure defined in RFC 8410
39337
- const sequence = readElement(raw, 0, 0x30);
39338
- const version = readElement(raw, sequence.contentOffset, 0x02);
39339
- let offset = version.nextOffset;
39340
- const algorithm = readElement(raw, offset, 0x30);
39341
- offset = algorithm.nextOffset;
39342
- const privateKey = readElement(raw, offset, 0x04);
39343
- const privateContent = raw.subarray(privateKey.contentOffset, privateKey.contentOffset + privateKey.length);
39344
- if (privateContent.length === 32) {
39345
- return privateContent.slice();
39346
- }
39347
- if (privateContent.length >= 34 && privateContent[0] === 0x04) {
39348
- const innerLength = privateContent[1];
39349
- if (innerLength !== 32 || privateContent.length < innerLength + 2) {
39350
- throw new Error('Unexpected Ed25519 private key length');
39351
- }
39352
- return privateContent.subarray(2, 34);
39353
- }
39354
- throw new Error('Unsupported Ed25519 private key structure');
39355
- }
39356
- const textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : undefined;
39357
- function encodeUtf8(value) {
39358
- if (textEncoder) {
39359
- return textEncoder.encode(value);
39360
- }
39361
- if (hasBuffer()) {
39362
- return Uint8Array.from(Buffer.from(value, 'utf8'));
39363
- }
39364
- throw new Error('No UTF-8 encoder available in this environment');
39365
- }
39366
-
39367
39374
  if (!ed25519.hashes.sha512) {
39368
39375
  ed25519.hashes.sha512 = (message) => sha2_js.sha512(message);
39369
39376
  }
@@ -39912,6 +39919,7 @@ exports.assertGrant = assertGrant;
39912
39919
  exports.basicConfig = basicConfig;
39913
39920
  exports.broadcastChannelGrantToConnectorConfig = broadcastChannelGrantToConnectorConfig;
39914
39921
  exports.camelToSnakeCase = camelToSnakeCase;
39922
+ exports.canonicalJson = canonicalJson;
39915
39923
  exports.capitalizeFirstLetter = capitalizeFirstLetter;
39916
39924
  exports.color = color;
39917
39925
  exports.compareCryptoLevels = compareCryptoLevels;
@@ -39931,12 +39939,14 @@ exports.createX25519Keypair = createX25519Keypair;
39931
39939
  exports.credentialToString = credentialToString;
39932
39940
  exports.currentTraceId = currentTraceId$1;
39933
39941
  exports.debounce = debounce;
39942
+ exports.decodeBase64Url = decodeBase64Url;
39934
39943
  exports.decodeFameDataPayload = decodeFameDataPayload;
39935
39944
  exports.deepMerge = deepMerge;
39936
39945
  exports.defaultJsonEncoder = defaultJsonEncoder;
39937
39946
  exports.delay = delay;
39938
39947
  exports.dropEmpty = dropEmpty;
39939
39948
  exports.enableLogging = enableLogging;
39949
+ exports.encodeUtf8 = encodeUtf8;
39940
39950
  exports.ensureRuntimeFactoriesRegistered = ensureRuntimeFactoriesRegistered;
39941
39951
  exports.extractId = extractId;
39942
39952
  exports.extractPoolAddressBase = extractPoolAddressBase;
@@ -39944,6 +39954,7 @@ exports.extractPoolBase = extractPoolBase;
39944
39954
  exports.filterKeysByUse = filterKeysByUse;
39945
39955
  exports.formatTimestamp = formatTimestamp;
39946
39956
  exports.formatTimestampForConsole = formatTimestampForConsole$1;
39957
+ exports.frameDigest = frameDigest;
39947
39958
  exports.getCurrentEnvelope = getCurrentEnvelope;
39948
39959
  exports.getFameRoot = getFameRoot;
39949
39960
  exports.getKeyProvider = getKeyProvider;
@@ -39953,6 +39964,7 @@ exports.hasCryptoSupport = hasCryptoSupport;
39953
39964
  exports.hostnameToLogical = hostnameToLogical;
39954
39965
  exports.hostnamesToLogicals = hostnamesToLogicals;
39955
39966
  exports.httpGrantToConnectorConfig = httpGrantToConnectorConfig;
39967
+ exports.immutableHeaders = immutableHeaders;
39956
39968
  exports.inPageGrantToConnectorConfig = inPageGrantToConnectorConfig;
39957
39969
  exports.isAuthInjectionStrategy = isAuthInjectionStrategy;
39958
39970
  exports.isBroadcastChannelConnectionGrant = isBroadcastChannelConnectionGrant;
@@ -13,12 +13,12 @@ import websocketPlugin from '@fastify/websocket';
13
13
  import { sign, hashes, verify } from '@noble/ed25519';
14
14
 
15
15
  // This file is auto-generated during build - do not edit manually
16
- // Generated from package.json version: 0.3.5-test.920
16
+ // Generated from package.json version: 0.3.5-test.922
17
17
  /**
18
18
  * The package version, injected at build time.
19
19
  * @internal
20
20
  */
21
- const VERSION = '0.3.5-test.920';
21
+ const VERSION = '0.3.5-test.922';
22
22
 
23
23
  /**
24
24
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -598,15 +598,22 @@ function getInitialLogLevel() {
598
598
  return LogLevel.OFF;
599
599
  }
600
600
  // Check FAME_LOG_LEVEL environment variable
601
- if (isNode && typeof process !== 'undefined' && process.env.FAME_LOG_LEVEL) {
601
+ let envLevel;
602
+ if (isNode && typeof process !== 'undefined') {
603
+ envLevel = process.env.FAME_LOG_LEVEL;
604
+ }
605
+ else if (typeof window !== 'undefined' && window.__ENV__) {
606
+ envLevel = window.__ENV__.FAME_LOG_LEVEL;
607
+ }
608
+ if (envLevel) {
602
609
  try {
603
- const envLevel = process.env.FAME_LOG_LEVEL.trim().toUpperCase();
610
+ const normalized = envLevel.trim().toUpperCase();
604
611
  // Direct enum name match (e.g., "DEBUG", "INFO")
605
- if (envLevel in LogLevel) {
606
- return LogLevel[envLevel];
612
+ if (normalized in LogLevel) {
613
+ return LogLevel[normalized];
607
614
  }
608
615
  // Try alternative mappings
609
- if (envLevel === 'WARN')
616
+ if (normalized === 'WARN')
610
617
  return LogLevel.WARNING;
611
618
  }
612
619
  catch {
@@ -25153,6 +25160,111 @@ class SigningConfig {
25153
25160
  }
25154
25161
  }
25155
25162
 
25163
+ function hasBuffer() {
25164
+ return typeof Buffer !== 'undefined';
25165
+ }
25166
+ function readStringProperty(source, ...names) {
25167
+ if (!source || typeof source !== 'object') {
25168
+ return undefined;
25169
+ }
25170
+ for (const name of names) {
25171
+ const value = source[name];
25172
+ if (typeof value === 'string' && value.length > 0) {
25173
+ return value;
25174
+ }
25175
+ }
25176
+ return undefined;
25177
+ }
25178
+ function decodePem(pem) {
25179
+ const base64 = pem
25180
+ .replace(/-----BEGIN[^-]+-----/g, '')
25181
+ .replace(/-----END[^-]+-----/g, '')
25182
+ .replace(/\s+/g, '');
25183
+ if (typeof atob === 'function') {
25184
+ const binary = atob(base64);
25185
+ const bytes = new Uint8Array(binary.length);
25186
+ for (let i = 0; i < binary.length; i += 1) {
25187
+ bytes[i] = binary.charCodeAt(i);
25188
+ }
25189
+ return bytes;
25190
+ }
25191
+ if (hasBuffer()) {
25192
+ return Uint8Array.from(Buffer.from(base64, 'base64'));
25193
+ }
25194
+ throw new Error('Base64 decoding is not available in this environment');
25195
+ }
25196
+ function readLength(data, offset) {
25197
+ const initial = data[offset];
25198
+ if (initial === undefined) {
25199
+ throw new Error('Unexpected end of ASN.1 data');
25200
+ }
25201
+ if ((initial & 0x80) === 0) {
25202
+ return { length: initial, nextOffset: offset + 1 };
25203
+ }
25204
+ const lengthOfLength = initial & 0x7f;
25205
+ if (lengthOfLength === 0 || lengthOfLength > 4) {
25206
+ throw new Error('Unsupported ASN.1 length encoding');
25207
+ }
25208
+ let length = 0;
25209
+ let position = offset + 1;
25210
+ for (let i = 0; i < lengthOfLength; i += 1) {
25211
+ const byte = data[position];
25212
+ if (byte === undefined) {
25213
+ throw new Error('Unexpected end of ASN.1 data');
25214
+ }
25215
+ length = (length << 8) | byte;
25216
+ position += 1;
25217
+ }
25218
+ return { length, nextOffset: position };
25219
+ }
25220
+ function readElement(data, offset, tag) {
25221
+ if (data[offset] !== tag) {
25222
+ throw new Error(`Unexpected ASN.1 tag: expected 0x${tag.toString(16)}, got 0x${(data[offset] ?? 0).toString(16)}`);
25223
+ }
25224
+ const { length, nextOffset } = readLength(data, offset + 1);
25225
+ const contentOffset = nextOffset;
25226
+ return {
25227
+ length,
25228
+ contentOffset,
25229
+ nextOffset: contentOffset + length,
25230
+ };
25231
+ }
25232
+ function parseEd25519PrivateKey(pem) {
25233
+ const raw = decodePem(pem);
25234
+ if (raw.length === 32) {
25235
+ return raw.slice();
25236
+ }
25237
+ // Handle PKCS#8 structure defined in RFC 8410
25238
+ const sequence = readElement(raw, 0, 0x30);
25239
+ const version = readElement(raw, sequence.contentOffset, 0x02);
25240
+ let offset = version.nextOffset;
25241
+ const algorithm = readElement(raw, offset, 0x30);
25242
+ offset = algorithm.nextOffset;
25243
+ const privateKey = readElement(raw, offset, 0x04);
25244
+ const privateContent = raw.subarray(privateKey.contentOffset, privateKey.contentOffset + privateKey.length);
25245
+ if (privateContent.length === 32) {
25246
+ return privateContent.slice();
25247
+ }
25248
+ if (privateContent.length >= 34 && privateContent[0] === 0x04) {
25249
+ const innerLength = privateContent[1];
25250
+ if (innerLength !== 32 || privateContent.length < innerLength + 2) {
25251
+ throw new Error('Unexpected Ed25519 private key length');
25252
+ }
25253
+ return privateContent.subarray(2, 34);
25254
+ }
25255
+ throw new Error('Unsupported Ed25519 private key structure');
25256
+ }
25257
+ const textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : undefined;
25258
+ function encodeUtf8(value) {
25259
+ if (textEncoder) {
25260
+ return textEncoder.encode(value);
25261
+ }
25262
+ if (hasBuffer()) {
25263
+ return Uint8Array.from(Buffer.from(value, 'utf8'));
25264
+ }
25265
+ throw new Error('No UTF-8 encoder available in this environment');
25266
+ }
25267
+
25156
25268
  const logger$x = getLogger('naylence.fame.security.auth.jwt_token_issuer');
25157
25269
  let joseModulePromise = null;
25158
25270
  async function requireJose() {
@@ -39258,111 +39370,6 @@ var sharedSecretTokenVerifier = /*#__PURE__*/Object.freeze({
39258
39370
  SharedSecretTokenVerifier: SharedSecretTokenVerifier
39259
39371
  });
39260
39372
 
39261
- function hasBuffer() {
39262
- return typeof Buffer !== 'undefined';
39263
- }
39264
- function readStringProperty(source, ...names) {
39265
- if (!source || typeof source !== 'object') {
39266
- return undefined;
39267
- }
39268
- for (const name of names) {
39269
- const value = source[name];
39270
- if (typeof value === 'string' && value.length > 0) {
39271
- return value;
39272
- }
39273
- }
39274
- return undefined;
39275
- }
39276
- function decodePem(pem) {
39277
- const base64 = pem
39278
- .replace(/-----BEGIN[^-]+-----/g, '')
39279
- .replace(/-----END[^-]+-----/g, '')
39280
- .replace(/\s+/g, '');
39281
- if (typeof atob === 'function') {
39282
- const binary = atob(base64);
39283
- const bytes = new Uint8Array(binary.length);
39284
- for (let i = 0; i < binary.length; i += 1) {
39285
- bytes[i] = binary.charCodeAt(i);
39286
- }
39287
- return bytes;
39288
- }
39289
- if (hasBuffer()) {
39290
- return Uint8Array.from(Buffer.from(base64, 'base64'));
39291
- }
39292
- throw new Error('Base64 decoding is not available in this environment');
39293
- }
39294
- function readLength(data, offset) {
39295
- const initial = data[offset];
39296
- if (initial === undefined) {
39297
- throw new Error('Unexpected end of ASN.1 data');
39298
- }
39299
- if ((initial & 0x80) === 0) {
39300
- return { length: initial, nextOffset: offset + 1 };
39301
- }
39302
- const lengthOfLength = initial & 0x7f;
39303
- if (lengthOfLength === 0 || lengthOfLength > 4) {
39304
- throw new Error('Unsupported ASN.1 length encoding');
39305
- }
39306
- let length = 0;
39307
- let position = offset + 1;
39308
- for (let i = 0; i < lengthOfLength; i += 1) {
39309
- const byte = data[position];
39310
- if (byte === undefined) {
39311
- throw new Error('Unexpected end of ASN.1 data');
39312
- }
39313
- length = (length << 8) | byte;
39314
- position += 1;
39315
- }
39316
- return { length, nextOffset: position };
39317
- }
39318
- function readElement(data, offset, tag) {
39319
- if (data[offset] !== tag) {
39320
- throw new Error(`Unexpected ASN.1 tag: expected 0x${tag.toString(16)}, got 0x${(data[offset] ?? 0).toString(16)}`);
39321
- }
39322
- const { length, nextOffset } = readLength(data, offset + 1);
39323
- const contentOffset = nextOffset;
39324
- return {
39325
- length,
39326
- contentOffset,
39327
- nextOffset: contentOffset + length,
39328
- };
39329
- }
39330
- function parseEd25519PrivateKey(pem) {
39331
- const raw = decodePem(pem);
39332
- if (raw.length === 32) {
39333
- return raw.slice();
39334
- }
39335
- // Handle PKCS#8 structure defined in RFC 8410
39336
- const sequence = readElement(raw, 0, 0x30);
39337
- const version = readElement(raw, sequence.contentOffset, 0x02);
39338
- let offset = version.nextOffset;
39339
- const algorithm = readElement(raw, offset, 0x30);
39340
- offset = algorithm.nextOffset;
39341
- const privateKey = readElement(raw, offset, 0x04);
39342
- const privateContent = raw.subarray(privateKey.contentOffset, privateKey.contentOffset + privateKey.length);
39343
- if (privateContent.length === 32) {
39344
- return privateContent.slice();
39345
- }
39346
- if (privateContent.length >= 34 && privateContent[0] === 0x04) {
39347
- const innerLength = privateContent[1];
39348
- if (innerLength !== 32 || privateContent.length < innerLength + 2) {
39349
- throw new Error('Unexpected Ed25519 private key length');
39350
- }
39351
- return privateContent.subarray(2, 34);
39352
- }
39353
- throw new Error('Unsupported Ed25519 private key structure');
39354
- }
39355
- const textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : undefined;
39356
- function encodeUtf8(value) {
39357
- if (textEncoder) {
39358
- return textEncoder.encode(value);
39359
- }
39360
- if (hasBuffer()) {
39361
- return Uint8Array.from(Buffer.from(value, 'utf8'));
39362
- }
39363
- throw new Error('No UTF-8 encoder available in this environment');
39364
- }
39365
-
39366
39373
  if (!hashes.sha512) {
39367
39374
  hashes.sha512 = (message) => sha512(message);
39368
39375
  }
@@ -39740,4 +39747,4 @@ var websocketTransportProvisioner = /*#__PURE__*/Object.freeze({
39740
39747
  WebSocketTransportProvisionerFactory: WebSocketTransportProvisionerFactory
39741
39748
  });
39742
39749
 
39743
- export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$_ as DEFAULT_WELCOME_FACTORY_META, DefaultCryptoProvider, DefaultKeyManager, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$1 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$$ as FACTORY_META, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, INPAGE_CONNECTION_GRANT_TYPE, INPAGE_CONNECTOR_TYPE, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenVerifierFactory, TransportProvisionerFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createLogicalUri, createNodeDeliveryContext, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, getCurrentEnvelope, getFameRoot, getKeyProvider, getKeyStore, getLogger, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, safeColor, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
39750
+ export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$_ as DEFAULT_WELCOME_FACTORY_META, DefaultCryptoProvider, DefaultKeyManager, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$1 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$$ as FACTORY_META, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, INPAGE_CONNECTION_GRANT_TYPE, INPAGE_CONNECTOR_TYPE, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenVerifierFactory, TransportProvisionerFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createLogicalUri, createNodeDeliveryContext, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFameRoot, getKeyProvider, getKeyStore, getLogger, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, safeColor, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };