crypto

package
v0.0.0-...-08ff881 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthCrypto        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCrypto          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCrypto = fmt.Errorf("proto: unexpected end of group")
)

Functions

func DecryptAES256GCM

func DecryptAES256GCM(ciphertext []byte, password string) ([]byte, error)

DecryptAES256GCM decrypts the given ciphertext using AES-256-GCM with the given password.

func DecryptAES256GCMBase64

func DecryptAES256GCMBase64(ciphertextBase64 string, password string) (string, error)

DecryptAES256GCMBase64 decrypts the given base64-encoded ciphertext using AES-256-GCM with the given password.

func EncryptAES256GCM

func EncryptAES256GCM(plaintext []byte, password string) ([]byte, error)

EncryptAES256GCM encrypts the given plaintext using AES-256-GCM with the given password.

func EncryptAES256GCMBase64

func EncryptAES256GCMBase64(plaintext string, password string) (string, error)

EncryptAES256GCMBase64 encrypts the given string plaintext using AES-256-GCM with the given password and returns the base64-encoded ciphertext.

func GetAddressFromPubkeyString

func GetAddressFromPubkeyString(pubkey string) (sdk.AccAddress, error)

func GetPubkeyBech32FromRecord

func GetPubkeyBech32FromRecord(record *keyring.Record) (string, error)

func GetTssAddrBTC

func GetTssAddrBTC(tssPubkey string, bitcoinParams *chaincfg.Params) (string, error)

GetTssAddrBTC returns the bitcoin address of the tss pubkey

func GetTssAddrEVM

func GetTssAddrEVM(tssPubkey string) (ethcommon.Address, error)

GetTssAddrEVM returns the ethereum address of the tss pubkey

func IsEmptyAddress

func IsEmptyAddress(address common.Address) bool

IsEmptyAddress returns true if the address is empty

Types

type PubKey

type PubKey string
var EmptyPubKey PubKey

func NewPubKey

func NewPubKey(key string) (PubKey, error)

func (PubKey) Equals

func (pubKey PubKey) Equals(pubKey1 PubKey) bool

Equals check whether two are the same

func (PubKey) GetAddress

func (pubKey PubKey) GetAddress(chain chains.Chain) (chains.Address, error)

GetAddress will return an address for the given chain

func (PubKey) GetEVMAddress

func (pubKey PubKey) GetEVMAddress() (chains.Address, error)

GetEVMAddress will return the evm address

func (PubKey) IsEmpty

func (pubKey PubKey) IsEmpty() bool

IsEmpty to check whether it is empty

func (PubKey) MarshalJSON

func (pubKey PubKey) MarshalJSON() ([]byte, error)

MarshalJSON to Marshals to JSON using Bech32

func (PubKey) String

func (pubKey PubKey) String() string

String stringer implementation

func (*PubKey) UnmarshalJSON

func (pubKey *PubKey) UnmarshalJSON(data []byte) error

UnmarshalJSON to Unmarshal from JSON assuming Bech32 encoding

type PubKeySet

type PubKeySet struct {
	Secp256k1 PubKey `protobuf:"bytes,1,opt,name=secp256k1,proto3,casttype=PubKey" json:"secp256k1,omitempty"`
	Ed25519   PubKey `protobuf:"bytes,2,opt,name=ed25519,proto3,casttype=PubKey" json:"ed25519,omitempty"`
}

PubKeySet contains two pub keys , secp256k1 and ed25519

func (*PubKeySet) Descriptor

func (*PubKeySet) Descriptor() ([]byte, []int)

func (*PubKeySet) GetEd25519

func (m *PubKeySet) GetEd25519() PubKey

func (*PubKeySet) GetSecp256k1

func (m *PubKeySet) GetSecp256k1() PubKey

func (*PubKeySet) Marshal

func (m *PubKeySet) Marshal() (dAtA []byte, err error)

func (*PubKeySet) MarshalTo

func (m *PubKeySet) MarshalTo(dAtA []byte) (int, error)

func (*PubKeySet) MarshalToSizedBuffer

func (m *PubKeySet) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PubKeySet) ProtoMessage

func (*PubKeySet) ProtoMessage()

func (*PubKeySet) Reset

func (m *PubKeySet) Reset()

func (*PubKeySet) Size

func (m *PubKeySet) Size() (n int)

func (*PubKeySet) String

func (m *PubKeySet) String() string

func (*PubKeySet) Unmarshal

func (m *PubKeySet) Unmarshal(dAtA []byte) error

func (*PubKeySet) XXX_DiscardUnknown

func (m *PubKeySet) XXX_DiscardUnknown()

func (*PubKeySet) XXX_Marshal

func (m *PubKeySet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PubKeySet) XXX_Merge

func (m *PubKeySet) XXX_Merge(src proto.Message)

func (*PubKeySet) XXX_Size

func (m *PubKeySet) XXX_Size() int

func (*PubKeySet) XXX_Unmarshal

func (m *PubKeySet) XXX_Unmarshal(b []byte) error

type PubKeys

type PubKeys []PubKey

func (PubKeys) Contains

func (pks PubKeys) Contains(pk PubKey) bool

func (PubKeys) Equals

func (pks PubKeys) Equals(newPks PubKeys) bool

Equals check whether two pub keys are identical

func (PubKeys) String

func (pks PubKeys) String() string

String implement stringer interface

func (PubKeys) Strings

func (pks PubKeys) Strings() []string

func (PubKeys) Valid

func (pks PubKeys) Valid() error

Jump to

Keyboard shortcuts

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