identity

package
v0.0.0-...-7e76903 Latest Latest
Warning

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

Go to latest
Published: May 14, 2016 License: ISC Imports: 9 Imported by: 0

Documentation

Overview

Package identity is responsible for creation and management of user identities.

Index

Constants

View Source
const (
	// BMPurposeCode is the purpose code used for HD key derivation.
	BMPurposeCode = 0x80000052
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Private

type Private struct {
	bmutil.Address
	NonceTrialsPerByte uint64
	ExtraBytes         uint64
	SigningKey         *btcec.PrivateKey
	EncryptionKey      *btcec.PrivateKey
	Behavior           uint32
}

Private contains the identity of the user, which includes private encryption and signing keys, POW parameters and the address that contains information about stream number and address version.

func ImportWIF

func ImportWIF(address, signingKeyWif, encryptionKeyWif string,
	nonceTrials, extraBytes uint64) (*Private, error)

ImportWIF creates a Private identity from the Bitmessage address and Wallet Import Format (WIF) signing and encryption keys.

func NewDeterministic

func NewDeterministic(passphrase string, initialZeros uint64, n int) ([]*Private,
	error)

NewDeterministic creates n identities based on a deterministic passphrase. Note that this does not create an address.

func NewHD

func NewHD(masterKey *hdkeychain.ExtendedKey, n uint32, stream uint32) (*Private, error)

NewHD generates a new hierarchically deterministic key based on BIP-BM01. Master key must be a private master key generated according to BIP32. `n' is the n'th identity to generate. NewHD also generates a v4 address based on the specified stream.

func NewRandom

func NewRandom(initialZeros int) (*Private, error)

NewRandom creates an identity based on a random data, with the required number of initial zeros in front (minimum 1). Each initial zero requires exponentially more work. Note that this does not create an address.

func (*Private) CreateAddress

func (id *Private) CreateAddress(version, stream uint64)

CreateAddress populates the Address object within the identity based on the provided version and stream values and also generates the ripe.

func (*Private) ExportWIF

func (id *Private) ExportWIF() (address, signingKeyWif, encryptionKeyWif string,
	err error)

ExportWIF exports a Private identity to WIF for storage on disk or use by other software. It exports the address, private signing key and private encryption key.

func (*Private) ToPublic

func (id *Private) ToPublic() *Public

ToPublic turns a Private identity object into Public identity object.

type Public

type Public struct {
	bmutil.Address
	NonceTrialsPerByte uint64
	ExtraBytes         uint64
	SigningKey         *btcec.PublicKey
	EncryptionKey      *btcec.PublicKey
	Behavior           uint32
}

Public contains the identity of the remote user, which includes public encryption and signing keys, POW parameters and the address that contains information about stream number and address version.

func NewPublic

func NewPublic(signingKey, encryptionKey *btcec.PublicKey, nonceTrials,
	extraBytes, addrVersion, addrStream uint64) *Public

NewPublic creates and initializes an *identity.Public object.

func (*Public) CreateAddress

func (id *Public) CreateAddress(version, stream uint64)

CreateAddress populates the Address object within the identity based on the provided version and stream values and also generates the ripe.

Jump to

Keyboard shortcuts

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