identity

package
v0.0.0-...-fe38a42 Latest Latest
Warning

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

Go to latest
Published: May 22, 2015 License: MIT Imports: 10 Imported by: 1

Documentation

Overview

Responsible for creation and management of user identities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Version types.Varint
	Stream  types.Varint
	Ripe    [20]byte
}

Represents a Bitmessage address

func DecodeAddress

func DecodeAddress(address string) (*Address, error)

Decode the Bitmessage address. The assumption is that input address is properly formatted (according to specs).

func (*Address) CalcDoubleHash

func (addr *Address) CalcDoubleHash() []byte

CalcDoubleHash calculates the double sha512 sum of the address, the first half of which is used as private encryption key for the public key object and the second half is used as a tag.

func (*Address) Encode

func (addr *Address) Encode() (string, error)

Encode the address to a string that begins from BM- based on the hash. Output: [Varint(addressVersion) Varint(stream) ripe checksum] where the Varints are serialized. Then this byte array is base58 encoded to produce our needed address.

func (*Address) Tag

func (addr *Address) Tag() [32]byte

type Base

type Base struct {
	Address
	NonceTrialsPerByte types.Varint
	ExtraBytes         types.Varint
}

func (*Base) SetDefaultPOWParams

func (id *Base) SetDefaultPOWParams()

SetDefaultPOWParams sets values of ExtraBytes and NonceTrialsPerByte based on hard-coded values in constants.go.

type Foreign

type Foreign struct {
	Base
	SigningKey    *elliptic.PublicKey
	EncryptionKey *elliptic.PublicKey
}

Foreign contains the identity of the remote user, which includes the public encryption and signing keys, the address that contains information about stream number and address version and information determining the POW accepted by the identity.

func (*Foreign) CreateAddress

func (id *Foreign) CreateAddress(version, stream types.Varint)

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

type Own

type Own struct {
	Base
	SigningKey    *elliptic.PrivateKey
	EncryptionKey *elliptic.PrivateKey
}

Own contains the identity of the user, which includes public and private encryption and signing keys, as well as the address that contains information about stream number and address version.

func Import

func Import(address, signingKeyWif, encryptionKeyWif string) (*Own, error)

Import creates an Identity object from the Bitmessage address and Wallet Import Format (WIF) signing and encryption keys.

func NewDeterministic

func NewDeterministic(passphrase string, initialZeros uint64) (*Own, error)

Create identities based on a deterministic passphrase. Note that this does not create an address.

func NewRandom

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

Create an identity based on a random number generator, 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 (*Own) CreateAddress

func (id *Own) CreateAddress(version, stream types.Varint)

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

func (*Own) Export

func (id *Own) Export() (address, signingKeyWif, encryptionKeyWif string,
	err error)

Export is responsible for exporting an identity to WIF and generating an address on the basis of the stored version and stream numbers.

func (*Own) ToForeign

func (id *Own) ToForeign() *Foreign

ToForeign turns the Own identity object into Foreign identity object that can then be used in broadcasts and wherever else is required.

Jump to

Keyboard shortcuts

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