ssv

package
v0.0.0-...-28d388b Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertPemToPrivateKey

func ConvertPemToPrivateKey(skPem string) (*rsa.PrivateKey, error)

ConvertPemToPrivateKey return rsa private key from secret key

func CreateThreshold

func CreateThreshold(skBytes []byte, operators []*Operator) (map[uint64]*IShare, error)

CreateThreshold receives a bls.SecretKey hex and count. Will split the secret key into count shares

func DecodeKey

func DecodeKey(sk *rsa.PrivateKey, hashBase64 string) (string, error)

DecodeKey with secret key (base64) and hash (base64), return the encrypted key string

func ExtractPublicKey

func ExtractPublicKey(sk *rsa.PrivateKey) (string, error)

ExtractPublicKey get public key from private key and return base64 encoded public key

func GenerateKeys

func GenerateKeys() ([]byte, []byte, error)

GenerateKeys using rsa random generate keys and return []byte bas64

func GenerateKeysBase64

func GenerateKeysBase64() (string, string, error)

GenerateKeysBase64 ssv 公私钥生成

func KeystoreShareV2ForJson

func KeystoreShareV2ForJson(validatorPublicKey, version, ssvAmount string, skBytes []byte, operators []*Operator) (string, error)

KeystoreShareV2ForJson keystore 分片json结果

func PrivateKeyToByte

func PrivateKeyToByte(sk *rsa.PrivateKey) []byte

PrivateKeyToByte converts privateKey to []byte

Types

type IShare

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

type KeystoreShareData

type KeystoreShareData struct {
	PublicKey string      `json:"publicKey"`
	Operators []*Operator `json:"operators"`
	Shares    *Shares     `json:"shares"`
}

type KeystoreShareInfo

type KeystoreShareInfo struct {
	// 分片的索引号
	ID uint64
	// 分片公钥
	PublicKey string

	// 分片加密后的私钥
	EncryptedKey    string
	AbiEncryptedKey string
	// 该分片选择的operator
	Operator *Operator
	// contains filtered or unexported fields
}

KeystoreShareInfo ssv KeystoreShare 业务计算结构

func EncryptShares

func EncryptShares(skBytes []byte, operators []*Operator) ([]*KeystoreShareInfo, error)

EncryptShares 构造分片的加密公私钥对

type KeystoreShareRes

type KeystoreShareRes struct {
	Version string `json:"version"`

	Data *KeystoreShareData `json:"data"`

	Payload struct {
		Readable *Payload `json:"readable"`
		Raw      string   `json:"raw"`
	} `json:"payload"`

	CreatedAt time.Time `json:"createdAt"`
}

KeystoreShareRes keystore分片返回的最终结果

func KeystoreShareV2

func KeystoreShareV2(validatorPublicKey, version, ssvAmount string, skBytes []byte, operators []*Operator) (*KeystoreShareRes, error)

KeystoreShareV2 keystore 分片结果

type Operator

type Operator struct {
	Id        int    `json:"id"`
	PublicKey string `json:"publicKey"`
	Fee       uint64 `json:"-"`
}

Operator ssv operator 信息

type Payload

type Payload struct {
	ValidatorPublicKey string   `json:"validatorPublicKey"`
	OperatorIds        string   `json:"operatorIds"`
	SharePublicKeys    []string `json:"sharePublicKeys"`

	AbiSharePrivateKeys []string `json:"sharePrivateKey"`
	SsvAmount           string   `json:"ssvAmount"`
	// contains filtered or unexported fields
}

Payload ssv 智能合约交易信息

type Shares

type Shares struct {
	PublicKeys    []string `json:"publicKeys"`
	EncryptedKeys []string `json:"encryptedKeys"`
}

Shares keystore 分片信息

Jump to

Keyboard shortcuts

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