utils

package
v0.0.0-...-546ba10 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBase32

func DecodeBase32(base32Str string) ([]byte, error)

DecodeBase32 decodes a Base32 string into a byte slice

func EncodeBase32

func EncodeBase32(data []byte) string

EncodeBase32 encodes a byte slice into a Base32 string without padding

func GenerateMacKey

func GenerateMacKey(combinedParts []byte, hashedPasskey []byte) ([]byte, []byte, error)

GenerateMacKeyAndChainCode generates the MacKey (root hash) and chain code It stores both the MacKey and chain code in memory for future use.

func Recovery

func Recovery(message []byte, requiredParticipants []string, quorum int, passkey, passphrase string) ([]byte, error)

Recovery is a utility function to recover a wallet's key using a multi-signature scheme. It takes in the following parameters: - message: The message or data to be signed for the recovery process - requiredParticipants: List of participants whose signatures are required for recovery - quorum: The minimum number of signatures needed to successfully recover the wallet - passkey: A base32 encoded passkey used for authentication - passphrase: A passphrase used to further verify the user's identity (along with passkey)

The function will return a recovery proof (e.g., a multi-signature wallet key) if successful, or an error if the recovery fails.

func VerifyBase32Passkey

func VerifyBase32Passkey(base32Passkey string) (bool, []byte, []byte, error)

VerifyBase32Passkey verifies the MacKey and checks the chain code in memory If the MacKey and chain code are found, it prints the MacKey.

func VerifyChainCode

func VerifyChainCode(decodepasskey []byte, macKey []byte) (bool, error)

VerifyChainCode verifies that the ChainCode stored in memory matches the newly generated ChainCode

Types

type WalletConfig

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

WalletConfig handles the storage and retrieval of keys in the keystore directory.

func NewWalletConfig

func NewWalletConfig() (*WalletConfig, error)

NewWalletConfig initializes a new WalletConfig with a LevelDB instance for key storage.

func (*WalletConfig) Close

func (config *WalletConfig) Close()

Close closes the LevelDB database when done.

func (*WalletConfig) GetDB

func (config *WalletConfig) GetDB() *leveldb.DB

Get database

func (*WalletConfig) LoadKeyPair

func (config *WalletConfig) LoadKeyPair() ([]byte, []byte, error)

LoadKeyPair retrieves the combined data and splits it back into SK and PK.

func (*WalletConfig) SaveKeyPair

func (config *WalletConfig) SaveKeyPair(combinedData []byte, pk []byte) error

SaveKeyPair saves the combined encrypted data in LevelDB and as a .dat file

Jump to

Keyboard shortcuts

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