Documentation ¶
Index ¶
- func BlockID(fileID string, index int) string
- func Decrypt(key []byte, data []byte) ([]byte, error)
- func Encrypt(key []byte, data []byte) ([]byte, error)
- func FileID(publicKey *secp256k1.PublicKey, salt []byte) string
- func GetMnemonic() (string, error)
- func GetPrivateKeyFromHDKey(key *hdkeychain.ExtendedKey) (*secp256k1.PrivateKey, error)
- func GetPublicKeyFromHDKey(key *hdkeychain.ExtendedKey) (*secp256k1.PublicKey, error)
- func GetRootFolder(mnemonic string, password string) (string, *hdkeychain.ExtendedKey, error)
- func GetRootFolderFromKey(key string) (*hdkeychain.ExtendedKey, error)
- func KeyID(publicKey *secp256k1.PublicKey) string
- func NewRootFolder(password string) (string, *hdkeychain.ExtendedKey, error)
- func OwnershipPrivateKey(hdkey *hdkeychain.ExtendedKey, version uint32) (*secp256k1.PrivateKey, error)
- func OwnershipPublicKey(hdkey *hdkeychain.ExtendedKey, version uint32) (*secp256k1.PublicKey, error)
- func RandomBytes(n int) ([]byte, error)
- func RecreateFile(blocks []Block) []byte
- type Block
- type EncryptedBlock
- type File
- type KeyFile
- func (f *KeyFile) Decrypt() KeyFile
- func (f *KeyFile) Encrypt() KeyFile
- func (f *KeyFile) File() *hdkeychain.ExtendedKey
- func (f *KeyFile) GetVersion() (uint32, error)
- func (f *KeyFile) ID() (string, error)
- func (f *KeyFile) Key() []byte
- func (f *KeyFile) MissingData() bool
- func (f *KeyFile) PublicKey() (*secp256k1.PublicKey, error)
- func (f *KeyFile) Serialise() ([]byte, error)
- func (f *KeyFile) Verify() (bool, error)
- type Meta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMnemonic ¶
GetMnemonic returns a randomly generated mnemonic seed
func GetPrivateKeyFromHDKey ¶
func GetPrivateKeyFromHDKey(key *hdkeychain.ExtendedKey) (*secp256k1.PrivateKey, error)
GetPrivateKeyFromHDKey returns the private key for an extended key
func GetPublicKeyFromHDKey ¶
func GetPublicKeyFromHDKey(key *hdkeychain.ExtendedKey) (*secp256k1.PublicKey, error)
GetPublicKeyFromHDKey returns the public key for an extended key
func GetRootFolder ¶
GetRootFolder returns a root extended key from mnemonic and password
func GetRootFolderFromKey ¶
GetRootFolderFromKey retuns the root extended key
func KeyID ¶
func KeyID(publicKey *secp256k1.PublicKey) string
KeyID returns the key id for a public key
func NewRootFolder ¶
NewRootFolder returns a new random root extended key and mnemonic
func OwnershipPrivateKey ¶
func OwnershipPrivateKey(hdkey *hdkeychain.ExtendedKey, version uint32) (*secp256k1.PrivateKey, error)
OwnershipPrivateKey returns the private key for a given version
func OwnershipPublicKey ¶
func OwnershipPublicKey(hdkey *hdkeychain.ExtendedKey, version uint32) (*secp256k1.PublicKey, error)
OwnershipPublicKey returns the public key for a given version
func RandomBytes ¶
RandomBytes returns an array of random bytes for a given length
Types ¶
type EncryptedBlock ¶
EncryptedBlock Object
func CreateEncryptedBlocks ¶
func CreateEncryptedBlocks(fileID string, key []byte, data []byte, size int) (encryptedBlocks []EncryptedBlock, err error)
CreateEncryptedBlocks ...
type File ¶
type File struct { Key *hdkeychain.ExtendedKey KeyFile KeyFile MetaBlocks []EncryptedBlock FileBlocks []EncryptedBlock }
File ...
type KeyFile ¶
type KeyFile struct { Version []byte MetaSalt []byte FileSalt []byte EphemKey []byte Signature []byte // contains filtered or unexported fields }
KeyFile ...
func CreateKeyFile ¶
CreateKeyFile returns a new key file for an extended key
func ParseKeyFile ¶
ParseKeyFile returns a parsed key file
func (*KeyFile) File ¶
func (f *KeyFile) File() *hdkeychain.ExtendedKey
File returns the file struct
func (*KeyFile) GetVersion ¶
GetVersion returns the version of the key file
func (*KeyFile) MissingData ¶
MissingData returns true if fields are missing from key file