ocr2key

package
v2.2.0-mercury-20230602 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 27 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToEncryptedJSON

func ToEncryptedJSON(key KeyBundle, password string, scryptParams utils.ScryptParams) (export []byte, err error)

ToEncryptedJSON returns encrypted JSON representing key

Types

type EncryptedOCRKeyExport

type EncryptedOCRKeyExport struct {
	KeyType           string              `json:"keyType"`
	ChainType         chaintype.ChainType `json:"chainType"`
	ID                string              `json:"id"`
	OnchainPublicKey  string              `json:"onchainPublicKey"`
	OffChainPublicKey string              `json:"offchainPublicKey"`
	ConfigPublicKey   string              `json:"configPublicKey"`
	Crypto            keystore.CryptoJSON `json:"crypto"`
}

EncryptedOCRKeyExport represents encrypted OCR key export

func (EncryptedOCRKeyExport) GetCrypto

type KeyBundle

type KeyBundle interface {
	// OnchainKeyring is used for signing reports (groups of observations, verified onchain)
	ocrtypes.OnchainKeyring
	// OffchainKeyring is used for signing observations
	ocrtypes.OffchainKeyring
	ID() string
	ChainType() chaintype.ChainType
	Marshal() ([]byte, error)
	Unmarshal(b []byte) (err error)
	Raw() Raw
	OnChainPublicKey() string
	// Decrypts ciphertext using the encryptionKey from an OCR2 OffchainKeyring
	NaclBoxOpenAnonymous(ciphertext []byte) (plaintext []byte, err error)
}

nolint

func FromEncryptedJSON

func FromEncryptedJSON(keyJSON []byte, password string) (KeyBundle, error)

FromEncryptedJSON returns key from encrypted json

func MustNewInsecure

func MustNewInsecure(reader io.Reader, chainType chaintype.ChainType) KeyBundle

MustNewInsecure returns key bundle based on the chain type or panics

func New

func New(chainType chaintype.ChainType) (KeyBundle, error)

New returns key bundle based on the chain type

type OffchainKeyring

type OffchainKeyring struct {
	// contains filtered or unexported fields
}

OffchainKeyring contains the secret keys needed for the OCR nodes to share secrets and perform aggregation.

This is currently an ed25519 signing key and a separate encryption key.

All its functions should be thread-safe.

func (*OffchainKeyring) ConfigDiffieHellman

func (ok *OffchainKeyring) ConfigDiffieHellman(point [curve25519.PointSize]byte) ([curve25519.PointSize]byte, error)

ConfigDiffieHellman returns the shared point obtained by multiplying someone's public key by a secret scalar ( in this case, the offchain key ring's encryption key.)

func (*OffchainKeyring) ConfigEncryptionPublicKey

func (ok *OffchainKeyring) ConfigEncryptionPublicKey() ocrtypes.ConfigEncryptionPublicKey

ConfigEncryptionPublicKey returns config public key

func (*OffchainKeyring) NaclBoxOpenAnonymous added in v2.3.0

func (ok *OffchainKeyring) NaclBoxOpenAnonymous(ciphertext []byte) (plaintext []byte, err error)

NaclBoxOpenAnonymous decrypts a message that was encrypted using the OCR2 Offchain public key

func (*OffchainKeyring) OffchainPublicKey

func (ok *OffchainKeyring) OffchainPublicKey() ocrtypes.OffchainPublicKey

OffchainPublicKey returns the public component of this offchain keyring.

func (*OffchainKeyring) OffchainSign

func (ok *OffchainKeyring) OffchainSign(msg []byte) (signature []byte, err error)

OffchainSign signs message using private key

type Raw

type Raw []byte

nolint

func (Raw) Key

func (raw Raw) Key() (kb KeyBundle)

Jump to

Keyboard shortcuts

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