rules

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessAccountData

type AccessAccountData struct {
	Paths []string
}

AccessAccountData is passed to 'OnAccessAccount' rules.

type Checkpoint

type Checkpoint struct {
	Epoch uint64
	Root  []byte
}

Checkpoint is part of SignBeaconAttestationData.

type CreateAccountData added in v0.9.0

type CreateAccountData struct{}

CreateAccountData is passed to 'OnCreateAccount' rules.

type LockAccountData

type LockAccountData struct{}

LockAccountData is passed to 'OnLockAccount' rules.

type LockWalletData

type LockWalletData struct{}

LockWalletData is passed to 'OnLockWallet' rules.

type ReqMetadata

type ReqMetadata struct {
	Account string
	PubKey  []byte
	IP      string
	Client  string
}

ReqMetadata contains request-specific metadata that can be used by the rules to help decide if a request should succeed or be denied.

type Result

type Result int

Result represents the result of running a set of rules.

const (
	UNKNOWN Result = iota
	APPROVED
	DENIED
	FAILED
)

Possible results of running a set of rules.

func (Result) String added in v0.9.0

func (r Result) String() string

String implements the stringer interface.

type Service

type Service interface {
	// OnListAccounts is called when a request to list accounts needs to be approved.
	OnListAccounts(ctx context.Context, metadata *ReqMetadata, req *AccessAccountData) Result
	// OnSign is called when a request to sign generic data needs to be approved.
	OnSign(ctx context.Context, metadata *ReqMetadata, req *SignData) Result
	// OnSignBeaconAttestation is called when a request to sign a beacon block attestation needs to be approved.
	OnSignBeaconAttestation(ctx context.Context, metadata *ReqMetadata, req *SignBeaconAttestationData) Result
	// OnSignBeaconAttestations is called when a request to sign multiple beacon block attestations needs to be approved.
	OnSignBeaconAttestations(ctx context.Context, metadata []*ReqMetadata, req []*SignBeaconAttestationData) []Result
	// OnSignBeaconProposal is called when a request to sign a beacon block proposal needs to be approved.
	OnSignBeaconProposal(ctx context.Context, metadata *ReqMetadata, req *SignBeaconProposalData) Result
	// OnLockWallet is called when a request to lock a wallet needs to be approved.
	OnLockWallet(ctx context.Context, metadata *ReqMetadata, req *LockWalletData) Result
	// OnUnlockWallet is called when a request to unlock a wallet needs to be approved.
	OnUnlockWallet(ctx context.Context, metadata *ReqMetadata, req *UnlockWalletData) Result
	// OnLockAccount is called when a request to lock an account needs to be approved.
	OnLockAccount(ctx context.Context, metadata *ReqMetadata, req *LockAccountData) Result
	// OnUnlockAccount is called when a request to unlock an account needs to be approved.
	OnUnlockAccount(ctx context.Context, metadata *ReqMetadata, req *UnlockAccountData) Result
	// OnCreateAccount is called when a request to create an account needs to be approved.
	OnCreateAccount(ctx context.Context, metadata *ReqMetadata, req *CreateAccountData) Result
	// ExportSlashingProtection exports the slashing protection data.
	ExportSlashingProtection(ctx context.Context) (map[[48]byte]*SlashingProtection, error)
	// ImportSlashingProtection impports the slashing protection data.
	ImportSlashingProtection(ctx context.Context, protection map[[48]byte]*SlashingProtection) error
}

Service is the interface that must be followed by a remote ruler for approval of requests.

type SignBeaconAttestationData

type SignBeaconAttestationData struct {
	Domain          []byte
	Slot            uint64
	CommitteeIndex  uint64
	BeaconBlockRoot []byte
	Source          *Checkpoint
	Target          *Checkpoint
}

SignBeaconAttestationData is passed to 'OnSignBeaconAttestation' rules.

type SignBeaconProposalData

type SignBeaconProposalData struct {
	Domain        []byte
	Slot          uint64
	ProposerIndex uint64
	ParentRoot    []byte
	StateRoot     []byte
	BodyRoot      []byte
}

SignBeaconProposalData is passed to 'OnSignBeaconProposal' rules.

type SignData

type SignData struct {
	Domain []byte
	Data   []byte
}

SignData is passed to 'Sign' rules.

type SlashingProtection added in v0.9.0

type SlashingProtection struct {
	PubKey                     []byte
	HighestProposedSlot        int64
	HighestAttestedSourceEpoch int64
	HighestAttestedTargetEpoch int64
}

SlashingProtection provides the slashing protection for a given key.

type UnlockAccountData

type UnlockAccountData struct{}

UnlockAccountData is passed to 'OnUnlockAccount' rules.

type UnlockWalletData

type UnlockWalletData struct{}

UnlockWalletData is passed to 'OnUnlockWallet' rules.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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