ocrkey

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrScalarTooBig = errors.Errorf("can't handle scalars greater than %d", curve25519.PointSize)
)

Functions

This section is empty.

Types

type ConfigPublicKey added in v0.9.3

type ConfigPublicKey [curve25519.PointSize]byte

ConfigPublicKey represents the public key for the config decryption keypair

func (ConfigPublicKey) MarshalJSON added in v0.9.3

func (cpk ConfigPublicKey) MarshalJSON() ([]byte, error)

func (ConfigPublicKey) Raw added in v0.9.10

func (cpk ConfigPublicKey) Raw() string

func (*ConfigPublicKey) Scan added in v0.9.3

func (cpk *ConfigPublicKey) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (ConfigPublicKey) String added in v0.9.3

func (cpk ConfigPublicKey) String() string

func (*ConfigPublicKey) UnmarshalJSON added in v0.9.3

func (cpk *ConfigPublicKey) UnmarshalJSON(input []byte) error

func (*ConfigPublicKey) UnmarshalText added in v0.9.10

func (cpk *ConfigPublicKey) UnmarshalText(bs []byte) error

func (ConfigPublicKey) Value added in v0.9.3

func (cpk ConfigPublicKey) Value() (driver.Value, error)

Value returns this instance serialized for database storage.

type EncryptedKeyBundle

type EncryptedKeyBundle struct {
	ID                    models.Sha256Hash     `json:"id" gorm:"primary_key"`
	OnChainSigningAddress OnChainSigningAddress `json:"onChainSigningAddress"`
	OffChainPublicKey     OffChainPublicKey     `json:"offChainPublicKey"`
	ConfigPublicKey       ConfigPublicKey       `json:"configPublicKey"`
	EncryptedPrivateKeys  []byte                `json:"-"`
	CreatedAt             time.Time             `json:"createdAt"`
	UpdatedAt             time.Time             `json:"updatedAt,omitempty"`
	DeletedAt             gorm.DeletedAt        `json:"deletedAt,omitempty"`
}

EncryptedKeyBundle holds an encrypted KeyBundle

func (*EncryptedKeyBundle) Decrypt

func (ekb *EncryptedKeyBundle) Decrypt(auth string) (*KeyBundle, error)

Decrypt returns the PrivateKeys in e, decrypted via auth, or an error

func (EncryptedKeyBundle) GetID added in v0.9.3

func (ekb EncryptedKeyBundle) GetID() string

func (*EncryptedKeyBundle) SetID added in v0.9.3

func (ekb *EncryptedKeyBundle) SetID(value string) error

func (EncryptedKeyBundle) TableName

func (EncryptedKeyBundle) TableName() string

type EncryptedOCRKeyExport added in v0.9.9

type EncryptedOCRKeyExport struct {
	ID                    models.Sha256Hash     `json:"id" gorm:"primary_key"`
	OnChainSigningAddress OnChainSigningAddress `json:"onChainSigningAddress"`
	OffChainPublicKey     OffChainPublicKey     `json:"offChainPublicKey"`
	ConfigPublicKey       ConfigPublicKey       `json:"configPublicKey"`
	Crypto                keystore.CryptoJSON   `json:"crypto"`
}

func (EncryptedOCRKeyExport) DecryptPrivateKey added in v0.9.9

func (export EncryptedOCRKeyExport) DecryptPrivateKey(auth string) (*KeyBundle, error)

DecryptPrivateKey returns the PrivateKey in export, decrypted via auth, or an error

type KeyBundle

type KeyBundle struct {
	ID models.Sha256Hash
	// contains filtered or unexported fields
}

KeyBundle represents the bundle of keys needed for OCR

func NewKeyBundle

func NewKeyBundle() (*KeyBundle, error)

NewKeyBundle makes a new set of OCR key bundles from cryptographically secure entropy

func NewKeyBundleFrom added in v0.9.3

func NewKeyBundleFrom(onChainSigning io.Reader, offChainSigning io.Reader, offChainEncryption io.Reader) (*KeyBundle, error)

func (*KeyBundle) ConfigDiffieHellman added in v0.9.3

func (pk *KeyBundle) ConfigDiffieHellman(base *[curve25519.PointSize]byte) (
	sharedPoint *[curve25519.PointSize]byte, err error,
)

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

func (*KeyBundle) Encrypt

func (pk *KeyBundle) Encrypt(auth string, scryptParams utils.ScryptParams) (*EncryptedKeyBundle, error)

Encrypt combines the KeyBundle into a single json-serialized bytes array and then encrypts

func (KeyBundle) GoStringer

func (pk KeyBundle) GoStringer() string

GoStringer reduces the risk of accidentally logging the private key

func (*KeyBundle) MarshalJSON

func (pk *KeyBundle) MarshalJSON() ([]byte, error)

MarshalJSON marshals the private keys into json

func (*KeyBundle) PublicKeyAddressOnChain

func (pk *KeyBundle) PublicKeyAddressOnChain() ocrtypes.OnChainSigningAddress

PublicKeyAddressOnChain returns public component of the keypair used in SignOnChain

func (*KeyBundle) PublicKeyConfig

func (pk *KeyBundle) PublicKeyConfig() [curve25519.PointSize]byte

PublicKeyConfig returns the public component of the keypair used in ConfigKeyShare

func (*KeyBundle) PublicKeyOffChain

func (pk *KeyBundle) PublicKeyOffChain() ocrtypes.OffchainPublicKey

PublicKeyOffChain returns the pbulic component of the keypair used in SignOffChain

func (*KeyBundle) SignOffChain

func (pk *KeyBundle) SignOffChain(msg []byte) (signature []byte, err error)

SignOffChain returns an EdDSA-Ed25519 signature on msg.

func (*KeyBundle) SignOnChain

func (pk *KeyBundle) SignOnChain(msg []byte) (signature []byte, err error)

SignOnChain returns an ethereum-style ECDSA secp256k1 signature on msg.

func (KeyBundle) String

func (pk KeyBundle) String() string

String reduces the risk of accidentally logging the private key

func (*KeyBundle) ToEncryptedExport added in v0.9.9

func (pk *KeyBundle) ToEncryptedExport(auth string, scryptParams utils.ScryptParams) (export []byte, err error)

func (*KeyBundle) UnmarshalJSON

func (pk *KeyBundle) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON constructs KeyBundle from raw json

type OffChainPublicKey

type OffChainPublicKey ed25519.PublicKey

func (OffChainPublicKey) GormDBDataType added in v0.10.0

func (OffChainPublicKey) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (OffChainPublicKey) GormDataType added in v0.10.0

func (OffChainPublicKey) GormDataType() string

GormDataType gorm common data type

func (OffChainPublicKey) MarshalJSON added in v0.9.6

func (ocpk OffChainPublicKey) MarshalJSON() ([]byte, error)

func (OffChainPublicKey) Raw added in v0.9.10

func (ocpk OffChainPublicKey) Raw() string

func (*OffChainPublicKey) Scan added in v0.10.0

func (ocpk *OffChainPublicKey) Scan(value interface{}) error

func (OffChainPublicKey) String added in v0.9.3

func (ocpk OffChainPublicKey) String() string

func (*OffChainPublicKey) UnmarshalJSON added in v0.9.6

func (ocpk *OffChainPublicKey) UnmarshalJSON(input []byte) error

func (*OffChainPublicKey) UnmarshalText added in v0.9.10

func (ocpk *OffChainPublicKey) UnmarshalText(bs []byte) error

func (OffChainPublicKey) Value added in v0.10.0

func (ocpk OffChainPublicKey) Value() (driver.Value, error)

type OnChainPublicKey

type OnChainPublicKey ecdsa.PublicKey

func (OnChainPublicKey) Address

type OnChainSigningAddress

type OnChainSigningAddress ocrtypes.OnChainSigningAddress

func (OnChainSigningAddress) MarshalJSON added in v0.9.3

func (ocsa OnChainSigningAddress) MarshalJSON() ([]byte, error)

func (*OnChainSigningAddress) Scan

func (ocsa *OnChainSigningAddress) Scan(value interface{}) error

func (OnChainSigningAddress) String added in v0.9.3

func (ocsa OnChainSigningAddress) String() string

func (*OnChainSigningAddress) UnmarshalJSON added in v0.9.3

func (ocsa *OnChainSigningAddress) UnmarshalJSON(input []byte) error

func (*OnChainSigningAddress) UnmarshalText added in v0.9.10

func (ocsa *OnChainSigningAddress) UnmarshalText(bs []byte) error

func (OnChainSigningAddress) Value

func (ocsa OnChainSigningAddress) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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