Documentation ¶
Index ¶
- Constants
- Variables
- func MakeKeyPair(privateKeyStr string, password string, test bool) (*EncryptedKeyPair, *PrivateKeyConfig, error)
- func PublicKeyFromIdentity(name string, identities []IdentityType) (*keypair.KeyPair, error)
- func VerifyPassword(password string, identity *IdentityType) (*keypair.KeyPair, error)
- type EncryptedKeyPair
- type IdentityType
- type PrivateKeyConfig
- 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, *PrivateKeyConfig, 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 `libucl:"name" json:"name"` Description string `libucl:"description" json:"description"` Public_key string `libucl:"public_key" json:"public_key"` Private_key string `libucl:"private_key" json:"private_key"` Seed string `libucl:"seed" json:"seed"` Private_key_config PrivateKeyConfig `libucl:"private_key_config" json:"private_key_config"` }
full access to data (includes private data)
type PrivateKeyConfig ¶
type PrivateKeyConfig struct {
Salt string `libucl:"salt" 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.