Class TransferAuthorization

java.lang.Object
com.tnsai.payment.x402.TransferAuthorization

public final class TransferAuthorization extends Object
Builds the EIP-712 typed-data hash pair for an EIP-3009 transferWithAuthorization call — the payload an x402 client signs to authorise a one-time USDC transfer without an on-chain approval round-trip.

Two hashes come out:

  • Domain separator = keccak256(EIP712Domain(...)), scoped to the token contract that will verify the signature (the asset address from the 402 response).
  • Struct hash = keccak256(TransferWithAuthorization(...)), binding from, to, value, validAfter, validBefore, and nonce.

The wallet receives both as an EIP712TypedData record and applies the EIP-712 prefix and secp256k1 signing on top — specifically keccak256(0x1901 || domainSeparator || structHash) — so this class never touches private-key material.

Why we don't use web3j's StructuredDataEncoder

StructuredDataEncoder round-trips through JSON Schema parsing, which is heavier than necessary for this fixed schema. Inlining the encoding keeps the broker's hot path tight and the implementation legible alongside the EIP-712 / EIP-3009 spec.
Since:
0.10.5 (TNS-449 P3)