Skip to main content
The Key Registry stores the public keys associated with each Farcaster account. If you want to read information about a Farcaster account’s keys or remove an existing key, use the Key Registry. If you want to add a new key, use the Key Gateway instead.

Read

totalKeys

Get the number of active keys (uint256) for an fid.

keysOf

List all public keys (bytes[]) for an fid.
Don’t call this onchain! This function is very gas intensive. It’s meant to be called by offchain tools, not by other contracts.

keyDataOf

Returns the state (uint8) and keyType (uint32) of particular key for an fid.

Write

add

Will revert if called directly. Must be called via the Key Gateway

remove

Removes a public key from the caller’s fid and marks it as Removed.
Removing a key will delete all offchain messages associated with the key from Hubs.

removeFor

Remove a key on behalf of another fid by providing a signature. The fid owner must sign an EIP-712 Remove message approving the removal. Reverts if the key does not exist or is already removed.
Removing a key will delete all offchain messages associated with the key from Hubs.

Remove signature

To remove a key on behalf of another account, you must provide an EIP-712 typed signature from the account in the following format: Remove(address owner,bytes key,uint256 nonce,uint256 deadline)
[@farcaster/hub-web]
[Viem]
[helpers.ts]
[signer.ts]
[clients.ts]

Errors

Source

KeyRegistry.sol