Skip to main content

Check viewing-key registration

What this lets you do

Look up whether a given EVM address has a viewing key in the Keystore. The result determines which send path is available: discoverable when the recipient is registered, or out-of-band when they are not.

Constraints & limits

  • The lookup returns the registered 32-byte viewing public key when present, or 0x0 when there is none.
  • This is a public read: no authentication is required, and anyone can check any address.
  • Registration can change between lookup and send, so re-check shortly before sending when discoverable delivery matters.

What it unlocks next

  • Branching in your send flow: when the recipient is registered you use discoverable mode, and when they are not you fall back to out-of-band delivery, capturing the noteSecret so you can deliver it over your own channel (for example a payment receipt).
  • A UX prompt: surface something like "this recipient hasn't registered yet, so you'll need to share the receipt manually" before the sender commits.

How to use it

// session.isKeystoreRegistered() checks the session's own ownerAddress; to
// check a recipient, look up their viewing key directly.
const viewingKey = await keystoreInteractor.getViewingKey(recipientAddress);
const isRegistered =
viewingKey !== "0x0000000000000000000000000000000000000000000000000000000000000000";
if (!isRegistered) {
// unregistered → OoB path
}

Behind the scenes

SDK call keystoreInteractor.getViewingKey(address) reads another address's viewing key, while session.isKeystoreRegistered() takes no arguments and checks the session's own address only.
Contract method Keystore.viewingKeys(address), a public mapping accessor that is free to call. The SDK exposes this as keystoreInteractor.getViewingKey(address).