Package com.tnsai.payment.x402
Record Class EIP712TypedData
java.lang.Object
java.lang.Record
com.tnsai.payment.x402.EIP712TypedData
- Record Components:
domainSeparator- 32-byte EIP-712 domain separatorstructHash- 32-byte message struct hash
The two 32-byte values an EVM wallet needs in order to produce an
EIP-712 signature.
This record is intentionally shallow — it does not carry the raw typed-data tree, only the canonical hashes derived from it:
domainSeparator()— thekeccak256(EIP712Domain(...))value scoped to the contract that will verify the signature.structHash()— thekeccak256(message struct)value for the specific operation being authorised (e.g.transferWithAuthorization).
The signer multiplies these into the standard EIP-712 digest
keccak256(0x1901 || domainSeparator || structHash) before
applying secp256k1. Building the two inputs is the broker's job; the
wallet only signs them.
P3 of TNS-449 adds the transferWithAuthorization-shaped builder
that produces this record from a PaymentRequirement. P2 ships the
shape only.
- Since:
- 0.10.5 (TNS-449 P2)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intExpected length, in bytes, of each component. -
Constructor Summary
ConstructorsConstructorDescriptionEIP712TypedData(byte[] domainSeparator, byte[] structHash) Creates an instance of aEIP712TypedDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Defensive copy on accessor — same reason as the constructor.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.byte[]Defensive copy on accessor — same reason as the constructor.toString()Hex render of both hashes, useful for logging and debugging.
-
Field Details
-
HASH_LENGTH_BYTES
public static final int HASH_LENGTH_BYTESExpected length, in bytes, of each component.- See Also:
-
-
Constructor Details
-
EIP712TypedData
public EIP712TypedData(byte[] domainSeparator, byte[] structHash) Creates an instance of aEIP712TypedDatarecord class.- Parameters:
domainSeparator- the value for thedomainSeparatorrecord componentstructHash- the value for thestructHashrecord component
-
-
Method Details
-
domainSeparator
public byte[] domainSeparator()Defensive copy on accessor — same reason as the constructor. -
structHash
public byte[] structHash()Defensive copy on accessor — same reason as the constructor. -
toString
Hex render of both hashes, useful for logging and debugging. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).
-