| title | Configuration reference |
|---|---|
| description | Every hardhat-kms config field: kms.keys, kms.defaults, kms.audit and kmsAccounts, the key forms per provider, validation and precedence. |
Audience: Users configuring the plugin.
Keys are declared once under kms.keys and referenced by name from any network. Each provider's keys need its provider package in plugins. This example uses one AWS KMS key, so it lists @hardhat-kms/aws, which loads hardhat-kms itself:
import hardhatKmsAws from "@hardhat-kms/aws";
import { configVariable, defineConfig } from "hardhat/config";
export default defineConfig({
plugins: [hardhatKmsAws],
kms: {
defaults: { aws: { region: "eu-west-1" }, timeoutMs: 30_000 },
keys: {
deployer: { provider: "aws", keyId: "alias/deployer" },
},
},
networks: {
sepolia: {
type: "http",
url: configVariable("SEPOLIA_RPC_URL"),
chainId: 11155111,
kmsAccounts: ["deployer"],
},
},
});Next, run npx hardhat kms accounts. It asks the KMS for the key's address and, for a key without a pin, prints a line to paste, such as kms.keys.deployer: address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", (kms accounts). Add that address line to the key:
deployer: {
provider: "aws",
keyId: "alias/deployer",
address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", // the address `kms accounts` printed
},The pin is optional and recommended: with it, the plugin refuses to sign if the key id ever names another key. For keys from several providers, see Use several keys across networks.
Set chainId on every HTTP network. The plugin checks the node's chain against it when the connection first reads the chain id, then caches that result. If the RPC endpoint changes chains, close the connection and reconnect.
A network's kmsAccounts lists key names or inline key objects. Use several keys across networks shows how to combine keys, providers and networks, and how to pick the sender. The full set of plugin config fields:
| Field | Meaning |
|---|---|
kms.keys |
Named keys, reused across networks. |
kms.defaults.aws.region |
Default AWS region, literal or a configuration variable (region precedence). |
kms.defaults.timeoutMs |
Default per-call timeout. Default 30 s. |
kms.allowCrossChainTypedData |
Allow typed data whose domain.chainId differs from the connection's chain, or in kms sign --data from the chain to compare with. Default false. Typed data without domain.chainId is always signed. |
kms.simulatedBalance |
A bigint in wei. On edr-simulated networks only, each new connection sets every KMS account's balance to this value with hardhat_setBalance, before the connection is returned. Addresses come from pins, or from key lookups, so connecting calls KMS for unpinned keys (pin addresses to avoid it); a failed lookup fails the connection. hardhat_reset clears the balances. |
kms.audit.azure.workspaceId |
The Log Analytics workspace id (a GUID) that kms history reads Azure Key Vault audit events from. Literal or a configuration variable. |
networks.<name>.kmsAccounts |
Key names or inline key objects for that network, on http and edr-simulated networks. |
address (per key) |
Optional address pin, required for a Turnkey key. Recommended: it guards against key substitution. Listing a network's accounts uses the pin without a KMS call. The first signature and the kms tasks still read the public key of an AWS, Google Cloud or Azure key, and fail if it derives to another address. A Turnkey key has no public key to read: its first signature is checked against the pin. |
allowRawDigests (per key) |
true lets the key sign raw 32-byte digests without a person at a terminal: kms sign --no-hash --yes, and library accounts from getAccount(address, { rawSign: true }) (Raw digests). Default false: kms sign --no-hash then asks at a terminal and refuses without one, and getAccount refuses rawSign. A raw digest can be a transaction, a permit or an EIP-7702 authorization, and the plugin cannot tell which, so set it only on a key that needs it. Keys from --kms have no config and cannot set it. Added in 1.3.0. |
allowedDelegates (per key) |
The contracts the key may delegate its account to with an EIP-7702 authorization, per chain, with an optional label and code hash. Unset: no limit. See Limit EIP-7702 delegates. Added in 1.3.0. |
timeoutMs (per key) |
Overrides the default timeout for that key. For a third-party provider where a person approves each signature, timeoutMs also bounds the wait for that approval: raise it on that key to cover the time a person takes to approve. |
When the default network has KMS keys, from kmsAccounts or from --kms without --network, the plugin prints a warning once per run: tasks and tests use that network when no --network is given, so they would call KMS. Put KMS keys on a named network instead.
The accepted key forms are a superset of Foundry's.
| Provider | Key forms |
|---|---|
aws |
keyId as a key id, key ARN, alias name or alias ARN. Optional region and profile, each literal or a configuration variable, and endpoint. |
gcp |
Either keyVersionName, or the components projectId, location, keyRing, keyName, keyVersion. The version is always required and never auto-selected. Optional protectionLevel. |
azure |
Either keyId (the full URL, versioned or not, including *.managedhsm.azure.net), or vaultUrl + keyName + optional keyVersion. An unversioned key is resolved once and the resulting version is pinned. |
turnkey |
organizationId, address and apiPrivateKey, all required, and optional apiPublicKey and transactionSigning. The API private key is a configuration variable only. |
AWS resolves the region in this order: the region inside an ARN, then key.region, then defaults.aws.region, then the SDK's own chain. A configured region that conflicts with the ARN's region is an error. AWS_ENDPOINT_URL_KMS (useful for LocalStack) is left to the AWS SDK, which honours it.
An AWS key's region and profile, and kms.defaults.aws.region, take a literal string or configVariable(...). A literal must be non-empty, with no surrounding spaces. A value from a configuration variable follows these rules:
- It is read when the key is first used, never when the config loads, and its surrounding spaces are trimmed.
- An empty value means the field is unset. An empty
regionfalls through todefaults.aws.region, then to the SDK's chain. An emptyprofileleaves the credentials to the SDK's chain, environment keys included. - An unset variable without a
defaultfails when the key is first used, with Hardhat's error that names the variable. WriteconfigVariable("AWS_KMS_PROFILE", { default: "" })to make the profile optional: a laptop sets the variable, CI leaves it unset. One config for a laptop and CI shows the pattern. - Errors and
kms accountsshow the variable as<VARIABLE_NAME>.kms historymasks its value as<hidden>, except a value shorter than 6 characters (security model).--show-idsprints the values in both tasks.
A Google Cloud key can set protectionLevel to the level its key version must have: "SOFTWARE", "HSM", "HSM_SINGLE_TENANT", "EXTERNAL" or "EXTERNAL_VPC", written as Cloud KMS names them. Any other value, such as "hsm", fails when the config loads with core.config.gcp-protection-level. The plugin reads the level from the GetPublicKey response, which it calls before the key's first signature whether or not the key has an address pin, and refuses a key version at another level, or one whose response names no level, with gcp.key.protection-level. Nothing is signed. Without the field, every level passes, and kms accounts still shows the level (kms accounts). Keys from --kms have no config and cannot set it. Added in 1.5.0.
A Turnkey key names a wallet account in a Turnkey organization, and the API key that signs with it. Set up a Turnkey wallet account creates both:
organizationIdis the organization or sub-organization that holds the account: a UUID, literal or a configuration variable. A literal that is not a UUID fails when the config loads withcore.config.turnkey-organization-id; a variable's value is checked when the key is first used.addressis required, and a key without it fails withcore.config.turnkey-address-required. It is the wallet account's address: the plugin sends it to Turnkey assignWith, with its EIP-55 checksum, and it is the key's pin.apiPrivateKeytakesconfigVariable(NAME)only, without adefaultor aformat, so the API private key is never written in the config. A literal string, adefaultor aformatfails validation withcore.config.secret-variable. Set the variable in the environment or inhardhat-keystoreto the private key of a P-256 Turnkey API key, 64 hex characters.apiPublicKeyis optional, literal or a configuration variable. The plugin derives the public key from the private key. WhenapiPublicKeyis set, the plugin checks that the two match before it sends any request.transactionSigningis"transaction"(the default) or"digest". With"transaction", each transaction goes to Turnkey'ssign_transactionactivity, so Turnkey's policies can read its fields (eth.tx.*). With"digest", the plugin sends the transaction's 32-byte hash throughsign_raw_payloadwithHASH_FUNCTION_NO_OP, as Foundry does. Use"digest"for a key whose policy is shared with Foundry and allows onlySIGN_RAW_PAYLOAD; see Turnkey transaction signing. Any other value fails when the config loads.
As for the other built-in providers, an unknown field fails at the key's path, such as config.kms.keys.deployer: Unrecognized key(s) in object: 'baseUrl', not at the field. There is no field for Turnkey's API URL: the plugin always calls https://api.turnkey.com.
A Turnkey key signs through @hardhat-kms/turnkey. Its display id is turnkey:<organizationId>/<address>, with an organization id from a variable shown as <VARIABLE_NAME> unless --show-ids is given. The API keys are never shown, even with --show-ids. --kms does not read Turnkey keys.
--kms aws keys have no region of their own, so they use kms.defaults.aws.region, including one from a configuration variable.
Identifiers are not secrets. Every identifier field still accepts string | ConfigurationVariable. A value that came from a variable is displayed as <VARIABLE_NAME> unless the user passes --show-ids.
Third-party providers extend the config types through the declaration-merged KmsProviderUserConfigs interface (optional, for provider authors: Provider contract in the contributor docs).
hardhat-kms validates the keys of every provider, but signs only through a provider package. Each provider package is a Hardhat plugin that depends on its cloud SDK, so installing it installs the SDK. @hardhat-kms/turnkey has no dependencies: it calls Turnkey's API itself.
| Provider | Package |
|---|---|
| AWS KMS | npm install --save-dev hardhat-kms @hardhat-kms/aws, then add hardhatKmsAws to plugins |
| Google Cloud KMS | npm install --save-dev hardhat-kms @hardhat-kms/gcp, then add hardhatKmsGcp to plugins |
| Azure Key Vault | npm install --save-dev hardhat-kms @hardhat-kms/azure, then add hardhatKmsAzure to plugins |
| Turnkey | npm install --save-dev hardhat-kms @hardhat-kms/turnkey, then add hardhatKmsTurnkey to plugins |
Install hardhat-kms gives the pnpm and Yarn commands and the settings each package manager needs.
A provider package loads hardhat-kms itself, so plugins: [hardhatKmsAws] is enough. Listing hardhatKms as well also works. Install hardhat-kms and the provider packages at the same version; they are released together.
Loading the config never loads an SDK. A provider package loads its SDK the first time one of its keys is used. A key whose provider package is not in plugins fails when it is first used, and the error says which package to install:
aws, create adapter, key aws:alias/deployer: AWS KMS keys need the @hardhat-kms/aws plugin. Install it with `npm install --save-dev @hardhat-kms/aws` and add it to `plugins` in your Hardhat config
Hardhat validates the config when it loads, and reports every problem with its path from the config root:
HHE15: Invalid config:
* Config error in config.kms.keys.deployer.keyId: Expected an https URL on an Azure Key Vault or Managed HSM host (for example `*.vault.azure.net`) with the path /keys/<name> or /keys/<name>/<version>
* Config error in config.networks.sepolia.kmsAccounts.0: Unknown key "deployr". Known keys: deployer.
The rules:
- Key names in
kms.keysstart with a letter and have at most 64 characters: letters, digits,_or-. They are kept simple because tasks take them as command-line arguments. kmsAccountsentries are key names fromkms.keysor inline key objects. A name must exist inkms.keys, and a network cannot list the same name twice. Errors and resolved configs call an inline key<network>.kmsAccounts[<index>].providerisaws,gcp,azure,turnkeyor a third-party provider's id. An id that looks like a misspelled built-in one, such asAWS,azrueorTurnkey, is an error rather than a third-party provider. The idsfireblocksandpkcs11are reserved for planned providers and are errors until those providers ship; the message links the issue that tracks each one.- Unknown fields in the
kmssection and in built-in providers' keys are errors, so a typo such askeyIDis caught. For a third-party provider's key, the plugin checks onlyprovider,address,timeoutMs,allowRawDigestsandallowedDelegates. addressis a0x-prefixed 20-byte address, all lowercase, all uppercase, or mixed case with a valid EIP-55 checksum.allowedDelegatesis a list, possibly empty. Each entry has anaddress, checked asaddressabove;chains, either"all"or a non-empty list of chain ids, each a whole number from 1 to 2^53 - 1; an optionallabelof 1 to 64 characters with no control characters and no surrounding whitespace; and an optionalcodeHash,0xand 64 hex digits, which cannot be the hash of empty code. Chain 0 cannot be listed: write"all". Other fields in an entry are errors.timeoutMsis a whole number of milliseconds from 1 to 2147483647, the largest delay Node.js timers accept.allowRawDigestsistrueorfalse. A string such as"true"is an error.simulatedBalanceis a non-negativebigint, for example10n ** 18n.
Key identifiers are checked against the formats below. A literal value is checked when the config loads. A value from a configuration variable is read only when the key is first used, and is checked then, with the same rules; the error names the config path and the variable, never its value:
invalid value for kms.keys.ops.keyId (<AZURE_KEY_ID>): expected an https URL on an Azure Key Vault or Managed HSM host (for example `*.vault.azure.net`) with the path /keys/<name> or /keys/<name>/<version>
| Field | Accepted format |
|---|---|
AWS keyId |
A key id (lowercase 1234abcd-… or mrk-…), an alias name (alias/…), a key ARN or an alias ARN. ARNs may use any AWS partition, such as aws, aws-cn or aws-us-gov. |
AWS region |
Must match the region inside an ARN keyId when both are set. Checked when the config loads if both are literals, and when the key is first used if either comes from a configuration variable. |
GCP keyVersionName |
projects/<p>/locations/<l>/keyRings/<r>/cryptoKeys/<k>/cryptoKeyVersions/<n>, where <n> is a positive integer. |
| GCP components | projectId, location, keyRing and keyName use letters, digits, _, ., : or -, and cannot be . or ... keyVersion is a positive integer, as a number or a string. Set either the name or the components. |
Azure keyId |
https://<vault>/keys/<name> or https://<vault>/keys/<name>/<version>. |
Azure vaultUrl |
https://<vault> with no path. Set either keyId, or vaultUrl with keyName and an optional keyVersion. |
Turnkey organizationId |
A UUID, such as f81d4fae-7dec-11d0-a765-00a0c91e6bf6, in any case. |
An Azure key name has 1 to 127 letters, digits or -, and a key version has letters and digits only. <vault> must be a Key Vault or Managed HSM host in the public cloud or a sovereign cloud: *.vault.azure.net, *.managedhsm.azure.net, *.vault.azure.cn, *.managedhsm.azure.cn, *.vault.usgovcloudapi.net, *.managedhsm.usgovcloudapi.net, *.vault.microsoftazure.de or *.managedhsm.microsoftazure.de. The plugin rejects other hosts, non-default ports, http, backslashes, and URLs with credentials, a query or a fragment, so a key id cannot send signing requests to another server. This applies to values from configuration variables too.
An EIP-7702 authorization lets the code at its delegate act for the account until another authorization replaces it. allowedDelegates on a key lists the contracts that key may delegate to:
import hardhatKmsAws from "@hardhat-kms/aws";
import { configVariable, defineConfig } from "hardhat/config";
export default defineConfig({
plugins: [hardhatKmsAws],
kms: {
keys: {
deployer: {
provider: "aws",
keyId: "alias/deployer",
address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
allowedDelegates: [
{
address: "0x4Cd241E8d1510e30b2076397afc7508Ae59C66c9",
chains: "all",
label: "Simple7702Account",
},
{
address: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
chains: [11155111],
label: "our batcher",
},
],
},
},
},
networks: {
sepolia: {
type: "http",
url: configVariable("SEPOLIA_RPC_URL"),
chainId: 11155111,
kmsAccounts: ["deployer"],
},
},
});To also pin the delegate's code, add its hash to the entry:
{
address: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
chains: [11155111],
label: "our batcher",
// keccak256 of its runtime code: cast keccak $(cast code <address> --rpc-url <url>)
codeHash: "0x…",
},The fields of an entry:
| Field | Meaning |
|---|---|
address |
The delegate. All lowercase, all uppercase, or with a valid EIP-55 checksum; a wrong checksum fails when the config loads. Added in 1.3.0. |
chains |
The chain ids the delegate is allowed on, or "all". Added in 1.3.0. |
label |
Optional. A name shown before the delegate's address on the delegate line of kms sign-auth's question and summary. Added in 1.3.0. |
codeHash |
Optional. The keccak256 of the delegate's runtime code, for example from cast keccak $(cast code <address> --rpc-url <url>). The plugin reads the code with eth_getCode before it signs, and refuses on a mismatch. Added in 1.3.0. |
The rules:
-
Without
allowedDelegates, nothing changes: the key may delegate to any contract. With it, a delegate must match an entry for the authorization's chain. An empty list allows only the zero address. To lock a deployer or admin key against any delegation, setallowedDelegates: []: every path below refuses a delegate other than the zero address, with or without a terminal, and a revoke still works. LeaveallowRawDigestsunset on such a key, since a raw digest can be an authorization the list never sees.kms accountsshows the key asrevoke only. -
An authorization for chain N matches entries that list N, and entries with
chains: "all". -
An authorization for chain 0 is valid on every chain, so it matches only entries with
chains: "all". An entry that lists chain ids never allows a chain-0 authorization, as in Ledger's Ethereum app. -
With
codeHash, the plugin reads the delegate's code on the network and refuses when its hash differs, when the address has no code, or when the node's answer is not hex data. When several entries match, one withoutcodeHashis enough; otherwise the code must match one of their hashes. For a chain-0 authorization, the code is read on the connection's chain only, and a note says so.kms sign-auth --chainopens no connection, so it refuses a delegate whose matching entries all pin a hash: run it with--network. -
The zero address always passes, since an authorization to it clears the delegation.
-
No flag or option overrides the list: not
--forceonkms sign-auth, and notallowChainZeroAuthorizationon a library account. -
Keys from
--kmshave no config, so they have no list. A--kmskey that is the same KMS key as a config key withallowedDelegates, inkms.keysor any network'skmsAccounts, is refused before it signs an authorization to a delegate other than the zero address.kms sign-authrefuses such an authorization.kms sign-txrefuses any transaction with anauthorizationList, even one that only clears the delegation or carries only other accounts' authorizations. A connection refuses each authorization the key signs to such a delegate, alone or in a transaction from the key, ineth_sendTransaction,eth_signTransactionand a library account'ssignAuthorizationandsignTransaction. Use the config key instead. A config key with anaddresspin is matched by its pin. One without a pin is matched by its identifier, read so that a near miss is refused rather than let through:- AWS: the key id or alias name, in any case, whatever region, profile or endpoint either key sets, and taken out of an ARN. A config key
alias/deployerwithregion: "eu-west-1"matches a--kmskeyalias/deployerthat takes its region fromAWS_REGION, andarn:aws:kms:eu-west-1:111122223333:alias/deployer. The same alias in another region or account is refused too. A key id or key ARN does not match an alias: pin the config key'saddressto catch that. - Azure: the vault and key name, in any case, with or without a trailing slash. A key URL without a version matches every version of that key.
- Google Cloud: the key version name, as written. Google Cloud APIs can take a project number in place of the project id (AIP-2510), so the same key written with the number in one key and the id in the other is not matched: pin the config key's
addressto catch it.
Two config keys for the same KMS key, one without a list, are not linked: whoever edits the config controls the list.
To match a config key without a pin, the plugin reads its identifier, so a
configVariablein it must be set, or come fromhardhat-keystore, which may ask for its password. On a connection this happens only when a--kmskey signs an authorization to a delegate other than the zero address; an unset variable fails with Hardhat's error for it. Pin the config key'saddressto skip the read. - AWS: the key id or alias name, in any case, whatever region, profile or endpoint either key sets, and taken out of an ARN. A config key
The list is checked before any KMS sign request in kms sign-auth, in a library account's signAuthorization, which the Alchemy Wallet APIs use, and for each authorization a KMS sender's transaction carries that recovers to the sender: eth_sendTransaction and eth_signTransaction, kms sign-tx and the library account's signTransaction. Authorizations signed by other accounts are not checked. A raw digest, from kms sign --no-hash or a rawSign account, can be an authorization's hash, and the list cannot see it: allowRawDigests gates raw digests.
The list lives in the Hardhat config, so whoever can edit the config can widen it. The plugin freezes each resolved key and its list, but code in the same process can still replace the config's kms section or a network's kmsAccounts. The list guards against mistakes and driven signing, not against a leaked key: see EIP-7702 delegates in the security model. The errors are in the errors reference.
@hardhat-kms/safe adds kms safe propose, which signs a Safe transaction with a KMS key, a key in the network's accounts or a Ledger, and proposes it to the Safe Transaction Service (Propose Safe transactions from Hardhat). Add it to plugins, next to the provider package of a KMS key if one proposes. Its settings live in a kmsSafe section at the top of the config:
kmsSafe: {
apiKey: configVariable("SAFE_TRANSACTION_SERVICE_API_KEY"),
services: { "43113": "https://safe-transaction.example.com" },
timeoutMs: 30_000,
},| Field | Meaning |
|---|---|
kmsSafe.apiKey |
The Safe Transaction Service API key from developer.safe.global, as a configuration variable only: validation refuses a string. Safe's hosted service needs it; a proposal to it without one fails before the key signs. Read only when a proposal goes to Safe's hosted service, and sent nowhere else. Added in 1.5.0. |
kmsSafe.services |
The root URL of a Transaction Service per decimal chain id, without /api, for a self-hosted service or a chain Safe does not serve. It replaces Safe's hosted service for that chain. https only, or http on localhost, 127.0.0.1 and [::1], with no user name, password, query or fragment. The plugin sends it no API key, so a service that needs one is not supported. Added in 1.5.0. |
kmsSafe.timeoutMs |
How long each request to the service may take, from 1000 to 300000 ms. Default 30000. The plugin never retries a request. Added in 1.5.0. |
Without kmsSafe.services, the plugin uses https://api.safe.global/tx-service/<shortName> for the chains that Safe's @safe-global/api-kit 5.0.4 lists, such as eth for Ethereum, sep for Sepolia and basesep for Base Sepolia. For any other chain, such as Avalanche Fuji (43113), the task fails with safe.service.unknown-chain before the key signs.
Keys can also come from Foundry's environment variables with --kms aws, --kms gcp, --kms azure or a comma-separated list, without a config entry. Foundry has not released an Azure signer: the azure variable names follow the proposal in foundry-rs/foundry#17120 and may change before it ships. These keys inherit kms.defaults and pass the same checks as config keys. They are added to the selected network only (the --network value, or default without one), after the network's kmsAccounts. A command-line key that names the same KMS key as a config key on that network is an error that names both, without the value. A command-line key has no config, so it cannot set allowRawDigests: kms sign --no-hash signs with it only after a person answers at a terminal, and getAccount refuses rawSign for it. See Move KMS signing from Foundry to Hardhat.
After loading, hre.config.kms holds the resolved section. Every network's config gets a kmsAccounts array of resolved keys, empty when none are configured. A key listed by name resolves to the same settings as its entry in hre.config.kms.keys.
Each resolved key has a displayId that is safe to print: the provider id and the key identifier, such as aws:alias/deployer. An identifier read from a configuration variable shows as the variable's name, for example aws:<AWS_KMS_KEY_ID>, and its value is read only when the key is used. A literal identifier shows as written, so a literal AWS key ARN, which holds the AWS account id, appears in error prefixes and in DEBUG output: use configVariable to keep the ARN out of logs. A third-party provider's key shows as <provider>:<key name>, and its userConfig holds the key's fields with configuration variables resolved, as Hardhat does for its own config.
The resolved types are exported from hardhat-kms/types. Narrow a resolved key on its provider field; a third-party provider adds its resolved type to KmsProviderConfigs.
hardhat-kms works next to @nomicfoundation/hardhat-ledger. List hardhat-ledger first:
import hardhatKmsAws from "@hardhat-kms/aws";
import hardhatLedger from "@nomicfoundation/hardhat-ledger";
import { defineConfig } from "hardhat/config";
export default defineConfig({
plugins: [hardhatLedger, hardhatKmsAws],
});In this order, hardhat-kms gives a raw eth_sendTransaction request without from its default sender (RPC methods) before hardhat-ledger checks it. In the other order, hardhat-ledger rejects every such request on a network with ledgerAccounts, as it does when loaded alone. hardhat-viem, hardhat-ethers and Ignition always set from, to the first address of eth_accounts unless you name another, so the order does not change their sender. The order also sets eth_accounts: with hardhat-ledger first, the network's own accounts come first, then the Ledger addresses, then the KMS addresses. In the other order the KMS addresses come before the Ledger ones, and eth_requestAccounts leaves the Ledger addresses out. Code that picks an account by index, such as Ignition's m.getAccount(index), sees the difference.
No secrets live in the Hardhat config. The credentials reference lists the sources each cloud tries, in order, and every variable they read, and where a Turnkey key's API key and the Safe Transaction Service API key come from.
AWS keys use the AWS SDK's own chain, and a key's profile is the only config field that changes it. Credentials reference: AWS lists the sources and explains why a profile and access keys in the environment must never be set together.
Google Cloud keys use Application Default Credentials: see Credentials reference: Google Cloud.
Azure keys use a chain the plugin builds, which refuses username and password sign-in: see Credentials reference: Azure.
A Turnkey key's credential is its API private key, which the config names only as a configuration variable: see Credentials reference: Turnkey.
kmsSafe.apiKey is a configuration variable only: see Credentials reference: Safe Transaction Service.