signature

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestKeyringPairAlice = KeyringPair{
	URI:       "//Alice",
	PublicKey: []byte{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d},
	Address:   "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
}

Functions

func Sign

func Sign(data []byte, privateKeyURI string) ([]byte, error)

Sign signs data with the private key under the given derivation path, returning the signature. Requires the subkey command to be in path

func Verify

func Verify(data []byte, sig []byte, privateKeyURI string) (bool, error)

Verify verifies data using the provided signature and the key under the derivation path. Requires the subkey command to be in path

Types

type InspectKeyInfo

type InspectKeyInfo struct {
	AccountID    string `json:"accountId"`
	PublicKey    string `json:"publicKey"`
	SecretPhrase string `json:"secretPhrase"`
	SecretSeed   string `json:"secretSeed"`
	SS58Address  string `json:"ss58Address"`
}

InspectKeyInfo type is used as target from `subkey` inspect JSON output

type KeyringPair

type KeyringPair struct {
	// URI is the derivation path for the private key in subkey
	URI string
	// Address is an SS58 address
	Address string
	// PublicKey
	PublicKey []byte
}

func KeyringPairFromSecret

func KeyringPairFromSecret(seedOrPhrase, network string) (KeyringPair, error)

KeyringPairFromSecret creates KeyPair based on seed/phrase and network Leave network empty for default behavior

func LoadKeyringPairFromEnv

func LoadKeyringPairFromEnv() (kp KeyringPair, ok bool)

LoadKeyringPairFromEnv looks up whether the env variable TEST_PRIV_KEY is set and is not empty and tries to use its content as a private phrase, seed or URI to derive a key ring pair. Panics if the private phrase, seed or URI is not valid or the keyring pair cannot be derived Loads Network from TEST_NETWORK variable Leave TEST_NETWORK empty or unset for default

Jump to

Keyboard shortcuts

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