{"templateId":"markdown","versions":[{"version":"v1.44","label":"v1.44 STS","link":"/pt-br/products/custody/developer-experience/sdks/response-verification","default":true,"active":false,"folderId":"714bb270"},{"version":"v1.43","label":"v1.43 LTS","link":"/pt-br/products/custody/v1.43/developer-experience/sdks/response-verification","default":false,"active":true,"folderId":"714bb270"},{"version":"v1.42","label":"v1.42 STS","link":"/pt-br/products/custody/v1.42/developer-experience/sdks/response-verification","default":false,"active":false,"folderId":"714bb270"},{"version":"v1.34","label":"v1.34 LTS","link":"/pt-br/products/custody/v1.34/developer-experience/sdks/response-verification","default":false,"active":false,"folderId":"714bb270"},{"version":"v1.26","label":"v1.26 LTS","link":"/pt-br/products/custody/v1.26/developer-experience/sdks/response-verification","default":false,"active":false,"folderId":"714bb270"},{"version":"v1.19","label":"v1.19 LTS","link":"/pt-br/products/custody/v1.19/developer-experience/sdks/response-verification","default":false,"active":false,"folderId":"714bb270"},{"version":"v1.15","label":"v1.15 LTS","link":"/pt-br/products/custody/v1.15/developer-experience/sdks/response-verification","default":false,"active":false,"folderId":"714bb270"}],"sharedDataIds":{"sidebar":"sidebar-@l10n/pt-BR/products/custody/@v1.15/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition","tabs","tab"]},"type":"markdown"},"seo":{"title":"Verify response signatures","description":"User guides, API reference, and support resources.","siteUrl":"https://docs.ripple.com","lang":"en-US"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"verify-response-signatures","__idx":0},"children":["Verify response signatures"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Ripple Custody (Vault)"," protects critical entities, such as domains, users, accounts, and intents, with a data integrity protocol. The API returns each protected entity in a signed envelope with three fields: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["signature"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["signingKey"]},". The notary signs the envelope with its API-signing key."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDKs verify signed envelopes before they return data from successful responses. Signature verification detects changes to signed data, even when TLS is in place. The SDKs don't verify every object, even when you enable response verification. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#verification-limits"},"children":["Verification limits"]}," for the exceptions. Use this page to pin the notary key, handle verification failures, and verify stored payloads."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"SDK versions"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This page describes TypeScript SDK 0.6.0, Python SDK 0.6.1, and Java SDK 0.3.0. Earlier versions accept some responses that these versions reject, such as a response with its signature removed."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-verification-works","__idx":1},"children":["How verification works"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response verification is on by default in all three SDKs. For each successful (2xx) response, the SDK does the following:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Finds the signed envelopes in the body, either a single envelope or the items of a collection."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verifies each ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["signature"]}," over the canonical form of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]},", with the notary API public key you pinned in the configuration. The SDK ignores the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["signingKey"]}," field in the response, because the server controls that field."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Requires a signature on the operations that return signed entities. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#operations-that-must-return-signed-data"},"children":["Operations that must return signed data"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Checks that the signed entity is the one you requested, and not an older revision of it. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#request-binding-and-revision-checks"},"children":["Request binding and revision checks"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If a check fails, the call throws ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ResponseSignatureError"]}," and doesn't return the data. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UnsignedEntityError"]}," is a subclass of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ResponseSignatureError"]},". The SDK throws it when a response carries no signature where one is required."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK never fetches the notary key on its own. Reading the key from the same API whose responses it verifies would let a compromised server supply its own key. You must pin the key from a source you trust."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"operations-that-must-return-signed-data","__idx":2},"children":["Operations that must return signed data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK knows which API operations return signed entities: domains, users, policies, accounts, account addresses, vaults, endpoints, ledgers, tickers, transaction orders, intents, manifests, trusted public keys, system properties, and trusted backup entities. On those operations, the SDK rejects the following responses instead of treating them as unsigned data:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["An empty body, or a body that isn't JSON."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["An entity without a signature, including one that contains only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]},", or only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["signingKey"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A collection in which any item has no signature."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A single entity where the operation returns a collection."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Responses from other operations, such as balances, transfers, or the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["requestId"]}," returned when you submit an intent, pass through unchanged. The platform doesn't sign them."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"request-binding-and-revision-checks","__idx":3},"children":["Request binding and revision checks"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A valid signature proves that the notary signed an entity. It doesn't prove that the entity is the one you asked for, or its latest version. After the signature verifies, the SDK makes two more checks:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Requested entity:"]}," when you read a single entity by ID, the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}," in the signed data must match the ID you requested. You can't turn this check off while response verification is on."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Revision:"]}," the SDK records the highest ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["metadata.revision"]}," it has seen for each entity. It rejects a response, or a collection item, that carries a lower revision. The record is held in memory for each client configuration, covers up to 10,000 entities, and starts empty when your application restarts. Addresses, intents, system properties, and trusted public keys have no revision to track."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Both failures throw ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ResponseSignatureError"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If your deployment can serve an older revision after a newer one, for example when reads are load-balanced across replicas that lag, turn off the revision check in code. No environment variable or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["config.toml"]}," key exists for it:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK"},"children":["SDK"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Setting"},"children":["Setting"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["TypeScript"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rejectRevisionRollback: false"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["generateNewConfiguration"]},". ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["loadConfiguration()"]}," doesn't accept it."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Java"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CustodyClientConfig.rejectRevisionRollback(false)"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Python"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reject_revision_rollback = False"]}," on the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Configuration"]},"."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"verification-limits","__idx":4},"children":["Verification limits"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Unvalidated tickers:"]}," the platform signs a ticker only after it's validated. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tickers.list()"]}," returns validated tickers only, each verified against the pinned key. To read tickers that aren't validated yet, use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["listUnvalidated()"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["list_unvalidated()"]}," in Python) or get the ticker by ID. The SDK can't verify the data of an unvalidated ticker."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Unsigned account addresses:"]}," the platform can return a generated account address without a signature. The client's account address methods return an unsigned address only if they can re-derive it from the account's extended public key. Otherwise they throw ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AddressIntegrityError"]},". The SDKs can re-derive addresses only on Bitcoin-family ledgers. On other ledgers, set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RC_VERIFY_DERIVED_ADDRESSES=false"]}," to accept an unsigned address. The SDK then returns the address with a warning and nothing verifies it. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/custody/v1.43/developer-experience/sdks/configuration#verification-and-safety-checks"},"children":["Configure the SDK"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Generated API classes:"]}," if you call the generated API classes directly instead of the client's methods, the SDK rejects unvalidated tickers and unsigned account addresses with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UnsignedEntityError"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Operations that return unsigned data:"]}," the SDK doesn't verify responses from operations outside the list in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#operations-that-must-return-signed-data"},"children":["Operations that must return signed data"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Manual verification:"]}," the manual verifier doesn't know which operation a payload came from. It requires the payload to be signed: a single entity if the payload has ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]},", otherwise every item in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["items"]},". It throws ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UnsignedEntityError"]}," if the entity or any item has no signature, and returns the number of envelopes it verified. It returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0"]}," only for an empty ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["items"]}," array. It doesn't make the requested-entity or revision checks."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If an operation requires verified data from a stored payload, check how many envelopes the manual verifier checked. For a single signed envelope, require a count of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]},". For collections, compare the count with the number of items you expect to carry signatures. Investigate verification warnings. Don't suppress them or disable verification."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"behavior-without-a-pinned-key","__idx":5},"children":["Behavior without a pinned key"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If verification is on and you haven't configured a notary API public key, the SDK refuses to build a client instead of running without verification:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK"},"children":["SDK"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Where it fails"},"children":["Where it fails"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Error"},"children":["Error"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["TypeScript"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["loadConfiguration()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CustodyError"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Java"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CustodyClient.fromConfig(config)"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["new CustodyClient(config)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CustodyError"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Python"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["load_configuration()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ConfigurationError"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To fix the error, pin the key as described in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#configure-the-key"},"children":["Configure the key"]},". To run without verification, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#disable-verification"},"children":["Disable verification"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"get-the-notary-api-public-key","__idx":6},"children":["Get the notary API public key"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You need the notary's ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["API-signing"]}," public key, encoded as a base64 DER (Distinguished Encoding Rules) SubjectPublicKeyInfo value. The notary has other keys, such as the messaging key and the collections key. They don't verify API responses, and pinning one of them causes every protected response to fail."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get the key out of band from a source you trust:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If your organization operates ","Ripple Custody (Vault)",", ask the team that deployed the notary. The notary generates its API key during setup, and again during each key rotation. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/custody/v1.43/operations-and-maintenance/security-maintenance/notary-key-rotation-and-migration"},"children":["Notary key rotation and migration"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If Ripple hosts your deployment, contact the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/custody/v1.43/support/get-support"},"children":["Ripple support team"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To cross-check the value, call ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/custody/v1.43/reference/api/openapi/trustedpublickeys/gettrustedpublickeysapi"},"children":["List API public keys"]}," and compare ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["items[].data.publicKey"]}," with the key you received. Treat this only as a check: don't build a client that discovers its pinned key from the API at startup."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"configure-the-key","__idx":7},"children":["Configure the key"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RC_NOTARY_API_PUBLIC_KEY"]}," environment variable works the same way in all three SDKs:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sh","header":{"controls":{"copy":{}}},"source":"export RC_NOTARY_API_PUBLIC_KEY=\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE...\"\n","lang":"sh"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["config.toml"]}," key is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["notary_api_public_key"]}," in all three SDKs. The accepted key formats and the programmatic setter differ by SDK, as the following tabs show. Environment variables override the file."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"TypeScript","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"toml","header":{"controls":{"copy":{}}},"source":"notary_api_public_key = \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE...\"\n","lang":"toml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK accepts a PEM (Privacy-Enhanced Mail) or base64 DER key and normalizes it. If you build the configuration in code with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["generateNewConfiguration"]},", pass the key as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["notaryApiPublicKey"]},"."]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"toml","header":{"controls":{"copy":{}}},"source":"notary_api_public_key = \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE...\"\n","lang":"toml"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"CustodyClientConfig config = CustodyClientConfig.loadConfiguration()\n    .notaryApiPublicKey(\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE...\");\nCustodyClient client = CustodyClient.fromConfig(config);\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Java SDK accepts only the base64 DER value. Use it exactly as the API returns it, without PEM headers, spaces, or line breaks. The SDK doesn't check the value when you build the client: a value it can't decode fails with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ResponseSignatureError"]}," on the first signed response."]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"toml","header":{"controls":{"copy":{}}},"source":"notary_api_public_key = \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE...\"\n","lang":"toml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["load_configuration()"]}," accepts a PEM or base64 DER key and normalizes it. If you construct a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Configuration"]}," in code instead, pass the base64 DER value as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["notary_api_public_key"]},"."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"rotate-the-notary-key","__idx":8},"children":["Rotate the notary key"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After a notary key rotation, the notary signs with its new API-signing key. Each SDK pins one key. Update the configured key when the new notary becomes active and restart your application."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Known limitation: entities signed before the rotation"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A notary key rotation doesn't re-sign existing entities. An entity keeps the signature from the previous API-signing key until an intent next changes it. Each SDK pins one key, so after a rotation no single key verifies every response. A client that pins the new key rejects entities signed before the rotation with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ResponseSignatureError"]},", and a client that pins the old key rejects everything signed since. A rotation therefore breaks API integrations that verify response signatures."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Upcoming SDK patch releases will address this limitation. Until then, if your applications verify responses, contact the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/custody/v1.43/support/get-support"},"children":["Ripple support team"]}," before you rotate the notary key."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the rotation procedure, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/custody/v1.43/operations-and-maintenance/security-maintenance/notary-key-rotation-and-migration"},"children":["Notary key rotation and migration"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"handle-responsesignatureerror","__idx":9},"children":["Handle ResponseSignatureError"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ResponseSignatureError"]}," is a subclass of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CustodyError"]},". It means one of the following:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A key other than the one you pinned signed the response. The usual cause is a notary key rotation, or a pinned key that isn't the API-signing key."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The signature doesn't match the data, or the envelope isn't well formed. This can mean that something altered the response between the notary and your application, for example a proxy that rewrites response bodies."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The response has no signature where the operation requires one. For this case the SDK can throw the subclass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UnsignedEntityError"]},". One cause that isn't tampering is a ticker that's awaiting validation."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The signed entity isn't the one you requested, or it's an older revision than one the client has already seen."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A handler that catches ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ResponseSignatureError"]}," also catches ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UnsignedEntityError"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Don't retry the call or turn off verification to get past the error. Confirm the pinned key with your operator first. If the key is correct, treat the response as untrusted and investigate the network path."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example shows where to handle the error:"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"TypeScript","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"import { ResponseSignatureError } from '@ripple/ripple-custody-client-lib-typescript';\n\ntry {\n  await client.governance.domains.list({ limit: 10 });\n} catch (err) {\n  if (err instanceof ResponseSignatureError) {\n    // Don't use the data. Check the pinned notary key, then alert.\n  }\n  throw err;\n}\n","lang":"typescript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"import com.ripple.custody.errors.ResponseSignatureError;\n\ntry {\n    client.governance().domains().list(10, null);\n} catch (ResponseSignatureError e) {\n    // Don't use the data. Check the pinned notary key, then alert.\n    throw e;\n}\n","lang":"java"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"from ripple_custody_client_lib_python import ResponseSignatureError\n\ntry:\n    client.governance.domains.list(limit=10)\nexcept ResponseSignatureError:\n    # Don't use the data. Check the pinned notary key, then alert.\n    raise\n","lang":"python"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"verify-a-payload-manually","__idx":10},"children":["Verify a payload manually"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The client checks supported response envelopes automatically, with the exceptions in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#verification-limits"},"children":["Verification limits"]},". To check a payload from another source or a response body you saved earlier, use the client's manual verification method. It uses the configured key unless you pass another key. It returns the number of envelopes it verified."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Preserve the raw JSON response. Converting it to SDK models and back to JSON can change signed fields and cause verification to fail. Parse the original JSON as shown in these examples instead."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following examples require exactly one verified envelope in a stored response body, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["responseText"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["response_text"]}," in Python). For a collection, use the expected number of signed items instead:"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"TypeScript","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const count = client.verifySigned(JSON.parse(responseText));\nif (count !== 1) {\n  throw new Error(`Expected one verified envelope, got ${count}`);\n}\n","lang":"typescript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"int count = client.verifySigned(responseText);\nif (count != 1) {\n    throw new IllegalStateException(\"Expected one verified envelope, got \" + count);\n}\n","lang":"java"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"import json\n\ncount = client.verify_signed(json.loads(response_text))\nif count != 1:\n    raise RuntimeError(f\"Expected one verified envelope, got {count}\")\n","lang":"python"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"disable-verification","__idx":11},"children":["Disable verification"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Turn verification off only for local development or a test cluster where no notary API key is available. Don't disable it in production: without it, your application trusts API responses on the strength of TLS alone. The TypeScript and Python SDKs treat the opt-out as deprecated and log a warning when you use it."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With verification off, the SDK makes none of the checks on this page. The client's account address methods also refuse an unsigned address that they can't re-derive, because nothing authenticates the account's extended public key. To accept such an address, also set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RC_VERIFY_DERIVED_ADDRESSES=false"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To opt out in any SDK, set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RC_VERIFY_RESPONSES=false"]},". Each SDK also has its own options:"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"TypeScript","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"toml","header":{"controls":{"copy":{}}},"source":"verify_responses = false\n","lang":"toml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you build the configuration in code with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["generateNewConfiguration"]},", pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verifyResponses: false"]},"."]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"toml","header":{"controls":{"copy":{}}},"source":"verify_responses = false\n","lang":"toml"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"CustodyClientConfig config = CustodyClientConfig.loadConfiguration().verifyResponses(false);\n","lang":"java"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"toml","header":{"controls":{"copy":{}}},"source":"verify_responses = false\n","lang":"toml"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"config = load_configuration(verify_responses=False)\n","lang":"python"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related-topics","__idx":12},"children":["Related topics"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/custody/v1.43/developer-experience/sdks/configuration"},"children":["Configure the SDK"]},": configuration keys and environment variables for each SDK."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/custody/v1.43/developer-experience/sdks/errors-and-http"},"children":["Errors, pagination, and HTTP settings"]},": the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CustodyError"]}," hierarchy and HTTP transport settings."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/custody/v1.43/operations-and-maintenance/security-maintenance/notary-key-rotation-and-migration"},"children":["Notary key rotation and migration"]},": the procedure that changes the API-signing key."]}]}]},"headings":[{"value":"Verify response signatures","id":"verify-response-signatures","depth":1},{"value":"How verification works","id":"how-verification-works","depth":2},{"value":"Operations that must return signed data","id":"operations-that-must-return-signed-data","depth":3},{"value":"Request binding and revision checks","id":"request-binding-and-revision-checks","depth":3},{"value":"Verification limits","id":"verification-limits","depth":3},{"value":"Behavior without a pinned key","id":"behavior-without-a-pinned-key","depth":2},{"value":"Get the notary API public key","id":"get-the-notary-api-public-key","depth":2},{"value":"Configure the key","id":"configure-the-key","depth":2},{"value":"Rotate the notary key","id":"rotate-the-notary-key","depth":2},{"value":"Handle ResponseSignatureError","id":"handle-responsesignatureerror","depth":2},{"value":"Verify a payload manually","id":"verify-a-payload-manually","depth":2},{"value":"Disable verification","id":"disable-verification","depth":2},{"value":"Related topics","id":"related-topics","depth":2}],"frontmatter":{"seo":{"title":"Verify response signatures"}},"lastModified":"2026-11-27T11:10:40.000Z","isTranslationFallback":true,"pagePropGetterError":{"message":"","name":""}},"slug":"/pt-br/products/custody/v1.43/developer-experience/sdks/response-verification","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}