Documentation
¶
Index ¶
- type TinyMfaUtil
- func (util *TinyMfaUtil) BcryptHash(tohash []byte) ([]byte, error)
- func (util *TinyMfaUtil) BycrptVerify(comparable, verifiable []byte) error
- func (util *TinyMfaUtil) DecodeBase32Key(encodedKey *string) (*[]byte, error)
- func (util *TinyMfaUtil) Decrypt(data, passphrase *[]byte) (*[]byte, error)
- func (util *TinyMfaUtil) DecryptFile(filePath string, passphrase *[]byte) (*[]byte, error)
- func (util *TinyMfaUtil) EncodeBase32Key(key *[]byte) *string
- func (util *TinyMfaUtil) Encrypt(data, passphrase *[]byte) (*[]byte, error)
- func (util *TinyMfaUtil) EncryptFile(filePath string, data, passphrase *[]byte) error
- type TinyMfaUtilInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TinyMfaUtil ¶ added in v0.3.1
type TinyMfaUtil struct{}
func (*TinyMfaUtil) BcryptHash ¶ added in v0.3.1
func (util *TinyMfaUtil) BcryptHash(tohash []byte) ([]byte, error)
BcryptHash hashes a given byte array with bcrypt and a cost of 10
func (*TinyMfaUtil) BycrptVerify ¶ added in v0.3.1
func (util *TinyMfaUtil) BycrptVerify(comparable, verifiable []byte) error
BycrptVerify compares a bcrypted comparable and its plain byte array
func (*TinyMfaUtil) DecodeBase32Key ¶ added in v0.3.1
func (util *TinyMfaUtil) DecodeBase32Key(encodedKey *string) (*[]byte, error)
DecodeBase32Key Decodes a base32 encoded key to a byte array
func (*TinyMfaUtil) Decrypt ¶ added in v0.3.1
func (util *TinyMfaUtil) Decrypt(data, passphrase *[]byte) (*[]byte, error)
Decrypt takes in two byte arrays. The former one is the encrypted data, the second one is the passphrase that shall be used. The method returns the decrypted data in another byte array Attention: It is assumed that a nonce is appended to the encrypted byte array!
func (*TinyMfaUtil) DecryptFile ¶ added in v0.3.1
func (util *TinyMfaUtil) DecryptFile(filePath string, passphrase *[]byte) (*[]byte, error)
DecryptFile takes a filePath as a string and a passphrase as a byte array. The file found at filePath is then decrypted using the Decrypt Method and then wrote back to the original filePath
func (*TinyMfaUtil) EncodeBase32Key ¶ added in v0.3.1
func (util *TinyMfaUtil) EncodeBase32Key(key *[]byte) *string
EncodeBase32Key encodes a byte array to a base32 encoded string
func (*TinyMfaUtil) Encrypt ¶ added in v0.3.1
func (util *TinyMfaUtil) Encrypt(data, passphrase *[]byte) (*[]byte, error)
Encrypt takes in a byte array as data and another byte array as the passphrase, encrypts the data using the AES cipher and returns the encrypted data (also as byte array) please note that the nonce needed to encrypt the data using AES GCM is appended to the byte array
func (*TinyMfaUtil) EncryptFile ¶ added in v0.3.1
func (util *TinyMfaUtil) EncryptFile(filePath string, data, passphrase *[]byte) error
EncryptFile takes a filePath as a string and a passphrase as a byte array. The file found at filePath is then Encrypted using the Encrypt Method and then wrote back to the original filePath
type TinyMfaUtilInterface ¶ added in v0.3.1
type TinyMfaUtilInterface interface {
// Encrypt takes in a byte array as data and another byte array as the passphrase,
// encrypts the data using the AES cipher and returns the encrypted data (also as byte array)
// please note that the nonce needed to encrypt the data using AES GCM is appended to the byte array
Encrypt(data, passphrase *[]byte) (*[]byte, error)
// EncryptFile takes a filePath as a string and a passphrase as a byte array.
// The file found at filePath is then Encrypted using the Encrypt Method
// and then wrote back to the original filePath
EncryptFile(filePath string, data, passphrase *[]byte) error
// Decrypt takes in two byte arrays. The former one is the encrypted data,
// the second one is the passphrase that shall be used.
// The method returns the decrypted data in another byte array
// Attention: It is assumed that a nonce is appended to the encrypted
// byte array!
Decrypt(data, passphrase *[]byte) (*[]byte, error)
// DecryptFile takes a filePath as a string and a passphrase as a byte array.
// The file found at filePath is then decrypted using the Decrypt Method
// and then wrote back to the original filePath
DecryptFile(filePath string, passphrase *[]byte) (*[]byte, error)
// DecodeBase32Key Decodes a base32 encoded key to a byte array
DecodeBase32Key(encodedKey *string) (*[]byte, error)
// EncodeBase32Key encodes a byte array to a base32 encoded string
EncodeBase32Key(key *[]byte) *string
// BcryptHash hashes a given byte array with bcrypt and a cost of 10
BcryptHash(tohash []byte) ([]byte, error)
// BycrptVerify compares a bcrypted comparable and its plain byte array
BycrptVerify(comparable, verifiable []byte) error
}
func NewTinyMfaUtil ¶ added in v0.3.1
func NewTinyMfaUtil() TinyMfaUtilInterface