As a UX feature, Nocturne supports mappings between Ethereum addresses and Nocturne canonical addresses via the Canonical Address Registry. This allows individuals to pay each other via Ethereum addresses and ENS names instead of manually keeping track of canonical addresses.
To register a mapping, the registrant calls the setCanonAddr function on the registry contract. To prevent "squatting" and fraudulent mappings, we require that:
1. The registrant calls the contract from the Ethereum address they'd like to register.
2. The registrant proves that they own the canonical address they're mapping via a signature using their spending key. Since verifying Baby JubJub signatures on-chain is expensive, we do this in a ZKP.
The digest being signed in the BJJ Schnorr signature is computed using EIP-712. The digest includes the Ethereum address, the canonical address to map to, a per-canonical-address nonce for replay protection, and the other standard EIP-712 info (e.g. chainId).