Skip to main content
The Key Gateway adds new keys to the Key Registry. If you want to add a new public key to a Farcaster account, use the Key Gateway.

Read

nonces

Returns the next available nonce for an address. Used for generating EIP-712 signatures in addFor.

Write

add

Add a new key for the caller’s fid and set its state to Added. Revert if the key is already registered.

addFor

Add a key on behalf of another fid by providing a signature. The owner must sign an EIP-712 Add message approving the key. Reverts if the key is already registered.

Add signature

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

Errors

Source

KeyGateway.sol