Skip to main content
@phala/cloud v0.4.0 models KMS resources by contract. A KMS contract groups equivalent KMS node replicas that share one root key.

listKmsContracts

GET /kms
Parameters: page, page_size, and is_onchain are optional filters in request. Returns: ListKmsContractsResponse, a paginated list of KmsContractInfo objects. Returns the available KMS contracts. This method always requests API version 2026-06-23.
Each KmsContractInfo includes the contract id, slug, contract_address, chain_id, node_count, k256_pubkey, and ca_pubkey. For the off-chain Phala KMS, contract_address is "phala" and chain_id is 0.

getKmsContract

GET /kms/{slug}
Parameters: request.slug accepts a contract slug or kc_-prefixed contract ID. Returns: KmsContractInfo for the resolved contract. Returns one KMS contract by slug. A kc_-prefixed contract ID also resolves.
Use the public keys as verification anchors when you validate KMS responses.

listKmsContractNodes

GET /kms/{slug}/nodes
Parameters: request.slug accepts a contract slug or kc_-prefixed contract ID. Returns: ListKmsContractNodesResponse with the contract’s node replicas. Returns the KMS node replicas under a contract, including each node’s RPC URL and version.

Legacy node methods

getKmsList() accepts optional pagination and is_onchain filters. getKmsInfo() requires request.kms_id. They return the earlier node-centric KMS shapes. Both methods are deprecated and remain pinned to API version 2026-05-22. Use listKmsContracts(), getKmsContract(), and listKmsContractNodes() for new code.

getAppEnvEncryptPubKey

GET /kms/{kms}/pubkey/{appId}
Parameters: request.kms is a KMS node ID or slug, and request.app_id is a 20-byte app ID with or without the 0x prefix. Returns: GetAppEnvEncryptPubKey with public_key and signature. Returns the public key used to encrypt environment variables for an app. Fetch and verify this key before encrypting secrets.

nextAppIds

GET /kms/phala/next_app_id
Parameters: request.counts requests 1 to 20 IDs and defaults to 1. Returns: NextAppIds with the reserved app_id and nonce pairs. Reserves app IDs from the Phala KMS for deterministic provisioning.

getKmsOnChainDetail

GET /kms/on-chain/{chain}
Parameters: request.chain is the chain name, such as "base" or "ethereum". Returns: GetKmsOnChainDetailResponse with the chain and its KMS contracts. Returns the contracts, registered devices, OS images, and verification anchors for an on-chain KMS.

Compute and verify mr_config_id

Import the measurement helpers from @phala/cloud:
For key_provider_type: "kms", set key_provider_id to the contract’s k256_pubkey, not its ca_pubkey.
getMrConfigIdV1(composeHash) remains available for the V1 compose-hash-only format.