signature

package
Version: v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 7 Imported by: 18

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 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 string, network uint8) (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

Source Files

Jump to

Keyboard shortcuts

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