@naylence/advanced-security 0.3.7-test.126 → 0.3.7-test.128
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/dist/browser/index.cjs +19 -68
- package/dist/browser/index.mjs +15 -64
- package/dist/cjs/naylence/fame/security/cert/default-certificate-manager-factory.js +6 -3
- package/dist/cjs/naylence/fame/security/cert/default-certificate-manager-factory.js.map +1 -1
- package/dist/cjs/naylence/fame/security/cert/default-certificate-manager.js +2 -18
- package/dist/cjs/naylence/fame/security/cert/default-certificate-manager.js.map +1 -1
- package/dist/cjs/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.js +1 -1
- package/dist/cjs/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.js.map +1 -1
- package/dist/cjs/naylence/fame/security/cert/trust-store/env-provider.js.map +1 -1
- package/dist/cjs/naylence/fame/security/cert/trust-store/http-bundle-provider.js.map +1 -1
- package/dist/cjs/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.js +1 -1
- package/dist/cjs/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.js.map +1 -1
- package/dist/cjs/naylence/fame/security/cert/trust-store/static-bundle-provider.js.map +1 -1
- package/dist/cjs/naylence/fame/security/signing/eddsa-envelope-verifier-factory.js +4 -3
- package/dist/cjs/naylence/fame/security/signing/eddsa-envelope-verifier-factory.js.map +1 -1
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/security/cert/default-certificate-manager-factory.js +6 -3
- package/dist/esm/naylence/fame/security/cert/default-certificate-manager-factory.js.map +1 -1
- package/dist/esm/naylence/fame/security/cert/default-certificate-manager.js +2 -18
- package/dist/esm/naylence/fame/security/cert/default-certificate-manager.js.map +1 -1
- package/dist/esm/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.js +1 -1
- package/dist/esm/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.js.map +1 -1
- package/dist/esm/naylence/fame/security/cert/trust-store/env-provider.js.map +1 -1
- package/dist/esm/naylence/fame/security/cert/trust-store/http-bundle-provider.js.map +1 -1
- package/dist/esm/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.js +1 -1
- package/dist/esm/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.js.map +1 -1
- package/dist/esm/naylence/fame/security/cert/trust-store/static-bundle-provider.js.map +1 -1
- package/dist/esm/naylence/fame/security/signing/eddsa-envelope-verifier-factory.js +4 -3
- package/dist/esm/naylence/fame/security/signing/eddsa-envelope-verifier-factory.js.map +1 -1
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +19 -68
- package/dist/node/index.mjs +15 -64
- package/dist/node/node.cjs +58 -68
- package/dist/node/node.mjs +59 -69
- package/dist/types/naylence/fame/security/cert/default-certificate-manager-factory.d.ts +1 -1
- package/dist/types/naylence/fame/security/cert/default-certificate-manager-factory.d.ts.map +1 -1
- package/dist/types/naylence/fame/security/cert/default-certificate-manager.d.ts.map +1 -1
- package/dist/types/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.d.ts +1 -2
- package/dist/types/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.d.ts.map +1 -1
- package/dist/types/naylence/fame/security/cert/trust-store/env-provider.d.ts +1 -1
- package/dist/types/naylence/fame/security/cert/trust-store/env-provider.d.ts.map +1 -1
- package/dist/types/naylence/fame/security/cert/trust-store/http-bundle-provider.d.ts +1 -1
- package/dist/types/naylence/fame/security/cert/trust-store/http-bundle-provider.d.ts.map +1 -1
- package/dist/types/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.d.ts +1 -2
- package/dist/types/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.d.ts.map +1 -1
- package/dist/types/naylence/fame/security/cert/trust-store/static-bundle-provider.d.ts +1 -1
- package/dist/types/naylence/fame/security/cert/trust-store/static-bundle-provider.d.ts.map +1 -1
- package/dist/types/naylence/fame/security/signing/eddsa-envelope-verifier-factory.d.ts +2 -2
- package/dist/types/naylence/fame/security/signing/eddsa-envelope-verifier-factory.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
package/dist/node/index.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var runtime = require('@naylence/runtime');
|
|
4
|
-
var factory = require('@naylence/factory');
|
|
5
4
|
var asn1Schema = require('@peculiar/asn1-schema');
|
|
6
5
|
var asn1Csr = require('@peculiar/asn1-csr');
|
|
7
6
|
var asn1X509 = require('@peculiar/asn1-x509');
|
|
@@ -13,16 +12,17 @@ var ed25519_js = require('@noble/curves/ed25519.js');
|
|
|
13
12
|
var hkdf_js = require('@noble/hashes/hkdf.js');
|
|
14
13
|
var utils_js = require('@noble/hashes/utils.js');
|
|
15
14
|
var jose = require('jose');
|
|
15
|
+
var factory = require('@naylence/factory');
|
|
16
16
|
var sha256_js = require('@noble/hashes/sha256.js');
|
|
17
17
|
var x509 = require('@peculiar/x509');
|
|
18
18
|
|
|
19
19
|
// This file is auto-generated during build - do not edit manually
|
|
20
|
-
// Generated from package.json version: 0.3.7-test.
|
|
20
|
+
// Generated from package.json version: 0.3.7-test.128
|
|
21
21
|
/**
|
|
22
22
|
* The package version, injected at build time.
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
25
|
-
const VERSION = '0.3.7-test.
|
|
25
|
+
const VERSION = '0.3.7-test.128';
|
|
26
26
|
|
|
27
27
|
const logger$h = runtime.getLogger("naylence.fame.security.cert.util");
|
|
28
28
|
const CACHE_LIMIT = 512;
|
|
@@ -3859,45 +3859,6 @@ class EdDSAEnvelopeVerifier {
|
|
|
3859
3859
|
}
|
|
3860
3860
|
}
|
|
3861
3861
|
|
|
3862
|
-
const DEFAULT_UNCONFIGURED_MESSAGE = "Trust store is not configured. Set FAME_CA_CERTS to a PEM value, a file path, a data URI, or an HTTPS bundle URL.";
|
|
3863
|
-
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = "TrustStoreProviderFactory";
|
|
3864
|
-
class TrustStoreProviderFactory extends factory.AbstractResourceFactory {
|
|
3865
|
-
createUnconfiguredProvider(reason) {
|
|
3866
|
-
return new NullTrustStoreProvider(reason ?? DEFAULT_UNCONFIGURED_MESSAGE);
|
|
3867
|
-
}
|
|
3868
|
-
static async createTrustStoreProvider(config, options = {}) {
|
|
3869
|
-
const { dependencies, factoryArgs, ...restOptions } = options;
|
|
3870
|
-
const mergedFactoryArgs = [
|
|
3871
|
-
...(dependencies ? [dependencies] : []),
|
|
3872
|
-
...(factoryArgs ?? []),
|
|
3873
|
-
];
|
|
3874
|
-
const creationOptions = {
|
|
3875
|
-
...restOptions,
|
|
3876
|
-
factoryArgs: mergedFactoryArgs,
|
|
3877
|
-
};
|
|
3878
|
-
if (config) {
|
|
3879
|
-
const instance = await factory.createResource(TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, config, creationOptions);
|
|
3880
|
-
return instance ?? new NullTrustStoreProvider();
|
|
3881
|
-
}
|
|
3882
|
-
const instance = await factory.createDefaultResource(TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, null, creationOptions);
|
|
3883
|
-
return instance ?? new NullTrustStoreProvider();
|
|
3884
|
-
}
|
|
3885
|
-
}
|
|
3886
|
-
class NullTrustStoreProvider {
|
|
3887
|
-
constructor(reason = DEFAULT_UNCONFIGURED_MESSAGE) {
|
|
3888
|
-
this.reason = reason;
|
|
3889
|
-
}
|
|
3890
|
-
async getTrustStorePem() {
|
|
3891
|
-
throw new Error(this.reason);
|
|
3892
|
-
}
|
|
3893
|
-
async getRoots() {
|
|
3894
|
-
return [];
|
|
3895
|
-
}
|
|
3896
|
-
async initialize() {
|
|
3897
|
-
// No-op for the placeholder provider.
|
|
3898
|
-
}
|
|
3899
|
-
}
|
|
3900
|
-
|
|
3901
3862
|
const FACTORY_META$8 = {
|
|
3902
3863
|
base: runtime.ENVELOPE_VERIFIER_FACTORY_BASE_TYPE,
|
|
3903
3864
|
key: "EdDSAEnvelopeVerifier",
|
|
@@ -3911,13 +3872,15 @@ class AdvancedEdDSAEnvelopeVerifierFactory extends runtime.EnvelopeVerifierFacto
|
|
|
3911
3872
|
this.isDefault = true;
|
|
3912
3873
|
this.priority = 100;
|
|
3913
3874
|
}
|
|
3914
|
-
async create(_config, keyProvider, signingConfig,
|
|
3875
|
+
async create(_config, keyProvider, signingConfig, ...factoryArgs) {
|
|
3915
3876
|
if (!keyProvider) {
|
|
3916
3877
|
throw new Error("EdDSAEnvelopeVerifierFactory requires a key provider");
|
|
3917
3878
|
}
|
|
3879
|
+
// Extract options from factoryArgs (third parameter after keyProvider and signingConfig)
|
|
3880
|
+
const options = factoryArgs[0] ?? {};
|
|
3918
3881
|
let trustStoreProvider = options.trustStoreProvider ?? null;
|
|
3919
3882
|
if (!trustStoreProvider) {
|
|
3920
|
-
trustStoreProvider = await TrustStoreProviderFactory.createTrustStoreProvider();
|
|
3883
|
+
trustStoreProvider = await runtime.TrustStoreProviderFactory.createTrustStoreProvider();
|
|
3921
3884
|
}
|
|
3922
3885
|
const resolved = {
|
|
3923
3886
|
signingConfig: options.signingConfig ?? signingConfig ?? new runtime.SigningConfigClass(),
|
|
@@ -8169,10 +8132,9 @@ class DefaultCertificateManager {
|
|
|
8169
8132
|
});
|
|
8170
8133
|
}
|
|
8171
8134
|
}
|
|
8172
|
-
const envPem = await resolveTrustStorePemFromEnvironment();
|
|
8173
8135
|
return {
|
|
8174
|
-
pem:
|
|
8175
|
-
reason:
|
|
8136
|
+
pem: null,
|
|
8137
|
+
reason: "trust_store_provider_unconfigured",
|
|
8176
8138
|
};
|
|
8177
8139
|
}
|
|
8178
8140
|
async resolveTrustStorePemFromProvider(provider, nodeId) {
|
|
@@ -8452,20 +8414,6 @@ function normalizeAuthConfig(candidate) {
|
|
|
8452
8414
|
}
|
|
8453
8415
|
return normalized;
|
|
8454
8416
|
}
|
|
8455
|
-
async function resolveTrustStorePemFromEnvironment() {
|
|
8456
|
-
try {
|
|
8457
|
-
const provider = await TrustStoreProviderFactory.createTrustStoreProvider();
|
|
8458
|
-
const pem = await provider.getTrustStorePem();
|
|
8459
|
-
return normalizePemOrNull(pem);
|
|
8460
|
-
}
|
|
8461
|
-
catch (error) {
|
|
8462
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
8463
|
-
logger$1.debug("trust_store_provider_resolution_failed", {
|
|
8464
|
-
error: message,
|
|
8465
|
-
});
|
|
8466
|
-
return null;
|
|
8467
|
-
}
|
|
8468
|
-
}
|
|
8469
8417
|
|
|
8470
8418
|
const FACTORY_META$2 = {
|
|
8471
8419
|
base: runtime.CERTIFICATE_MANAGER_FACTORY_BASE_TYPE,
|
|
@@ -8510,7 +8458,7 @@ function normalizeSigning(config, explicit) {
|
|
|
8510
8458
|
}
|
|
8511
8459
|
return null;
|
|
8512
8460
|
}
|
|
8513
|
-
function normalizeOptions(config, securitySettings, signing) {
|
|
8461
|
+
function normalizeOptions(config, securitySettings, signing, trustStorePem) {
|
|
8514
8462
|
const caServiceUrl = config.caServiceUrl ?? config.ca_service_url ?? null;
|
|
8515
8463
|
const cryptoProvider = config.cryptoProvider ?? config.crypto_provider ?? null;
|
|
8516
8464
|
return {
|
|
@@ -8518,6 +8466,7 @@ function normalizeOptions(config, securitySettings, signing) {
|
|
|
8518
8466
|
signing,
|
|
8519
8467
|
caServiceUrl,
|
|
8520
8468
|
cryptoProvider,
|
|
8469
|
+
trustStorePem,
|
|
8521
8470
|
};
|
|
8522
8471
|
}
|
|
8523
8472
|
class DefaultCertificateManagerFactory extends runtime.CertificateManagerFactory {
|
|
@@ -8527,11 +8476,13 @@ class DefaultCertificateManagerFactory extends runtime.CertificateManagerFactory
|
|
|
8527
8476
|
this.isDefault = true;
|
|
8528
8477
|
this.priority = 100;
|
|
8529
8478
|
}
|
|
8530
|
-
async create(config, securitySettings, signing, ...
|
|
8479
|
+
async create(config, securitySettings, signing, ...factoryArgs) {
|
|
8531
8480
|
const normalizedConfig = normalizeConfig(config);
|
|
8532
8481
|
const resolvedSecuritySettings = normalizeSecuritySettings(normalizedConfig, securitySettings ?? null);
|
|
8533
8482
|
const resolvedSigning = normalizeSigning(normalizedConfig, signing ?? null);
|
|
8534
|
-
|
|
8483
|
+
// Extract trust store PEM resolver from factoryArgs if provided
|
|
8484
|
+
const trustStorePemResolver = factoryArgs[0];
|
|
8485
|
+
const options = normalizeOptions(normalizedConfig, resolvedSecuritySettings, resolvedSigning, trustStorePemResolver ?? null);
|
|
8535
8486
|
return new DefaultCertificateManager(options);
|
|
8536
8487
|
}
|
|
8537
8488
|
}
|
|
@@ -9607,12 +9558,12 @@ function isNodeEnvironment$2() {
|
|
|
9607
9558
|
}
|
|
9608
9559
|
|
|
9609
9560
|
const FACTORY_META$1 = {
|
|
9610
|
-
base: TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
9561
|
+
base: runtime.TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
9611
9562
|
key: "BrowserTrustStoreProvider",
|
|
9612
9563
|
isDefault: !isNodeEnvironment$1(),
|
|
9613
9564
|
priority: !isNodeEnvironment$1() ? 100 : 10,
|
|
9614
9565
|
};
|
|
9615
|
-
class BrowserTrustStoreProviderFactory extends TrustStoreProviderFactory {
|
|
9566
|
+
class BrowserTrustStoreProviderFactory extends runtime.TrustStoreProviderFactory {
|
|
9616
9567
|
constructor() {
|
|
9617
9568
|
super(...arguments);
|
|
9618
9569
|
this.type = "BrowserTrustStoreProvider";
|
|
@@ -9689,12 +9640,12 @@ var browserTrustStoreProviderFactory = /*#__PURE__*/Object.freeze({
|
|
|
9689
9640
|
});
|
|
9690
9641
|
|
|
9691
9642
|
const FACTORY_META = {
|
|
9692
|
-
base: TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
9643
|
+
base: runtime.TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
9693
9644
|
key: "EnvTrustStoreProvider",
|
|
9694
9645
|
isDefault: isNodeEnvironment(),
|
|
9695
9646
|
priority: isNodeEnvironment() ? 100 : 0,
|
|
9696
9647
|
};
|
|
9697
|
-
class EnvTrustStoreProviderFactory extends TrustStoreProviderFactory {
|
|
9648
|
+
class EnvTrustStoreProviderFactory extends runtime.TrustStoreProviderFactory {
|
|
9698
9649
|
constructor() {
|
|
9699
9650
|
super(...arguments);
|
|
9700
9651
|
this.type = "EnvTrustStoreProvider";
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { getLogger, EncryptionResult, urlsafeBase64Decode, sealedDecrypt, sealedEncrypt, FIXED_PREFIX_LEN, urlsafeBase64Encode, EncryptionManagerFactory, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, requireCryptoSupport, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SecureChannelManagerFactory, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, EnvelopeSignerFactory, SigningConfigClass, validateSigningKey, JWKValidationError, decodeBase64Url, canonicalJson, secureDigest, frameDigest, immutableHeaders, encodeUtf8, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, EnvelopeVerifierFactory, TaskSpawner, getKeyStore, DefaultKeyManager, validateJwkComplete, currentTraceId, DeliveryOriginType, KEY_MANAGER_FACTORY_BASE_TYPE, KeyManagerFactory, KeyStoreFactory, BaseNodeEventListener, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, ReplicaStickinessManagerFactory, color, AnsiColor, validateHostLogicals, HTTP_CONNECTION_GRANT_TYPE, formatTimestamp, jsonDumps, WELCOME_SERVICE_FACTORY_BASE_TYPE, WelcomeServiceFactory, NodePlacementStrategyFactory, TransportProvisionerFactory, TokenIssuerFactory, AuthorizerFactory, validateHostLogical, AuthInjectionStrategyFactory, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CertificateManagerFactory } from '@naylence/runtime';
|
|
2
|
-
import { ExtensionManager, AbstractResourceFactory, createResource, createDefaultResource, Registry } from '@naylence/factory';
|
|
1
|
+
import { getLogger, EncryptionResult, urlsafeBase64Decode, sealedDecrypt, sealedEncrypt, FIXED_PREFIX_LEN, urlsafeBase64Encode, EncryptionManagerFactory, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, requireCryptoSupport, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SecureChannelManagerFactory, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, EnvelopeSignerFactory, SigningConfigClass, validateSigningKey, JWKValidationError, decodeBase64Url, canonicalJson, secureDigest, frameDigest, immutableHeaders, encodeUtf8, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, EnvelopeVerifierFactory, TrustStoreProviderFactory, TaskSpawner, getKeyStore, DefaultKeyManager, validateJwkComplete, currentTraceId, DeliveryOriginType, KEY_MANAGER_FACTORY_BASE_TYPE, KeyManagerFactory, KeyStoreFactory, BaseNodeEventListener, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, ReplicaStickinessManagerFactory, color, AnsiColor, validateHostLogicals, HTTP_CONNECTION_GRANT_TYPE, formatTimestamp, jsonDumps, WELCOME_SERVICE_FACTORY_BASE_TYPE, WelcomeServiceFactory, NodePlacementStrategyFactory, TransportProvisionerFactory, TokenIssuerFactory, AuthorizerFactory, validateHostLogical, AuthInjectionStrategyFactory, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CertificateManagerFactory, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE } from '@naylence/runtime';
|
|
3
2
|
import { AsnConvert, OctetString } from '@peculiar/asn1-schema';
|
|
4
3
|
import { Attributes, CertificationRequestInfo, CertificationRequest } from '@peculiar/asn1-csr';
|
|
5
4
|
import { Certificate, SubjectAlternativeName, NameConstraints, id_ce_subjectAltName, id_ce_nameConstraints, SubjectPublicKeyInfo, GeneralName, Extensions, Extension, Attribute, AlgorithmIdentifier, Name, RelativeDistinguishedName, AttributeTypeAndValue, AttributeValue, BasicConstraints, id_ce_basicConstraints, KeyUsageFlags, id_ce_keyUsage, KeyUsage, id_ce_subjectKeyIdentifier, SubjectKeyIdentifier, id_ce_authorityKeyIdentifier, AuthorityKeyIdentifier, KeyIdentifier, GeneralSubtrees, GeneralSubtree, TBSCertificate, Validity, Version, id_ce_extKeyUsage, ExtendedKeyUsage, id_kp_clientAuth, id_kp_serverAuth } from '@peculiar/asn1-x509';
|
|
@@ -11,16 +10,17 @@ import { x25519 } from '@noble/curves/ed25519.js';
|
|
|
11
10
|
import { hkdf } from '@noble/hashes/hkdf.js';
|
|
12
11
|
import { utf8ToBytes, randomBytes as randomBytes$1 } from '@noble/hashes/utils.js';
|
|
13
12
|
import { SignJWT, importPKCS8, compactVerify, importJWK, importSPKI } from 'jose';
|
|
13
|
+
import { ExtensionManager, Registry, AbstractResourceFactory } from '@naylence/factory';
|
|
14
14
|
import { sha256 as sha256$1 } from '@noble/hashes/sha256.js';
|
|
15
15
|
import { X509Certificate } from '@peculiar/x509';
|
|
16
16
|
|
|
17
17
|
// This file is auto-generated during build - do not edit manually
|
|
18
|
-
// Generated from package.json version: 0.3.7-test.
|
|
18
|
+
// Generated from package.json version: 0.3.7-test.128
|
|
19
19
|
/**
|
|
20
20
|
* The package version, injected at build time.
|
|
21
21
|
* @internal
|
|
22
22
|
*/
|
|
23
|
-
const VERSION = '0.3.7-test.
|
|
23
|
+
const VERSION = '0.3.7-test.128';
|
|
24
24
|
|
|
25
25
|
const logger$h = getLogger("naylence.fame.security.cert.util");
|
|
26
26
|
const CACHE_LIMIT = 512;
|
|
@@ -3857,45 +3857,6 @@ class EdDSAEnvelopeVerifier {
|
|
|
3857
3857
|
}
|
|
3858
3858
|
}
|
|
3859
3859
|
|
|
3860
|
-
const DEFAULT_UNCONFIGURED_MESSAGE = "Trust store is not configured. Set FAME_CA_CERTS to a PEM value, a file path, a data URI, or an HTTPS bundle URL.";
|
|
3861
|
-
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = "TrustStoreProviderFactory";
|
|
3862
|
-
class TrustStoreProviderFactory extends AbstractResourceFactory {
|
|
3863
|
-
createUnconfiguredProvider(reason) {
|
|
3864
|
-
return new NullTrustStoreProvider(reason ?? DEFAULT_UNCONFIGURED_MESSAGE);
|
|
3865
|
-
}
|
|
3866
|
-
static async createTrustStoreProvider(config, options = {}) {
|
|
3867
|
-
const { dependencies, factoryArgs, ...restOptions } = options;
|
|
3868
|
-
const mergedFactoryArgs = [
|
|
3869
|
-
...(dependencies ? [dependencies] : []),
|
|
3870
|
-
...(factoryArgs ?? []),
|
|
3871
|
-
];
|
|
3872
|
-
const creationOptions = {
|
|
3873
|
-
...restOptions,
|
|
3874
|
-
factoryArgs: mergedFactoryArgs,
|
|
3875
|
-
};
|
|
3876
|
-
if (config) {
|
|
3877
|
-
const instance = await createResource(TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, config, creationOptions);
|
|
3878
|
-
return instance ?? new NullTrustStoreProvider();
|
|
3879
|
-
}
|
|
3880
|
-
const instance = await createDefaultResource(TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, null, creationOptions);
|
|
3881
|
-
return instance ?? new NullTrustStoreProvider();
|
|
3882
|
-
}
|
|
3883
|
-
}
|
|
3884
|
-
class NullTrustStoreProvider {
|
|
3885
|
-
constructor(reason = DEFAULT_UNCONFIGURED_MESSAGE) {
|
|
3886
|
-
this.reason = reason;
|
|
3887
|
-
}
|
|
3888
|
-
async getTrustStorePem() {
|
|
3889
|
-
throw new Error(this.reason);
|
|
3890
|
-
}
|
|
3891
|
-
async getRoots() {
|
|
3892
|
-
return [];
|
|
3893
|
-
}
|
|
3894
|
-
async initialize() {
|
|
3895
|
-
// No-op for the placeholder provider.
|
|
3896
|
-
}
|
|
3897
|
-
}
|
|
3898
|
-
|
|
3899
3860
|
const FACTORY_META$8 = {
|
|
3900
3861
|
base: ENVELOPE_VERIFIER_FACTORY_BASE_TYPE,
|
|
3901
3862
|
key: "EdDSAEnvelopeVerifier",
|
|
@@ -3909,10 +3870,12 @@ class AdvancedEdDSAEnvelopeVerifierFactory extends EnvelopeVerifierFactory {
|
|
|
3909
3870
|
this.isDefault = true;
|
|
3910
3871
|
this.priority = 100;
|
|
3911
3872
|
}
|
|
3912
|
-
async create(_config, keyProvider, signingConfig,
|
|
3873
|
+
async create(_config, keyProvider, signingConfig, ...factoryArgs) {
|
|
3913
3874
|
if (!keyProvider) {
|
|
3914
3875
|
throw new Error("EdDSAEnvelopeVerifierFactory requires a key provider");
|
|
3915
3876
|
}
|
|
3877
|
+
// Extract options from factoryArgs (third parameter after keyProvider and signingConfig)
|
|
3878
|
+
const options = factoryArgs[0] ?? {};
|
|
3916
3879
|
let trustStoreProvider = options.trustStoreProvider ?? null;
|
|
3917
3880
|
if (!trustStoreProvider) {
|
|
3918
3881
|
trustStoreProvider = await TrustStoreProviderFactory.createTrustStoreProvider();
|
|
@@ -8167,10 +8130,9 @@ class DefaultCertificateManager {
|
|
|
8167
8130
|
});
|
|
8168
8131
|
}
|
|
8169
8132
|
}
|
|
8170
|
-
const envPem = await resolveTrustStorePemFromEnvironment();
|
|
8171
8133
|
return {
|
|
8172
|
-
pem:
|
|
8173
|
-
reason:
|
|
8134
|
+
pem: null,
|
|
8135
|
+
reason: "trust_store_provider_unconfigured",
|
|
8174
8136
|
};
|
|
8175
8137
|
}
|
|
8176
8138
|
async resolveTrustStorePemFromProvider(provider, nodeId) {
|
|
@@ -8450,20 +8412,6 @@ function normalizeAuthConfig(candidate) {
|
|
|
8450
8412
|
}
|
|
8451
8413
|
return normalized;
|
|
8452
8414
|
}
|
|
8453
|
-
async function resolveTrustStorePemFromEnvironment() {
|
|
8454
|
-
try {
|
|
8455
|
-
const provider = await TrustStoreProviderFactory.createTrustStoreProvider();
|
|
8456
|
-
const pem = await provider.getTrustStorePem();
|
|
8457
|
-
return normalizePemOrNull(pem);
|
|
8458
|
-
}
|
|
8459
|
-
catch (error) {
|
|
8460
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
8461
|
-
logger$1.debug("trust_store_provider_resolution_failed", {
|
|
8462
|
-
error: message,
|
|
8463
|
-
});
|
|
8464
|
-
return null;
|
|
8465
|
-
}
|
|
8466
|
-
}
|
|
8467
8415
|
|
|
8468
8416
|
const FACTORY_META$2 = {
|
|
8469
8417
|
base: CERTIFICATE_MANAGER_FACTORY_BASE_TYPE,
|
|
@@ -8508,7 +8456,7 @@ function normalizeSigning(config, explicit) {
|
|
|
8508
8456
|
}
|
|
8509
8457
|
return null;
|
|
8510
8458
|
}
|
|
8511
|
-
function normalizeOptions(config, securitySettings, signing) {
|
|
8459
|
+
function normalizeOptions(config, securitySettings, signing, trustStorePem) {
|
|
8512
8460
|
const caServiceUrl = config.caServiceUrl ?? config.ca_service_url ?? null;
|
|
8513
8461
|
const cryptoProvider = config.cryptoProvider ?? config.crypto_provider ?? null;
|
|
8514
8462
|
return {
|
|
@@ -8516,6 +8464,7 @@ function normalizeOptions(config, securitySettings, signing) {
|
|
|
8516
8464
|
signing,
|
|
8517
8465
|
caServiceUrl,
|
|
8518
8466
|
cryptoProvider,
|
|
8467
|
+
trustStorePem,
|
|
8519
8468
|
};
|
|
8520
8469
|
}
|
|
8521
8470
|
class DefaultCertificateManagerFactory extends CertificateManagerFactory {
|
|
@@ -8525,11 +8474,13 @@ class DefaultCertificateManagerFactory extends CertificateManagerFactory {
|
|
|
8525
8474
|
this.isDefault = true;
|
|
8526
8475
|
this.priority = 100;
|
|
8527
8476
|
}
|
|
8528
|
-
async create(config, securitySettings, signing, ...
|
|
8477
|
+
async create(config, securitySettings, signing, ...factoryArgs) {
|
|
8529
8478
|
const normalizedConfig = normalizeConfig(config);
|
|
8530
8479
|
const resolvedSecuritySettings = normalizeSecuritySettings(normalizedConfig, securitySettings ?? null);
|
|
8531
8480
|
const resolvedSigning = normalizeSigning(normalizedConfig, signing ?? null);
|
|
8532
|
-
|
|
8481
|
+
// Extract trust store PEM resolver from factoryArgs if provided
|
|
8482
|
+
const trustStorePemResolver = factoryArgs[0];
|
|
8483
|
+
const options = normalizeOptions(normalizedConfig, resolvedSecuritySettings, resolvedSigning, trustStorePemResolver ?? null);
|
|
8533
8484
|
return new DefaultCertificateManager(options);
|
|
8534
8485
|
}
|
|
8535
8486
|
}
|
package/dist/node/node.cjs
CHANGED
|
@@ -12,17 +12,17 @@ var chacha_js = require('@noble/ciphers/chacha.js');
|
|
|
12
12
|
var ed25519_js = require('@noble/curves/ed25519.js');
|
|
13
13
|
var hkdf_js = require('@noble/hashes/hkdf.js');
|
|
14
14
|
var utils_js = require('@noble/hashes/utils.js');
|
|
15
|
-
var factory = require('@naylence/factory');
|
|
16
15
|
var jose = require('jose');
|
|
16
|
+
var factory = require('@naylence/factory');
|
|
17
17
|
var sha256_js = require('@noble/hashes/sha256.js');
|
|
18
18
|
|
|
19
19
|
// This file is auto-generated during build - do not edit manually
|
|
20
|
-
// Generated from package.json version: 0.3.7-test.
|
|
20
|
+
// Generated from package.json version: 0.3.7-test.128
|
|
21
21
|
/**
|
|
22
22
|
* The package version, injected at build time.
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
25
|
-
const VERSION = '0.3.7-test.
|
|
25
|
+
const VERSION = '0.3.7-test.128';
|
|
26
26
|
|
|
27
27
|
const logger$h = runtime.getLogger("naylence.fame.security.cert.util");
|
|
28
28
|
const CACHE_LIMIT = 512;
|
|
@@ -3870,45 +3870,6 @@ class EdDSAEnvelopeVerifier {
|
|
|
3870
3870
|
}
|
|
3871
3871
|
}
|
|
3872
3872
|
|
|
3873
|
-
const DEFAULT_UNCONFIGURED_MESSAGE = "Trust store is not configured. Set FAME_CA_CERTS to a PEM value, a file path, a data URI, or an HTTPS bundle URL.";
|
|
3874
|
-
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = "TrustStoreProviderFactory";
|
|
3875
|
-
class TrustStoreProviderFactory extends factory.AbstractResourceFactory {
|
|
3876
|
-
createUnconfiguredProvider(reason) {
|
|
3877
|
-
return new NullTrustStoreProvider(reason ?? DEFAULT_UNCONFIGURED_MESSAGE);
|
|
3878
|
-
}
|
|
3879
|
-
static async createTrustStoreProvider(config, options = {}) {
|
|
3880
|
-
const { dependencies, factoryArgs, ...restOptions } = options;
|
|
3881
|
-
const mergedFactoryArgs = [
|
|
3882
|
-
...(dependencies ? [dependencies] : []),
|
|
3883
|
-
...(factoryArgs ?? []),
|
|
3884
|
-
];
|
|
3885
|
-
const creationOptions = {
|
|
3886
|
-
...restOptions,
|
|
3887
|
-
factoryArgs: mergedFactoryArgs,
|
|
3888
|
-
};
|
|
3889
|
-
if (config) {
|
|
3890
|
-
const instance = await factory.createResource(TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, config, creationOptions);
|
|
3891
|
-
return instance ?? new NullTrustStoreProvider();
|
|
3892
|
-
}
|
|
3893
|
-
const instance = await factory.createDefaultResource(TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, null, creationOptions);
|
|
3894
|
-
return instance ?? new NullTrustStoreProvider();
|
|
3895
|
-
}
|
|
3896
|
-
}
|
|
3897
|
-
class NullTrustStoreProvider {
|
|
3898
|
-
constructor(reason = DEFAULT_UNCONFIGURED_MESSAGE) {
|
|
3899
|
-
this.reason = reason;
|
|
3900
|
-
}
|
|
3901
|
-
async getTrustStorePem() {
|
|
3902
|
-
throw new Error(this.reason);
|
|
3903
|
-
}
|
|
3904
|
-
async getRoots() {
|
|
3905
|
-
return [];
|
|
3906
|
-
}
|
|
3907
|
-
async initialize() {
|
|
3908
|
-
// No-op for the placeholder provider.
|
|
3909
|
-
}
|
|
3910
|
-
}
|
|
3911
|
-
|
|
3912
3873
|
const FACTORY_META$9 = {
|
|
3913
3874
|
base: runtime.ENVELOPE_VERIFIER_FACTORY_BASE_TYPE,
|
|
3914
3875
|
key: "EdDSAEnvelopeVerifier",
|
|
@@ -3922,13 +3883,15 @@ class AdvancedEdDSAEnvelopeVerifierFactory extends runtime.EnvelopeVerifierFacto
|
|
|
3922
3883
|
this.isDefault = true;
|
|
3923
3884
|
this.priority = 100;
|
|
3924
3885
|
}
|
|
3925
|
-
async create(_config, keyProvider, signingConfig,
|
|
3886
|
+
async create(_config, keyProvider, signingConfig, ...factoryArgs) {
|
|
3926
3887
|
if (!keyProvider) {
|
|
3927
3888
|
throw new Error("EdDSAEnvelopeVerifierFactory requires a key provider");
|
|
3928
3889
|
}
|
|
3890
|
+
// Extract options from factoryArgs (third parameter after keyProvider and signingConfig)
|
|
3891
|
+
const options = factoryArgs[0] ?? {};
|
|
3929
3892
|
let trustStoreProvider = options.trustStoreProvider ?? null;
|
|
3930
3893
|
if (!trustStoreProvider) {
|
|
3931
|
-
trustStoreProvider = await TrustStoreProviderFactory.createTrustStoreProvider();
|
|
3894
|
+
trustStoreProvider = await runtime.TrustStoreProviderFactory.createTrustStoreProvider();
|
|
3932
3895
|
}
|
|
3933
3896
|
const resolved = {
|
|
3934
3897
|
signingConfig: options.signingConfig ?? signingConfig ?? new runtime.SigningConfigClass(),
|
|
@@ -7168,10 +7131,9 @@ class DefaultCertificateManager {
|
|
|
7168
7131
|
});
|
|
7169
7132
|
}
|
|
7170
7133
|
}
|
|
7171
|
-
const envPem = await resolveTrustStorePemFromEnvironment();
|
|
7172
7134
|
return {
|
|
7173
|
-
pem:
|
|
7174
|
-
reason:
|
|
7135
|
+
pem: null,
|
|
7136
|
+
reason: "trust_store_provider_unconfigured",
|
|
7175
7137
|
};
|
|
7176
7138
|
}
|
|
7177
7139
|
async resolveTrustStorePemFromProvider(provider, nodeId) {
|
|
@@ -7451,20 +7413,6 @@ function normalizeAuthConfig(candidate) {
|
|
|
7451
7413
|
}
|
|
7452
7414
|
return normalized;
|
|
7453
7415
|
}
|
|
7454
|
-
async function resolveTrustStorePemFromEnvironment() {
|
|
7455
|
-
try {
|
|
7456
|
-
const provider = await TrustStoreProviderFactory.createTrustStoreProvider();
|
|
7457
|
-
const pem = await provider.getTrustStorePem();
|
|
7458
|
-
return normalizePemOrNull(pem);
|
|
7459
|
-
}
|
|
7460
|
-
catch (error) {
|
|
7461
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
7462
|
-
logger$1.debug("trust_store_provider_resolution_failed", {
|
|
7463
|
-
error: message,
|
|
7464
|
-
});
|
|
7465
|
-
return null;
|
|
7466
|
-
}
|
|
7467
|
-
}
|
|
7468
7416
|
|
|
7469
7417
|
const FACTORY_META$4 = {
|
|
7470
7418
|
base: runtime.CERTIFICATE_MANAGER_FACTORY_BASE_TYPE,
|
|
@@ -7509,7 +7457,7 @@ function normalizeSigning(config, explicit) {
|
|
|
7509
7457
|
}
|
|
7510
7458
|
return null;
|
|
7511
7459
|
}
|
|
7512
|
-
function normalizeOptions(config, securitySettings, signing) {
|
|
7460
|
+
function normalizeOptions(config, securitySettings, signing, trustStorePem) {
|
|
7513
7461
|
const caServiceUrl = config.caServiceUrl ?? config.ca_service_url ?? null;
|
|
7514
7462
|
const cryptoProvider = config.cryptoProvider ?? config.crypto_provider ?? null;
|
|
7515
7463
|
return {
|
|
@@ -7517,6 +7465,7 @@ function normalizeOptions(config, securitySettings, signing) {
|
|
|
7517
7465
|
signing,
|
|
7518
7466
|
caServiceUrl,
|
|
7519
7467
|
cryptoProvider,
|
|
7468
|
+
trustStorePem,
|
|
7520
7469
|
};
|
|
7521
7470
|
}
|
|
7522
7471
|
class DefaultCertificateManagerFactory extends runtime.CertificateManagerFactory {
|
|
@@ -7526,11 +7475,13 @@ class DefaultCertificateManagerFactory extends runtime.CertificateManagerFactory
|
|
|
7526
7475
|
this.isDefault = true;
|
|
7527
7476
|
this.priority = 100;
|
|
7528
7477
|
}
|
|
7529
|
-
async create(config, securitySettings, signing, ...
|
|
7478
|
+
async create(config, securitySettings, signing, ...factoryArgs) {
|
|
7530
7479
|
const normalizedConfig = normalizeConfig$1(config);
|
|
7531
7480
|
const resolvedSecuritySettings = normalizeSecuritySettings(normalizedConfig, securitySettings ?? null);
|
|
7532
7481
|
const resolvedSigning = normalizeSigning(normalizedConfig, signing ?? null);
|
|
7533
|
-
|
|
7482
|
+
// Extract trust store PEM resolver from factoryArgs if provided
|
|
7483
|
+
const trustStorePemResolver = factoryArgs[0];
|
|
7484
|
+
const options = normalizeOptions(normalizedConfig, resolvedSecuritySettings, resolvedSigning, trustStorePemResolver ?? null);
|
|
7534
7485
|
return new DefaultCertificateManager(options);
|
|
7535
7486
|
}
|
|
7536
7487
|
}
|
|
@@ -7542,6 +7493,45 @@ var defaultCertificateManagerFactory = /*#__PURE__*/Object.freeze({
|
|
|
7542
7493
|
default: DefaultCertificateManagerFactory
|
|
7543
7494
|
});
|
|
7544
7495
|
|
|
7496
|
+
const DEFAULT_UNCONFIGURED_MESSAGE = "Trust store is not configured. Set FAME_CA_CERTS to a PEM value, a file path, a data URI, or an HTTPS bundle URL.";
|
|
7497
|
+
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = "TrustStoreProviderFactory";
|
|
7498
|
+
class TrustStoreProviderFactory extends factory.AbstractResourceFactory {
|
|
7499
|
+
createUnconfiguredProvider(reason) {
|
|
7500
|
+
return new NullTrustStoreProvider(reason ?? DEFAULT_UNCONFIGURED_MESSAGE);
|
|
7501
|
+
}
|
|
7502
|
+
static async createTrustStoreProvider(config, options = {}) {
|
|
7503
|
+
const { dependencies, factoryArgs, ...restOptions } = options;
|
|
7504
|
+
const mergedFactoryArgs = [
|
|
7505
|
+
...(dependencies ? [dependencies] : []),
|
|
7506
|
+
...(factoryArgs ?? []),
|
|
7507
|
+
];
|
|
7508
|
+
const creationOptions = {
|
|
7509
|
+
...restOptions,
|
|
7510
|
+
factoryArgs: mergedFactoryArgs,
|
|
7511
|
+
};
|
|
7512
|
+
if (config) {
|
|
7513
|
+
const instance = await factory.createResource(TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, config, creationOptions);
|
|
7514
|
+
return instance ?? new NullTrustStoreProvider();
|
|
7515
|
+
}
|
|
7516
|
+
const instance = await factory.createDefaultResource(TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, null, creationOptions);
|
|
7517
|
+
return instance ?? new NullTrustStoreProvider();
|
|
7518
|
+
}
|
|
7519
|
+
}
|
|
7520
|
+
class NullTrustStoreProvider {
|
|
7521
|
+
constructor(reason = DEFAULT_UNCONFIGURED_MESSAGE) {
|
|
7522
|
+
this.reason = reason;
|
|
7523
|
+
}
|
|
7524
|
+
async getTrustStorePem() {
|
|
7525
|
+
throw new Error(this.reason);
|
|
7526
|
+
}
|
|
7527
|
+
async getRoots() {
|
|
7528
|
+
return [];
|
|
7529
|
+
}
|
|
7530
|
+
async initialize() {
|
|
7531
|
+
// No-op for the placeholder provider.
|
|
7532
|
+
}
|
|
7533
|
+
}
|
|
7534
|
+
|
|
7545
7535
|
const PEM_HEADER = "-----BEGIN CERTIFICATE-----";
|
|
7546
7536
|
function normalizeLineEndings(value) {
|
|
7547
7537
|
return value.replace(/\r\n?/gu, "\n");
|
|
@@ -8618,12 +8608,12 @@ function isNodeEnvironment$2() {
|
|
|
8618
8608
|
}
|
|
8619
8609
|
|
|
8620
8610
|
const FACTORY_META$3 = {
|
|
8621
|
-
base: TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
8611
|
+
base: runtime.TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
8622
8612
|
key: "EnvTrustStoreProvider",
|
|
8623
8613
|
isDefault: isNodeEnvironment$1(),
|
|
8624
8614
|
priority: isNodeEnvironment$1() ? 100 : 0,
|
|
8625
8615
|
};
|
|
8626
|
-
class EnvTrustStoreProviderFactory extends TrustStoreProviderFactory {
|
|
8616
|
+
class EnvTrustStoreProviderFactory extends runtime.TrustStoreProviderFactory {
|
|
8627
8617
|
constructor() {
|
|
8628
8618
|
super(...arguments);
|
|
8629
8619
|
this.type = "EnvTrustStoreProvider";
|
|
@@ -8683,12 +8673,12 @@ var nodeTrustStoreProviderFactory = /*#__PURE__*/Object.freeze({
|
|
|
8683
8673
|
});
|
|
8684
8674
|
|
|
8685
8675
|
const FACTORY_META$2 = {
|
|
8686
|
-
base: TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
8676
|
+
base: runtime.TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
8687
8677
|
key: "BrowserTrustStoreProvider",
|
|
8688
8678
|
isDefault: !isNodeEnvironment(),
|
|
8689
8679
|
priority: !isNodeEnvironment() ? 100 : 10,
|
|
8690
8680
|
};
|
|
8691
|
-
class BrowserTrustStoreProviderFactory extends TrustStoreProviderFactory {
|
|
8681
|
+
class BrowserTrustStoreProviderFactory extends runtime.TrustStoreProviderFactory {
|
|
8692
8682
|
constructor() {
|
|
8693
8683
|
super(...arguments);
|
|
8694
8684
|
this.type = "BrowserTrustStoreProvider";
|