Minor Changes
-
9c0d7c2: feat: builders and EIP-712 helpers for gasless signers (FIP-272)
The V16 protos for
KEY_ADD/KEY_REMOVEshipped in 0.18.11, but nothing above the wire
format did — callers had to hand-roll the EIP-712 signatures and ABI encoding. This adds the
missing layer.BREAKING for custom
Eip712Signersubclasses. Four abstract methods are added to
Eip712Signer; any class extending it outside this repo must implement them to compile. All
four bundled signers (ViemLocalEip712Signer,ViemWalletEip712Signer,EthersEip712Signer,
EthersV5Eip712Signer) are updated. Callers that only use signers are unaffected.- New
gaslessKeysmodule: theFarcaster KeyAddEIP-712 domain and itsKeyAdd,
KeyRemoveandSignedKeyRequesttypes,verifyKeyAdd/verifyKeyRemove/
verifyGaslessKeyRequest, metadata encode/decode, and the protocol constants
(MAX_KEY_TTL_SECONDS,MAX_KEY_ADD_SCOPES,MAX_GASLESS_KEYS_PER_FID,
ADMISSIBLE_KEY_ADD_SCOPES, key and signature type discriminants). - New
Eip712Signermethods:signKeyAdd,signKeyRemove,signGaslessKeyRequestand
getGaslessSignedKeyRequestMetadata. - New builders:
makeKeyAddBody,makeKeyRemoveBody,makeKeyRemoveBodySelfRevoke,
makeKeyAdd,makeKeyAddData,makeKeyRemove,makeKeyRemoveData. validations.validateKeyAddBodyandvalidateKeyRemoveBody, wired into
validateMessageDatasoKEY_ADD/KEY_REMOVEare no longer rejected as
bodyType is invalid.validateKeyAddBodyalso decodes theSignedKeyRequest
metadata blob and, given the enclosingMessageData.timestamp, rejects an expired
one — matchingverify_signed_key_request_metadataso an authorization that the
node would reject fails before submit rather than at merge time. It compares
against the message's own timestamp, not wall-clock, so replaying a valid old
message stays deterministic.
Note that snapchain's
SignedKeyRequestshares a struct name with the onchain
SignedKeyRequestValidatorflow but uses a different EIP-712 domain —Farcaster KeyAdd,
chainId 1, noverifyingContract. The existingsignKeyRequestand
getSignedKeyRequestMetadataremain the onchain versions and produce signatures snapchain
rejects; theGasless-prefixed methods are their off-chain counterparts. The two are not
interchangeable. - New