config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 XXXEncryptSharedSecret

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

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

func XXXEncryptSharedSecretInternal

func XXXEncryptSharedSecretInternal(
	publicKeys []types.ConfigEncryptionPublicKey,
	sharedSecret *[SharedSecretSize]byte,
	sk *[32]byte,
) SharedSecretEncryptions

XXXEncryptSharedSecretInternal constructs a SharedSecretEncryptions from a set of SharedSecretEncryptionPublicKeys, the sharedSecret, and an ephemeral secret key sk

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