types

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 22 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApproveMachinePathListCalldata added in v0.0.23

func ApproveMachinePathListCalldata(
	extensionID common.Hash,
	nonce uint64,
	messageHash common.Hash,
) ([]byte, error)

ApproveMachinePathListCalldata returns the calldata of MachinePathManagerFacet.approveMachinePathList(extensionId, nonce, messageHash) — the inner call a governance Safe makes to approve a finalized machine path list. Verifiers compare a Safe execTransaction's `data` against this expected value to bind the approval to the full list content (messageHash commits to the paths).

func DecodeTeeAttestationRequest

func DecodeTeeAttestationRequest(attReq []byte) (verification.IVerificationTeeAttestation, error)

DecodeTeeAttestationRequest decodes the attestation request bytes into the strongly typed struct.

func EncodeTeeAttestationRequest

func EncodeTeeAttestationRequest(req *verification.IVerificationTeeAttestation) (hexutil.Bytes, error)

EncodeTeeAttestationRequest serializes the attestation request using the generated struct ABI.

func GovernanceHash added in v0.0.21

func GovernanceHash(signers []common.Address, threshold uint64) (common.Hash, error)

GovernanceHash returns keccak256(abi.encode(address[], uint256)) for the given (signers, threshold) tuple — the same value the on-chain contract stores as `bytes32 governanceHash`.

func GovernanceHashSafe added in v0.0.23

func GovernanceHashSafe(teeManager, safe common.Address, owners []common.Address, threshold uint64) (common.Hash, error)

GovernanceHashSafe returns keccak256(abi.encode(teeManager, safe, owners, threshold)) — the governance hash the ExtensionGovernanceFacet stores for Safe-backed governance registered via setNewTeeGovernanceSafe. teeManager is the FlareTeeManager diamond address (address(this) in the facet) and owners and threshold are the Safe's owner set and threshold snapshotted at registration.

func KeyExistenceDataHash added in v0.0.21

func KeyExistenceDataHash(proof *wallet.IWalletKeyManagerKeyExistence) (common.Hash, error)

KeyExistenceDataHash returns keccak256(abi.encode(proof)), the inner dataHash WalletKeyManagerFacet.confirmKey wraps with SignedPayload.messageHash(TEE_KEY_EXISTENCE, ...). Callers wrap this value with signing.Payload{csigning.TEEKeyExistence, chainID, dataHash}.Hash() before signing or comparing.

func MachinePathListDataHash added in v0.0.21

func MachinePathListDataHash(
	extensionID common.Hash,
	nonce uint64,
	paths []machinepath.IMachinePathManagerMachinePath,
) (common.Hash, error)

MachinePathListDataHash returns keccak256(abi.encode(extensionId, nonce, paths)) — the inner dataHash MachinePathManagerFacet.finalize wraps with SignedPayload.messageHash(TEE_MACHINE_PATH_LIST, ...) to produce the on-chain pathList.messageHash. Callers wrap this value with signing.Payload{signing.TEEMachinePathList, chainID, dataHash} before signing or comparing against the on-chain messageHash. paths is encoded as tuple(address[] sourceTeeIds, address[] destinationTeeIds)[].

func ParsePaymentInstruction

ParsePaymentInstruction decodes the payment instruction payload into the XRPL struct representation.

func ParsePubKey

func ParsePubKey(key PublicKey) (*ecdsa.PublicKey, error)

ParsePubKey converts the serialized public key into an ECDSA key.

func ParsePubKeyBytes

func ParsePubKeyBytes(key []byte) (*ecdsa.PublicKey, error)

ParsePubKeyBytes converts key that consists of concatenated X and Y coordinates into an ECDSA public key. Key is [X||Y] where X and Y are 32 bytes each.

func ParseVRFInstruction

func ParseVRFInstruction(data *instruction.DataFixed) (vrfstruct.IVrfVrfInstructionMessage, error)

ParseVRFInstruction decodes the VRF instruction payload into the shared go-flare-common struct representation.

func PubKeyToBytes

func PubKeyToBytes(key *ecdsa.PublicKey) []byte

PubKeyToBytes returns the concatenated x and y coordinates of the key.

Types

type Action

type Action struct {
	Data                       ActionData      `json:"data"`
	AdditionalVariableMessages []hexutil.Bytes `json:"additionalVariableMessages"`
	Timestamps                 []uint64        `json:"timestamps"`
	AdditionalActionData       hexutil.Bytes   `json:"additionalActionData"`
	Signatures                 []hexutil.Bytes `json:"signatures"`
}

type ActionData

type ActionData struct {
	ID            common.Hash   `json:"id"`
	Type          ActionType    `json:"type"`
	SubmissionTag SubmissionTag `json:"submissionTag"`
	Message       hexutil.Bytes `json:"message"`
}

type ActionInfo

type ActionInfo struct {
	QueueID       string        `json:"queueId"`
	ActionID      common.Hash   `json:"actionId"`
	SubmissionTag SubmissionTag `json:"submissionTag"`
}

type ActionResponse

type ActionResponse struct {
	Result         ActionResult  `json:"result"`
	Signature      hexutil.Bytes `json:"signature"`
	ProxySignature hexutil.Bytes `json:"proxySignature"`
}

type ActionResult

type ActionResult struct {
	ID            common.Hash   `json:"id"`
	SubmissionTag SubmissionTag `json:"submissionTag"`
	Status        uint8         `json:"status"`
	Log           string        `json:"log"`

	OPType                 common.Hash   `json:"opType"`
	OPCommand              common.Hash   `json:"opCommand"`
	AdditionalResultStatus hexutil.Bytes `json:"additionalResultStatus"`

	Version string        `json:"version"`
	Data    hexutil.Bytes `json:"data"`
}

The response received after queuing an action

func (*ActionResult) Hash added in v0.0.20

func (ar *ActionResult) Hash() []byte

Hash returns keccak256(keccak256(data) || id || keccak256(submissionTag) || status).

type ActionType

type ActionType string
const (
	Instruction ActionType = "instruction"
	Direct      ActionType = "direct"
)

type ConfigureChainIDRequest added in v0.0.21

type ConfigureChainIDRequest struct {
	ChainID *uint64 `json:"chainId"`
}

type ConfigureExtensionIDRequest

type ConfigureExtensionIDRequest struct {
	ExtensionID *common.Hash `json:"extensionId"`
}

type ConfigureGovernanceRequest added in v0.0.21

type ConfigureGovernanceRequest struct {
	Signers   *[]common.Address `json:"signers"`
	Threshold *uint64           `json:"threshold"`
	// Safe and TeeManager configure Safe-backed governance; both must be set
	// together, and omitting them configures plain governance.
	Safe       *common.Address `json:"safe,omitempty"`
	TeeManager *common.Address `json:"teeManager,omitempty"`
}

type ConfigureInitialOwnerRequest

type ConfigureInitialOwnerRequest struct {
	Owner *common.Address `json:"owner"`
}

type ConfigureProxyURLRequest

type ConfigureProxyURLRequest struct {
	URL *string `json:"url"` // The pointer ensures {} and {"url": ""} unmarshal distinctly.

}

type DecryptRequest

type DecryptRequest struct {
	EncryptedMessage []byte `json:"encryptedMessage"`
}

type DecryptResponse

type DecryptResponse struct {
	DecryptedMessage []byte `json:"decryptedMessage"`
}

type DirectInstruction

type DirectInstruction struct {
	OPType    common.Hash   `json:"opType"`
	OPCommand common.Hash   `json:"opCommand"`
	Message   hexutil.Bytes `json:"message"`
}

type Governance added in v0.0.21

type Governance struct {
	Signers    []common.Address `json:"signers"`
	Threshold  uint64           `json:"threshold"`
	Hash       common.Hash      `json:"hash"`
	Safe       common.Address   `json:"safe"`
	TeeManager common.Address   `json:"teeManager"`
}

Governance is the governance signer-set known to the node. Two flavors exist, discriminated by Safe:

  • plain: Hash is keccak256(abi.encode(Signers, Threshold)) and Safe is the zero address;
  • Safe-backed: Signers/Threshold are the snapshot of the Safe multisig's owners and threshold recorded on-chain at registration, and Hash is keccak256(abi.encode(TeeManager, Safe, Signers, Threshold)).

Both match the value stored on-chain as governanceHash.

type InitializePolicyRequest

type InitializePolicyRequest struct {
	InitialPolicyBytes []byte
	PublicKeys         []PublicKey
}

type KeyInfo added in v0.0.20

type KeyInfo struct {
	WalletID common.Hash `json:"walletId"`
	KeyID    uint64      `json:"keyId"`
	Nonce    uint64      `json:"nonce"`
}

KeyInfo identifies a wallet key together with its current replay-protection nonce.

type MachineData

type MachineData struct {
	ExtensionID    common.Hash    `json:"extensionId"`
	InitialOwner   common.Address `json:"initialOwner"`
	CodeHash       common.Hash    `json:"codeHash"`
	Platform       common.Hash    `json:"platform"`
	PublicKey      PublicKey      `json:"publicKey"`
	GovernanceHash common.Hash    `json:"governanceHash"`
}

func (*MachineData) DataHash added in v0.0.21

func (md *MachineData) DataHash() (common.Hash, error)

DataHash returns keccak256(abi.encode(teeMachineData)) — the inner dataHash MachineManagerFacet.register wraps with SignedPayload.messageHash(TEE_MACHINE_REGISTER, ...). Callers wrap this value with signing.Payload{TeeMachineRegisterTag, chainID, dataHash}.Hash() before signing or comparing.

type MultiSignedPolicy

type MultiSignedPolicy struct {
	PolicyBytes []byte
	Signatures  [][]byte
}

type OpID

type OpID struct {
	OPType    common.Hash `json:"opType"`
	OPCommand common.Hash `json:"opCommand"`
}

func GetOpID

func GetOpID(a *Action) (OpID, error)

GetOpID extracts OpID from the action.

func (OpID) String

func (i OpID) String() string

String returns the textual representation of the operation identifiers.

type ProveRandomnessResponse

type ProveRandomnessResponse struct {
	WalletID common.Hash      `json:"walletId"`
	KeyID    uint64           `json:"keyId"`
	Nonce    hexutil.Bytes    `json:"nonce"`
	Proof    walletsvrf.Proof `json:"proof"`
}

type PublicKey

type PublicKey struct {
	X common.Hash `json:"x"`
	Y common.Hash `json:"y"`
}

func PubKeyToStruct

func PubKeyToStruct(key *ecdsa.PublicKey) PublicKey

PubKeyToStruct converts an ECDSA public key into the fixed-size struct form.

type RewardingData

type RewardingData struct {
	VoteSequence   VoteSequence  `json:"voteSequence"`
	AdditionalData hexutil.Bytes `json:"additionalData"`
	Version        string        `json:"version"`
	Signature      hexutil.Bytes `json:"signature"` // TEE signature of voteHash
}

type SetMachinePathListRequest added in v0.0.21

type SetMachinePathListRequest struct {
	Paths        []machinepath.IMachinePathManagerMachinePath
	Nonce        uint64
	Signatures   [][]byte
	SafeApproval *safe.Approval `json:",omitempty"`
}

SetMachinePathListRequest is the JSON payload of a SET_MACHINE_PATH_LIST direct instruction: the active list of authorized machine paths, its monotonic nonce, and the governance authorization for it. A path authorizes any (source, destination) pair where source is in SourceTeeIds and destination is in DestinationTeeIds.

Two authorization forms exist and either satisfies the node:

  • Signatures: direct governance-signer ECDSA signatures over signing.Payload{signing.TEEMachinePathList, chainID, MachinePathListDataHash(...)} (collected from signMachinePathList transactions);
  • SafeApproval: for a single approveMachinePathList call by the governance Safe (Safe-backed governance only), the execTransaction parameter set (owners' signatures blob included) and the Safe nonce it executed at. The node reconstructs the Safe transaction hash at that nonce and re-verifies the owner signatures itself.

type SignRequest

type SignRequest struct {
	Message []byte `json:"message"`
}

type SignResponse

type SignResponse struct {
	Message   []byte `json:"message"`
	Signature []byte `json:"signature"`
}

type SignedKeyDirectBackup added in v0.0.21

type SignedKeyDirectBackup struct {
	Payload      hexutil.Bytes `json:"payload"`
	TEESignature hexutil.Bytes `json:"teeSignature"`
}

SignedKeyDirectBackup is the envelope produced by KEY_DIRECT_BACKUP. Payload is a JSON-encoded KeyDirectBackupPayload; TEESignature is the source TEE's signature over signing.Payload{TEEKeyDirectBackupTag, chainID, keccak256(Payload)}.Hash().

type SignedTeeInfoResponse

type SignedTeeInfoResponse struct {
	TeeInfoResponse
	ProxySignature hexutil.Bytes `json:"proxySignature"`
}

type SubmissionTag

type SubmissionTag string
const (
	// Submission tags for instruction action
	Threshold SubmissionTag = "threshold"
	End       SubmissionTag = "end"
	Submit    SubmissionTag = "submit"
)

type TeeInfo

type TeeInfo struct {
	Challenge                common.Hash `json:"challenge"`
	PublicKey                PublicKey   `json:"publicKey"`
	InitialSigningPolicyID   uint32      `json:"initialSigningPolicyId"`
	InitialSigningPolicyHash common.Hash `json:"initialSigningPolicyHash"`
	LastSigningPolicyID      uint32      `json:"lastSigningPolicyId"`
	LastSigningPolicyHash    common.Hash `json:"lastSigningPolicyHash"`
	ChainID                  uint64      `json:"chainId"`
	State                    TeeState    `json:"state"`
	TeeTimestamp             uint64      `json:"teeTimestamp"`
	MachinePathListNonce     uint64      `json:"machinePathListNonce"`
	MachinePathListHash      common.Hash `json:"machinePathListHash"`
}

func (*TeeInfo) Hash

func (ti *TeeInfo) Hash() ([]byte, error)

Hash encodes and hashes the TEE attestation payload.

type TeeInfoRequest

type TeeInfoRequest struct {
	Challenge common.Hash
}

type TeeInfoResponse

type TeeInfoResponse struct {
	TeeInfo       TeeInfo       `json:"teeInfo"`
	MachineData   MachineData   `json:"machineData"`
	DataSignature hexutil.Bytes `json:"dataSignature"`
	Attestation   string        `json:"attestation"`
}

type TeeState

type TeeState struct {
	SystemState        hexutil.Bytes `json:"systemState"`
	SystemStateVersion common.Hash   `json:"systemStateVersion"`
	State              hexutil.Bytes `json:"state"`
	StateVersion       common.Hash   `json:"stateVersion"`
}

type UpdatePolicyRequest

type UpdatePolicyRequest struct {
	NewPolicy  MultiSignedPolicy
	PublicKeys []PublicKey
}

type VoteSequence

type VoteSequence struct {
	VoteHash                        common.Hash     `json:"voteHash"`
	InstructionID                   common.Hash     `json:"instructionId"`
	InstructionHash                 common.Hash     `json:"instructionHash"`
	RewardEpochID                   uint32          `json:"rewardEpochId"`
	TeeID                           common.Address  `json:"teeId"`
	Signatures                      []hexutil.Bytes `json:"signatures"` // Signatures of the signers and cosigners
	AdditionalVariableMessageHashes []common.Hash   `json:"additionalVariableMessageHashes"`
	Timestamps                      []uint64        `json:"timestamps"`
}

type XRPSignResponse

type XRPSignResponse []map[string]any

Jump to

Keyboard shortcuts

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