config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OCR2OffchainConfigVersion = 2
	OCR3OffchainConfigVersion = 30
)
View Source
const SharedSecretSize = 16 // A 128-bit symmetric key

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptedSharedSecret

type EncryptedSharedSecret [SharedSecretSize]byte

type OracleIdentity

type OracleIdentity struct {
	OffchainPublicKey types.OffchainPublicKey
	OnchainPublicKey  types.OnchainPublicKey
	PeerID            string
	TransmitAccount   types.Account
}

type SharedSecretEncryptions

type SharedSecretEncryptions struct {
	// (secret key chosen by dealer) * g, X25519 point
	DiffieHellmanPoint [curve25519.PointSize]byte

	// keccak256 of plaintext sharedSecret.
	//
	// Since SharedSecretEncryptions are shared through a smart contract, each
	// oracle will see the same SharedSecretHash. After decryption, oracles can
	// check their sharedSecret against SharedSecretHash to prevent the dealer
	// from equivocating
	SharedSecretHash common.Hash

	// Encryptions of the shared secret with one entry for each oracle. The
	// i-th oracle can recover the key as follows:
	//
	// 1. key := Keccak256(DH(DiffieHellmanPoint, process' secret key))[:16]
	// 2. sharedSecret := AES128DecryptBlock(key, Encryptions[i])
	//
	// See Decrypt for details.
	Encryptions []EncryptedSharedSecret
}

SharedSecretEncryptions is the encryptions of SharedConfig.SharedSecret, using each oracle's SharedSecretEncryptionPublicKey.

We use a custom encryption scheme to be more space-efficient (compared to standard AEAD schemes, nacl crypto_box, etc...), which saves gas in transmission to the OCR2Aggregator.

func EncryptSharedSecret added in v0.1.1

func EncryptSharedSecret(
	keys []types.ConfigEncryptionPublicKey,
	sharedSecret *[SharedSecretSize]byte,
	rand io.Reader,
) (SharedSecretEncryptions, error)

EncryptSharedSecret constructs a SharedSecretEncryptions from a set of SharedSecretEncryptionPublicKeys, the sharedSecret, and a cryptographic randomness source

func EncryptSharedSecretDeterministic added in v0.1.1

func EncryptSharedSecretDeterministic(
	publicKeys []types.ConfigEncryptionPublicKey,
	sharedSecret *[SharedSecretSize]byte,
	ephemeralSk *[curve25519.ScalarSize]byte,
) (SharedSecretEncryptions, error)

EncryptSharedSecretDeterministic constructs a SharedSecretEncryptions from a set of ConfigEncryptionPublicKeys, the sharedSecret, and an ephemeral secret key

func (SharedSecretEncryptions) Decrypt

Decrypt returns the sharedSecret

func (SharedSecretEncryptions) Equal

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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