Type Definitions
Payment Requirement
Returned by server in 402 response.
interface FHEPaymentRequirement {
scheme: 'fhe-transfer';
network: string;
chainId: number;
payTo: `0x${string}`;
maxAmountRequired: string;
asset: `0x${string}`;
resource: string;
description: string;
mimeType: string;
maxTimeoutSeconds: number;
facilitator?: string;
}
| Field | Type | Description |
|---|---|---|
scheme | string | Always 'fhe-transfer' |
network | string | Network name (e.g., 'sepolia') |
chainId | number | Chain ID (e.g., 11155111) |
payTo | address | Merchant address |
maxAmountRequired | string | Required amount in token decimals |
asset | address | ERC7984 token contract |
resource | string | Protected resource URL |
description | string | Human-readable description |
mimeType | string | Content type of resource |
maxTimeoutSeconds | number | Payment timeout |
facilitator | string | Optional facilitator URL |
Decryption Signature
User authorization for server-side decryption.
interface FHEDecryptionSignature {
signature: string;
publicKey: string;
privateKey: string;
userAddress: `0x${string}`;
contractAddresses: `0x${string}`[];
startTimestamp: number;
durationDays: number;
}
| Field | Type | Description |
|---|---|---|
signature | string | Wallet signature |
publicKey | string | Ephemeral public key |
privateKey | string | Ephemeral private key |
userAddress | address | User's Ethereum address |
contractAddresses | address[] | Authorized contracts |
startTimestamp | number | Unix timestamp |
durationDays | number | Validity period |
The privateKey is ephemeral, not the user's wallet key.
Payment Payload
Sent by client after transfer.
interface FHEPaymentPayload {
x402Version: 1;
scheme: 'fhe-transfer';
network: string;
chainId: number;
payload: {
txHash: `0x${string}`;
decryptionSignature: FHEDecryptionSignature;
};
}
| Field | Type | Description |
|---|---|---|
x402Version | number | Always 1 |
scheme | string | Always 'fhe-transfer' |
network | string | Network name |
chainId | number | Chain ID |
payload.txHash | string | Transfer transaction hash |
payload.decryptionSignature | object | Decryption authorization |
Verify Result
Response from facilitator verification.
interface FHEPaymentVerifyResult {
isValid: boolean;
invalidReason?: string;
txHash?: `0x${string}`;
amount?: string;
}
| Field | Type | Description |
|---|---|---|
isValid | boolean | Payment validity |
invalidReason | string | Error explanation |
txHash | string | Verified transaction |
amount | string | Decrypted amount |
ConfidentialTransfer Event
ERC7984 transfer event data.
interface ConfidentialTransferEvent {
from: `0x${string}`;
to: `0x${string}`;
amount: `0x${string}`;
}
| Field | Type | Description |
|---|---|---|
from | address | Sender |
to | address | Recipient |
amount | bytes32 | Encrypted handle |
The amount field is an encrypted handle, not the actual value.