UNPKG

@dgac/nmb2b-client

Version:

EUROCONTROL Network Manager B2B SOAP client

95 lines (94 loc) 2.73 kB
import { Config } from "./config.mjs"; import { ISecurity } from "soap"; //#region src/security.d.ts /** * Security configuration using a PFX / PKCS #12 certificate. * Used to authenticate with the B2B services using a client certificate. */ interface PfxSecurity { /** * The content of the PFX / PKCS #12 file. */ pfx: Buffer; /** * The passphrase for the PFX / PKCS #12 container. */ passphrase: string; } /** * Security configuration using PEM certificate and key. * Used to authenticate with the B2B services using a client certificate. */ interface PemSecurity { /** * The content of the PEM certificate file. */ cert: Buffer; /** * The content of the PEM key file. */ key: Buffer; /** * The passphrase for the PEM key. * Can be omitted if the key is not encrypted. */ passphrase?: string; } /** * Security configuration using API Gateway credentials. * Used to authenticate with the B2B services using an API Key ID and Secret Key. * These credentials will be sent as Basic Authentication headers. */ interface ApiGwSecurity { /** * The API Key ID (used as username for Basic Auth). */ apiKeyId: string; /** * The API Secret Key (used as password for Basic Auth). */ apiSecretKey: string; } /** * Supported authentication methods. * Used in the `Config` object to specify how the client should authenticate with the B2B services. */ type Security = PfxSecurity | PemSecurity | ApiGwSecurity; /** * Asserts that the provided object is a valid {@link Security} configuration. * Checks for the presence and validity of required fields for each security type. * * @param obj - The object to validate. * @throws {AssertionError} If the object is not a valid `Security` configuration. */ declare function assertValidSecurity(obj: unknown): asserts obj is Security; /** * @deprecated Use {@link assertValidSecurity} instead. */ declare function isValidSecurity(obj: unknown): obj is Security; /** * @internal */ declare function prepareSecurity(config: Config): ISecurity; /** * Create a security objet from environment variables * * Will cache data for future use. * * @returns Security configuration */ declare function fromEnv(): Security; /** * Convenience function to clear the cached security objet */ declare function clearCache(): void; /** * Create a security objet from an environment-like object * * @param env Environment variables * @returns Security configuration */ declare function fromValues(env: Record<string, string | undefined>): Security; //#endregion export { Security, assertValidSecurity, clearCache, fromEnv, fromValues, isValidSecurity, prepareSecurity }; //# sourceMappingURL=security.d.mts.map