crypto

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MnWordNumber12 = 12
	MnWordNumber24 = 24
)
View Source
const (
	TotalShares     = 2
	ThresholdShares = 2
)

Variables

This section is empty.

Functions

func AesDecryptCTR

func AesDecryptCTR(data, key, iv []byte) ([]byte, error)

func AesEncryptCTR

func AesEncryptCTR(data, key, iv []byte) ([]byte, error)

func DecryptText

func DecryptText(cipherText, password []byte) ([]byte, error)

func EncryptText

func EncryptText(clearText, password []byte) ([]byte, error)

func GenerateMnemonic

func GenerateMnemonic(wordNumber int) (string, error)

func IsValidMnemonic

func IsValidMnemonic(mn string) bool

func PerformRecover

func PerformRecover(formattedShares []string) (string, error)

func PerformSplit

func PerformSplit(mn string) ([]string, error)

func ReadFromGethKeyStore

func ReadFromGethKeyStore(ksString string, password string) (string, error)

func ReadFromKeyStore

func ReadFromKeyStore(ksString, password string, isMn bool) (string, error)

func RsaDecryptWithPriv

func RsaDecryptWithPriv(priv []byte, cipherText []byte) ([]byte, error)

func RsaEncryptWithPub

func RsaEncryptWithPub(pub []byte, plainText []byte) ([]byte, error)

func SSSCombine

func SSSCombine(shares [][]byte) ([]byte, error)

func SSSSplit

func SSSSplit(data []byte, n, t int) ([][]byte, error)

func WriteToKeyStore

func WriteToKeyStore(name, text, password string, isMn bool) (string, error)

Types

type ActiveAccount

type ActiveAccount struct {
	Address        string `json:"address"`
	Coin           int    `json:"coin"`
	DerivationPath string `json:"derivationPath"`
}

type CryptoStruct

type CryptoStruct struct {
	Cipher       string `json:"cipher"`
	Cipherparams struct {
		Iv string `json:"iv"`
	} `json:"cipherparams"`
	Ciphertext string `json:"ciphertext"`
	Kdf        string `json:"kdf"`
	Kdfparams  struct {
		Dklen int    `json:"dklen"`
		N     int    `json:"n"`
		P     int    `json:"p"`
		R     int    `json:"r"`
		Salt  string `json:"salt"`
	} `json:"kdfparams"`
	Mac string `json:"mac"`
}

type GethKeyStore

type GethKeyStore struct {
	Address string       `json:"address"`
	Crypto  CryptoStruct `json:"crypto"`
	Id      string       `json:"id"`
	Version int          `json:"version"`
}

type KeyStore

type KeyStore struct {
	ActiveAccounts []ActiveAccount `json:"activeAccounts"`
	Crypto         CryptoStruct    `json:"crypto"`
	Id             string          `json:"id"`
	Name           string          `json:"name"`
	Type           string          `json:"type"`
	Version        int             `json:"version"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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