Skip to main content
Every Cloak account has a viewing key (nk, 32 bytes). It finds and decrypts the account’s transaction records and notes. It can never spend. Sharing it is how a user proves their history to someone they choose, without making it public.

What the viewing key reveals

Disclosure is all or nothing for that account: nk opens its whole history, past and future. Treat a shared viewing key as permanent.

Disclose to an auditor

  1. Derive nk for the account. See Transaction history.
  2. Choose what to hand over:
    • A report (toComplianceReport or formatComplianceCsv): a snapshot. The auditor sees only what you exported, but must trust that you exported everything.
    • The viewing key itself: the auditor runs the scan on their own RPC and verifies against the chain. Nothing to trust, but they see the full history.
  3. Send it over a private channel. Anyone who obtains nk gains the same read access.
The auditor turns it back into bytes with hexToBytes and passes it as viewingKeyNk to scanTransactions.

Compliance on the protocol side

Separately from what a user discloses, the protocol screens activity:
  • Deposits carry a signed risk assessment that the program checks on chain.
  • Withdrawals, swaps and payouts are screened before they are authorized. A refused recipient throws payout.screening_refused and nothing moves.
  • Every account registers its viewing key with Cloak before it spends. createCloak does this automatically; the low-level API does it on the first call unless you set enforceViewingKeyRegistration: false.
The model is described in Viewing keys and compliance, and the user-facing view in Compliance.

Receiving keys are different

To receive a private send, a user shares their cloak_ address. It contains a public delivery key that lets a sender seal a note to them. It does not grant read access to anything. Never confuse it with nk.