Documentation ¶
Index ¶
- Constants
- Variables
- func MakeKeyPair(privateKeyStr string, password string, test bool) (*EncryptedKeyPair, *PrivateKeySalt, error)
- func PublicKeyFromIdentity(name string, identities []IdentityType) (*keypair.KeyPair, error)
- func VerifyPassword(password string, identity *IdentityType) (*keypair.KeyPair, error)
- type EncryptedKeyPair
- type IdentityType
- type PrivateKeySalt
- type Salt
Constants ¶
View Source
const ( PublicKeySize = ed25519.PublicKeySize PrivateKeySize = ed25519.PrivateKeySize PublicKeyOffset = PrivateKeySize - PublicKeySize )
Variables ¶
View Source
var ( ErrInvalidPrivateKey = fault.InvalidError("invalid private key") ErrKeyLength = fault.InvalidError("key length is invalid") ErrNotFoundIdentity = fault.NotFoundError("identity name not found") ErrUnableToRegenerateKeys = fault.InvalidError("unable to regenerate keys") ErrWrongPassword = fault.InvalidError("wrong password") )
View Source
var (
ErrUnmarshalTextFail = fault.ProcessError("unmarshal text failed")
)
Functions ¶
func MakeKeyPair ¶
func MakeKeyPair(privateKeyStr string, password string, test bool) (*EncryptedKeyPair, *PrivateKeySalt, error)
create a new public/private keypair note: private key string must be either:
- 64 bytes = [32 byte private key][32 byte public key]
- 32 bytes = [32 byte private key]
- "SEED:<base58 encoded seed>"
func PublicKeyFromIdentity ¶
func PublicKeyFromIdentity(name string, identities []IdentityType) (*keypair.KeyPair, error)
func VerifyPassword ¶
func VerifyPassword(password string, identity *IdentityType) (*keypair.KeyPair, error)
Types ¶
type EncryptedKeyPair ¶
return of makeKeyPair
type IdentityType ¶
type IdentityType struct { Name string `json:"name"` Description string `json:"description"` PublicKey string `json:"public_key"` PrivateKey string `json:"private_key"` Seed string `json:"seed"` PrivateKeyConfig PrivateKeySalt `json:"private_key_config"` }
full access to data (includes private data)
type PrivateKeySalt ¶ added in v0.9.1
type PrivateKeySalt struct {
Salt string `json:"salt"`
}
type Salt ¶
type Salt [saltSize]byte
func (*Salt) MarshalText ¶
convert salt to little endian hex text
***** possibly use NewEncoder and byte buffer to save copy
func (Salt) String ¶
convert a binary salt to little endian hex string for use by the fmt package (for %s)
func (*Salt) UnmarshalText ¶
convert little endian hex text into a salt
Click to show internal directories.
Click to hide internal directories.