tom_core_secrets 0.1.0
tom_core_secrets: ^0.1.0 copied to clipboard
Cloud secret stores as secrets providers for Tom servers — configuration values written as secret:<provider>:<path>#<field> references, resolved at start and refreshed on rotation. One library per pro [...]
Changelog #
0.1.0 #
One package, tom_core_secrets, in tom_core_extensions: the three
providers that were the packages tom_core_secrets_aws, tom_core_secrets_azure
and tom_core_secrets_vault (deleted, with no re-export) are its libraries
aws.dart, azure.dart and vault.dart, and tom_core_secrets.dart exports all
three. Each provider's emulator suite has its own runner,
tool/run_<provider>_emulator_tests.sh.
-
aws.dart— AWS Secrets Manager, formerlytom_core_secrets_aws:-
The default client is resilient. Without an
httpClient,TomAwsSecretsProvidersends through the kernel'sTomResilientClientinstead of a barehttp.Client, so every call runs under its destination's policy — a timeout per attempt (30 seconds by default), retries for calls that may be repeated, a circuit breaker and a bulkhead — configured bytom_core_server'shttpClientkey.doc/aws_secrets.md§ The HTTP client. -
TomAwsSecretsProvider: aTomSecretsProviderover AWS Secrets Manager, registered asawsby default. A reference names the secret by name or ARN (secret:aws:prod/billing#password);fetchcallsGetSecretValueand answers theSecretString, or theSecretBinarydecoded as UTF-8, with theVersionId. Requests are signed withtom_core_server'sTomAwsV4Signerfor the servicesecretsmanager.callis the public signed client for any Secrets Manager action. -
TomAwsCredentialsSource: the credentials of each request, from a function — static keys, or a role's temporary credentials. -
TomAwsSecretsProvider.fromConfiguration: the provider from thesecrets.awsconfiguration key (region,accessKeyId,secretAccessKey,sessionToken,endpoint), each falling back toAWS_REGION/AWS_DEFAULT_REGION,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKENandAWS_ENDPOINT_URL_SECRETS_MANAGERin theenvironmentmap passed. Refusalssecrets.aws.config.missing_regionandsecrets.aws.config.missing_credentials. -
Failures are
TomSecretsExceptions keyedsecrets.fetch.not_found(aResourceNotFoundException),secrets.aws.binary_not_textandsecrets.fetch.failed, carrying AWS's own explanation and never a secret's value. -
example/aws_secrets_example.dart, theMockClientunit suite, theemulator-tagged suite against LocalStack andtool/run_aws_emulator_tests.sh, which runs it in Docker. -
README.md,doc/index.md,doc/aws_secrets.mdanddoc/api/api_summary_aws.md.
-
-
azure.dart— Azure Key Vault, formerlytom_core_secrets_azure:-
The default client is resilient. Without an
httpClient,TomAzureKeyVaultSecretsProvidersends through the kernel'sTomResilientClientinstead of a barehttp.Client, so every call runs under its destination's policy — a timeout per attempt (30 seconds by default), retries for calls that may be repeated, a circuit breaker and a bulkhead — configured bytom_core_server'shttpClientkey.doc/azure_secrets.md§ The HTTP client. -
TomAzureKeyVaultSecretsProvider: aTomSecretsProviderover the Azure Key Vault REST API (apiVersion7.4by default), registered asazure. A reference names the secret, optionally with a version (secret:azure:db-password,secret:azure:db-password/<version>, a JSON field with#<field>);fetchanswers the value with the version read from the secret's id.callis the public REST client; it sends the bearer token and, after a401, drops it and retries once with a fresh one. -
TomAzureKeyVaultSecretsProvider.fromConfiguration: the provider from thesecrets.azureconfiguration key (vaultUri,tenantId,clientId,clientSecret,managedIdentity), falling back toAZURE_KEYVAULT_URL,AZURE_TENANT_ID,AZURE_CLIENT_IDandAZURE_CLIENT_SECRETin theenvironmentmap passed. Refusalssecrets.azure.config.missing_vaultandsecrets.azure.config.missing_credentials. -
TomAzureCredentialand three implementations:TomAzureClientSecretCredential(the client-credentials grant at<authorityHost>/<tenant>/oauth2/v2.0/token, scopehttps://vault.azure.net/.default),TomAzureManagedIdentityCredential(the App Service / Container Apps identity endpoint withX-IDENTITY-HEADER, or the instance metadata endpoint withMetadata: true; system- or user-assigned) andTomAzureStaticTokenCredential. Fetched tokens are kept until five minutes before they expire (half their lifetime when that is ten minutes or less). A token endpoint that refuses or answers without a token issecrets.azure.token_failed. -
tomAzureKeyVaultScopeandtomAzureKeyVaultResource. -
Failures are
TomSecretsExceptions keyedsecrets.fetch.not_found(a404) andsecrets.fetch.failed, never carrying a secret's value. -
example/azure_secrets_example.dart, theMockClientunit suite, theemulator-tagged suite against Lowkey Vault andtool/run_azure_emulator_tests.sh, which runs it in Docker. -
README.md,doc/index.md,doc/azure_secrets.mdanddoc/api/api_summary_azure.md.
-
-
vault.dart— HashiCorp Vault, formerlytom_core_secrets_vault:-
The default client is resilient. Without an
httpClient,TomVaultSecretsProvidersends through the kernel'sTomResilientClientinstead of a barehttp.Client, so every call runs under its destination's policy — a timeout per attempt (30 seconds by default), retries for calls that may be repeated, a circuit breaker and a bulkhead — configured bytom_core_server'shttpClientkey.doc/vault_secrets.md§ The HTTP client. -
TomVaultSecretsProvider: aTomSecretsProviderover the HashiCorp Vault HTTP API, registered asvaultby default. A reference names the API path after/v1/(secret:vault:secret/data/billing#jwt);fetchreads KV version 2 entries with their version number, KV version 1 entries, and any engine whose response holds its values underdata.callis the public/v1/<path>client the auth methods log in through; it sendsX-Vault-Tokenand, when set,X-Vault-Namespace, and retries an authenticated call once with a fresh token after a403. -
TomVaultSecretsProvider.fromConfiguration: the provider from thesecrets.vaultconfiguration key (address,token,roleId,secretId,appRoleMount,namespace), each falling back toVAULT_ADDR,VAULT_TOKEN,VAULT_ROLE_ID,VAULT_SECRET_ID,VAULT_APPROLE_MOUNTandVAULT_NAMESPACEin theenvironmentmap passed; AppRole is preferred over a token. Refusalssecrets.vault.config.missing_addressandsecrets.vault.config.missing_credentials. -
TomVaultAuth,TomVaultTokenAuthandTomVaultAppRoleAuth: a fixed token, or AppRole login atauth/<mount>/loginwith the token kept for nine tenths of its lease (a lease of zero never expires) and dropped oninvalidate. A login answered without a client token issecrets.vault.login_failed. -
Failures are
TomSecretsExceptions keyedsecrets.fetch.not_found(a404) andsecrets.fetch.failed(an unreachable Vault, any other status, a body withoutdata), never carrying a secret's value. -
example/vault_secrets_example.dart, theMockClientunit suite, theemulator-tagged suite against a Vault dev server andtool/run_vault_emulator_tests.sh, which runs it in Docker. -
README.md,doc/index.md,doc/vault_secrets.mdanddoc/api/api_summary_vault.md.
-