Documentation
¶
Overview ¶
Package identity is responsible for creation and management of user identities.
Index ¶
Constants ¶
const BMPurposeCode = 0x80000052
BMPurposeCode is the purpose code used for HD key derivation.
const BehaviorAck = 1
BehaviorAck says whether a message to this pubkey should include an ack.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PrivateAddress ¶
type PrivateAddress struct {
// contains filtered or unexported fields
}
PrivateAddress contains private keys and the parameters necessary to derive an address from it.
func ImportWIF ¶
func ImportWIF(addrStr, signingKeyWif, decryptionKeyWif string) (*PrivateAddress, error)
ImportWIF creates a Private identity from the Bitmessage address and Wallet Import Format (WIF) signing and encryption keys.
func NewPrivateAddress ¶
func NewPrivateAddress(key *PrivateKey, version, stream uint64) *PrivateAddress
NewPrivateAddress constructs a PrivateAddress.
func (*PrivateAddress) Address ¶
func (id *PrivateAddress) Address() Address
Address constructs the Bitmessage address object corresponding to this PrivateAddress
func (*PrivateAddress) ExportWIF ¶
func (id *PrivateAddress) ExportWIF() (address, signingKeyWif, decryptionKeyWif string)
ExportWIF exports a Private identity to WIF for storage on disk or use by other software. It exports the private signing key and private encryption key.
func (*PrivateAddress) PrivateKey ¶
func (id *PrivateAddress) PrivateKey() *PrivateKey
PrivateKey returns the private key corresponding to this address.
func (*PrivateAddress) PublicKey ¶
func (id *PrivateAddress) PublicKey() *PublicKey
PublicKey returns the public key.
type PrivateID ¶
type PrivateID struct { PrivateAddress // contains filtered or unexported fields }
PrivateID contains the identity of the user, which includes private encryption and signing keys, and POW parameters.
func NewPrivateID ¶
func NewPrivateID(id *PrivateAddress, behavior uint32, data *pow.Data) *PrivateID
NewPrivateID constructs a PrivateID.
func (*PrivateID) Data ¶
func (id *PrivateID) Data() *obj.PubKeyData
Data turns a PrivateID type into PubKeyData type.
type PrivateKey ¶
type PrivateKey struct { Signing *btcec.PrivateKey Decryption *btcec.PrivateKey }
PrivateKey contains the private keys.
func NewDeterministic ¶
func NewDeterministic(passphrase string, initialZeros uint64, n int) ([]*PrivateKey, 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 uint64) (*PrivateKey, 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) (*PrivateKey, 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 (*PrivateKey) ExportWIF ¶
func (pk *PrivateKey) ExportWIF() (SigningWif, DecryptionWif string)
ExportWIF exports the private keys in WIF format.
func (*PrivateKey) Hash ¶
func (pk *PrivateKey) Hash() *hash.Ripe
Hash returns the ripemd160 hash used in the address
func (*PrivateKey) Public ¶
func (pk *PrivateKey) Public() *PublicKey
Public turns a Private identity object into Public identity object.
type PubKey ¶
PubKey is used in several of the bitmessage messages and common structures. The first 32 bytes contain the X value and the other 32 contain the Y value.
func NewPubKey ¶
NewPubKey returns a new PubKey from a wire.PubKey. An error is returned if the number of bytes passed in is not PubKeySize.
func (*PubKey) Btcec ¶
Btcec converts PubKey to btcec.PublicKey so that it can be used for cryptographic operations like encryption/signature verification.
type Public ¶
type Public interface { Address() Address Key() *PublicKey Data() *obj.PubKeyData Behavior() uint32 Pow() *pow.Data String() string }
Public refers to a public identity.
func NewPublic ¶
func NewPublic(public *PublicKey, version, stream uint64, behavior uint32, data *pow.Data) (Public, error)
NewPublic creates and initializes an *identity.PublicID object.
func NewPublicFromWIF ¶
func NewPublicFromWIF(address *PrivateAddress, behavior uint32, data *pow.Data) Public
NewPublicFromWIF creates an *identity.Public object from a PrivateAddress
type PublicKey ¶
PublicKey contains the identity of the remote user, which includes public encryption and signing keys, and POW parameters.
func NewPublicKey ¶
NewPublicKey takes two wire.PubKeys and constructs a PublicKey.