Docs/Reference/Signing
Signing
How brand wallets sign issuance, redemption, and admin messages before anyone can submit them.
Domain#
The signature is bound to Loyfin, one chain, and one verifying contract.
const domain = {
name: "Loyfin",
version: "1",
chainId: 8453,
verifyingContract: loyfinFactoryAddress
};
const types = {
Metadata: [
{ name: "loyaltyId", type: "bytes32" },
{ name: "name", type: "string" },
{ name: "symbol", type: "string" },
{ name: "media", type: "string" },
{ name: "description", type: "string" },
{ name: "contractURI", type: "string" },
{ name: "tokenURI", type: "string" }
],
Issuance: [
{ name: "issuer", type: "address" },
{ name: "loyaltyId", type: "bytes32" },
{ name: "amount", type: "uint256" },
{ name: "expiresAt", type: "uint256" },
{ name: "deadline", type: "uint256" },
{ name: "nonce", type: "bytes32" },
{ name: "chainId", type: "uint256" },
{ name: "verifyingContract", type: "address" },
{ name: "operationHash", type: "bytes32" },
{ name: "metadata", type: "Metadata" },
{ name: "data", type: "bytes" }
]
};Issuance type#
Issuance signatures include metadata because the first tokenization can create the Loyalty Token. Issuance and redemption signatures also include deadline; 0 means the signed action does not expire.
Redemption type#
const types = {
Redemption: [
{ name: "issuer", type: "address" },
{ name: "loyaltyId", type: "bytes32" },
{ name: "amount", type: "uint256" },
{ name: "expiresAt", type: "uint256" },
{ name: "deadline", type: "uint256" },
{ name: "nonce", type: "bytes32" },
{ name: "chainId", type: "uint256" },
{ name: "verifyingContract", type: "address" },
{ name: "operationHash", type: "bytes32" },
{ name: "data", type: "bytes" }
]
};Recipient and holder authorization#
Checkout sessions use two signatures. The issuer signs the claimable issuance or redemption terms without choosing the customer wallet. The customer then signs an IssuanceRecipientAuthorization or RedemptionHolderAuthorization. Its claimHash is the EIP-712 digest of the issuer-signed claimable action, binding the selected wallet to those exact terms, chain, factory, and deadline.
const issuanceRecipientAuthorizationTypes = {
IssuanceRecipientAuthorization: [
{ name: "to", type: "address" },
{ name: "claimHash", type: "bytes32" },
{ name: "chainId", type: "uint256" },
{ name: "verifyingContract", type: "address" },
{ name: "deadline", type: "uint256" }
]
};
const redemptionHolderAuthorizationTypes = {
RedemptionHolderAuthorization: [
{ name: "from", type: "address" },
{ name: "claimHash", type: "bytes32" },
{ name: "chainId", type: "uint256" },
{ name: "verifyingContract", type: "address" },
{ name: "deadline", type: "uint256" }
]
};