Skip to main content
Build a Sign In With Farcaster message to present to the end user for signing. Adds required Sign In With Farcaster message attributes to any provided parameters. You should parse most of these parameters from a provided protocol URI. Your wallet app must provide the user’s custody address and fid. Returns a SiweMessage object and the message as a string.
const { siweMessage, message } = walletClient.buildSignInMessage({
  address: '0x63C378DDC446DFf1d831B9B96F7d338FE6bd4231',
  fid: 1,
  uri: 'https://example.com/login',
  domain: 'example.com',
  nonce: 'ESsxs6MaFio7OvqWb',
});

Parameters

ParameterTypeDescriptionRequired
addressHexWallet user’s custody address. This address must be the same account that signs the generated Sign In With Farcaster message. Your wallet app should provide the custody address of the authenticated user.Yes
fidstringWallet user’s fid. Your wallet app should provide the fid of the authenticated user.Yes
uristringLogin URL of the relying connected app. Parse this from the provided Sign In With Farcaster URI.Yes
domainstringDomain of the relying connected app. Parse this from the provided Sign In With Farcaster URI.Yes
noncestringRandom nonce to include in the Sign In With Farcaster message. Must be at least 8 alphanumeric characters. Parse this from the provided Sign In With Farcaster URI.Yes
notBeforestringStart time at which the SIWE signature becomes valid. ISO 8601 datetime. Parse this from the provided Sign In With Farcaster URI.No
expirationTimestringExpiration time after which the SIWE signature becomes valid. ISO 8601 datetime. Parse this from the provided Sign In With Farcaster URI.No
requestIdstringA system specific ID provided by the relying app. Parse this from the provided Sign In With Farcaster URI.No

Returns

{
  siweMessage: SiweMessage;
  message: string;
  isError: boolean;
  error: Error;
}
ParameterDescription
siweMessageConstructed Sign In With Ethereum message object.
messageSIWE message serialized as a string.
isErrorTrue when an error has occurred.
errorError instance.