modulepackage
0.0.0-20240520164845-49c2c58bf4b8
Repository: https://github.com/tumbler/nanokeymanager.git
Documentation: pkg.go.dev
# README
nanoKeyManager
A go module to generate or manipulate addresses for the crytpocurrenty nano.
Features:
- Can generate cryptographically safe addresses
- Can derive public addresses and their ascii counterparts
- Can translate seeds to/from bip39 mnemonics
- Can derive any address from its seed and index
Examples
Generate a new seed
var seed nanoKeyManger.Key
// Generates a new seed. Defaults to index 0.
nanoKeyManger.GenerateSeed(&seed)
// Print address of index 0.
fmt.Println(seed)
Derive keys with a given seed
var seed nanoKeyManger.Key
seed.Seed = userInputSeed
seed.Index = userInputIndex
// Derive public keys based on seed/index
nanoKeyManager.SeedToKeys(&seed)
fmt.Println(seed)
Derive public key from ascii address
var nanoAddress string
var pubKey []byte
var err error
nanoAddress = userAddress
pubKey, err = nanoKeyManager.AddressToPubKey(nanoAddress)
if (err != nil) {
// Handle error
}
// Now go in reverse
var reDerivedAddress string
reDerivedAddress, err = nanoKeyManager.PubKeyToAddress(pubKey)
if (err != nil) {
// Handle error
}
// reDerivedAddress == nanoAddress
For further reading examine seeds.go
# Functions
AddressToPubKey takes a nano address and converts it to the corresponding public key.
ChecksumSha uses the sha256 algorithm to hash the data and returns one byte to use as a checksum.
GenerateSeed gets entropy and generates a new mnemonic/seed pair along with their public keys.
GenerateSeedFromMnemonic converts an exisiting BIP39 mnemonic to a nano seed.
Generate array of 11 bit ints to be used for bip39 word generation.
NanoAddressChecksum finds the checksum for the public nano address from a public key.
NanoED25519PublicKey uses the ED25519 curve to derive public key.
No description provided by the author
ReinitSeed returns the given Key to all its default values.
SeedToKeys takes a prepopulated seed from a key struct and gernerates the corresponding private key, public key, and public nano address.
SeedToMnemonic takes a nano seed and returns the corresponding BIP39 compliant mnemonic.
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author