crypto

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEVICE_PRIVKEY_FILE = "sonr-device.privkey"
	MASTER_PRIVKEY_FILE = "sonr-master.privkey"
)

Variables

This section is empty.

Functions

func ExportWallet

func ExportWallet(kr keyring.Keyring, sname string, passphrase string) (string, error)

ExportWallet returns armored private key and public key

func ProvisionUid

func ProvisionUid(s string) string

func RestoreWallet

func RestoreWallet(sname string, armor string, passphrase string) (keyring.Keyring, error)

RestoreWallet restores a private key from ASCII armored format.

Types

type GenerateOption

type GenerateOption func(*options) error

func WithPassphrase

func WithPassphrase(s string) GenerateOption

type Group

type Group interface {
	GetRandomElement() *big.Int
	Mul(*big.Int, *big.Int) *big.Int
	Exp(*big.Int, *big.Int) *big.Int
	Inv(*big.Int) *big.Int
}

Group interface is used to enable the usage of different groups in some schemes. For example when we have a homomorphism f between two groups and we are proving that we know an f-preimage of an element - meaning that for a given v we know u such that f(u) = v. Note that this is an interface for modular arithmetic groups. For elliptic curve groups at the moment there is no need for an interface.

type KeySet

type KeySet interface {
	// Address returns the address of the keyset.
	Address() bytes.HexBytes

	// CopyToKeyring copies the keyset to the given keyring
	CopyToKeyring(k keyring.Keyring, sname string) (keyring.Info, error)

	// CryptoPrivKey returns the Secp256k1PrivKey as a libp2p crypto private key.
	CryptoPrivKey() crypto.PrivKey

	// CryptoPubKey returns the device key as a libp2p crypto public key.
	CryptoPubKey() crypto.PubKey

	// DID returns the DID of the keyset.
	DID(deviceId string) string

	// LegacyAminoPubKey returns the keyset as a legacy AminoPubKey.
	LegacyAminoPubKey() *multisig.LegacyAminoPubKey

	// PublicKeyBase58 returns the public key as a base58 encoded string.
	PublicKeyBase58() (string, error)

	// PeerID returns the peer ID of the keyset.
	PeerID() (peer.ID, error)

	// Secp256k1PrivKey returns the Secp256k1PrivKey as a libp2p crypto private key.
	Secp256k1PrivKey() *secp256k1.PrivKey

	// Export writes the keyset configuration to the given folder.
	Export(folder config.Folder) error
}

KeySet is the set of keys required to operate on the Sonr network.

func CreateKeySet

func CreateKeySet(seed string) (KeySet, error)

CreateKeySet creates a new key set from a given mnemonic seed

func GenerateKeyring

func GenerateKeyring(cnfg *config.SonrConfig, kr keyring.Keyring, options ...GenerateOption) (KeySet, string, error)

func LoadKeyset

func LoadKeyset(folder config.Folder) (KeySet, error)

Jump to

Keyboard shortcuts

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