fdc

package
v0.0.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeRequest

func DecodeRequest(data []byte) (fdc2.IFdc2HubFdc2AttestationRequest, error)

DecodeRequest decodes bytes into an FDC2 attestation request.

func DecodeResponse

func DecodeResponse(data []byte) (fdc2.IFdc2HubFdc2ResponseHeader, error)

DecodeResponse decodes bytes into an FDC2 response header.

func EncodeRequest

EncodeRequest encodes an FDC2 attestation request to bytes.

func EncodeResponseHeader

func EncodeResponseHeader(header fdc2.IFdc2HubFdc2ResponseHeader) (hexutil.Bytes, error)

EncodeResponseHeader encodes an FDC2 response header to bytes.

func HashMessage

func HashMessage(
	chainID uint64,
	req fdc2.IFdc2HubFdc2AttestationRequest,
	responseBody []byte,
	cosigners []common.Address,
	cosignersThreshold uint64,
	timestamp uint64,
) (common.Hash, hexutil.Bytes, error)

HashMessage returns the SignedPayload preimage the on-chain Verification facet recovers FDC2 signatures against:

signing.Payload{signing.FDC2, chainID, keccak256(abi.encode(
    keccak256(abi.encode(header)),
    keccak256(abi.encode(requestBody)),
    keccak256(abi.encode(responseBody)),
))}.Hash()

The encoded header is returned alongside so callers can embed it verbatim in the proof response.

func RelayPrefixedHash added in v0.0.21

func RelayPrefixedHash(messageHash common.Hash) common.Hash

RelayPrefixedHash returns keccak256(0x010000000000 || messageHash) — the inner hash that both cosigner signatures (Verification.toCosignersMessageHash) and signing-policy data-provider signatures (Relay.relay() Mode 2, protocolId=1) are recovered against. eth_sign-wrap this value before signing or recovering. Returns a 32-byte hash.

The TEE's own signature path (Verification._verifyTeeSignature) recovers against the bare messageHash, so do not use this helper there.

Types

type ProveResponse

type ProveResponse struct {
	ResponseHeader         hexutil.Bytes   `json:"responseHeader"`
	RequestBody            hexutil.Bytes   `json:"requestBody"`
	ResponseBody           hexutil.Bytes   `json:"responseBody"`
	TEESignature           hexutil.Bytes   `json:"teeSignature"`
	CosignerSignatures     []hexutil.Bytes `json:"cosignerSignatures"`
	DataProviderSignatures hexutil.Bytes   `json:"dataProviderSignatures"`
}

ProveResponse represents the response structure for F_FDC2 PROVE opCommand.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL