api

package
v0.0.0-...-044a9da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBlockSize = 16

Variables

This section is empty.

Functions

func Base64UrlDecode

func Base64UrlDecode(text string) []byte

func Base64UrlEncode

func Base64UrlEncode(data []byte) string

func CreateAuthVerifier

func CreateAuthVerifier(password string, salt []byte, iterations uint32) string

func CreateBioAuthHash

func CreateBioAuthHash(bioKey []byte) []byte

func CreateEncryptionParams

func CreateEncryptionParams(password string, salt []byte, iterations uint32, dataKey []byte) (encryptionParams []byte, err error)

func DecryptAesV1

func DecryptAesV1(data []byte, key []byte) ([]byte, error)

func DecryptAesV1Full

func DecryptAesV1Full(data []byte, key []byte, usePadding bool) ([]byte, error)

func DecryptAesV2

func DecryptAesV2(data []byte, key []byte) ([]byte, error)

func DecryptEc

func DecryptEc(data []byte, private *ecdh.PrivateKey) (decrypted []byte, err error)

func DecryptEncryptionParams

func DecryptEncryptionParams(decodedParams []byte, password string) (params []byte, err error)

func DecryptRsa

func DecryptRsa(data []byte, privateKey *rsa.PrivateKey) (result []byte, err error)

func DeriveKeyHashV1

func DeriveKeyHashV1(password string, salt []byte, iterations uint32) []byte

func DeriveKeyHashV2

func DeriveKeyHashV2(domain string, password string, salt []byte, iterations uint32) []byte

func DeriveKeyV1

func DeriveKeyV1(password string, salt []byte, iterations uint32) []byte

func EcSharedKey

func EcSharedKey(public1 *ecdh.PublicKey, private2 *ecdh.PrivateKey) (key []byte, err error)

func EncryptAesV1

func EncryptAesV1(data []byte, key []byte) ([]byte, error)

func EncryptAesV1Full

func EncryptAesV1Full(data []byte, key []byte, iv []byte, usePadding bool) ([]byte, error)

func EncryptAesV2

func EncryptAesV2(data []byte, key []byte) ([]byte, error)

func EncryptAesV2Full

func EncryptAesV2Full(data []byte, key []byte, nonce []byte) ([]byte, error)

func EncryptEc

func EncryptEc(data []byte, public *ecdh.PublicKey) (encrypted []byte, err error)

func EncryptRsa

func EncryptRsa(data []byte, publicKey *rsa.PublicKey) ([]byte, error)

func GenerateAesKey

func GenerateAesKey() []byte

func GenerateEcKey

func GenerateEcKey() (private *ecdh.PrivateKey, public *ecdh.PublicKey, err error)

func GenerateRsaKey

func GenerateRsaKey() (private *rsa.PrivateKey, public *rsa.PublicKey, err error)

func GenerateUid

func GenerateUid() []byte

func GetEcPublicKey

func GetEcPublicKey(privateKey *ecdh.PrivateKey) *ecdh.PublicKey

func GetKeeperFileFullPath

func GetKeeperFileFullPath(filename string) string

func GetLogger

func GetLogger() *zap.Logger

func GetRandomBytes

func GetRandomBytes(size int) []byte

func GetRsaPublicKey

func GetRsaPublicKey(privateKey *rsa.PrivateKey) *rsa.PublicKey

func LoadEcPrivateKey

func LoadEcPrivateKey(data []byte) (*ecdh.PrivateKey, error)

func LoadEcPublicKey

func LoadEcPublicKey(data []byte) (publicKey *ecdh.PublicKey, err error)

func LoadRsaPrivateKey

func LoadRsaPrivateKey(privateKeyData []byte) (privateKey *rsa.PrivateKey, err error)

func LoadRsaPublicKey

func LoadRsaPublicKey(publicKey []byte) (*rsa.PublicKey, error)

func SetLogger

func SetLogger(logger *zap.Logger)

func SetNoLogger

func SetNoLogger()

func UnloadEcPrivateKey

func UnloadEcPrivateKey(private *ecdh.PrivateKey) []byte

func UnloadEcPublicKey

func UnloadEcPublicKey(public *ecdh.PublicKey) []byte

func UnloadRsaPrivateKey

func UnloadRsaPrivateKey(privateKey *rsa.PrivateKey) []byte

func UnloadRsaPublicKey

func UnloadRsaPublicKey(publicKey *rsa.PublicKey) []byte

Types

type KeeperApiError

type KeeperApiError struct {
	KeeperError
	// contains filtered or unexported fields
}

func NewKeeperApiError

func NewKeeperApiError(resultCode string, message string) *KeeperApiError

func (*KeeperApiError) Error

func (e *KeeperApiError) Error() string

func (*KeeperApiError) ResultCode

func (e *KeeperApiError) ResultCode() string

type KeeperError

type KeeperError struct {
	// contains filtered or unexported fields
}

func NewKeeperError

func NewKeeperError(message string) *KeeperError

func (*KeeperError) Error

func (e *KeeperError) Error() string

func (*KeeperError) Message

func (e *KeeperError) Message() string

type KeeperInvalidDeviceToken

type KeeperInvalidDeviceToken struct {
	KeeperError
}

func NewKeeperInvalidDeviceToken

func NewKeeperInvalidDeviceToken(additionalInfo string) *KeeperInvalidDeviceToken

func (*KeeperInvalidDeviceToken) Error

func (e *KeeperInvalidDeviceToken) Error() string

type RegionRedirectError

type RegionRedirectError struct {
	KeeperError
	// contains filtered or unexported fields
}

func NewKeeperRegionRedirect

func NewKeeperRegionRedirect(regionHost string, additionalInfo string) *RegionRedirectError

func (*RegionRedirectError) Error

func (e *RegionRedirectError) Error() string

func (*RegionRedirectError) RegionHost

func (e *RegionRedirectError) RegionHost() string

type StreamCryptor

type StreamCryptor interface {
	io.Reader
	GetTotal() int
}

func NewAesStreamDecryptor

func NewAesStreamDecryptor(reader io.Reader, key []byte) StreamCryptor

func NewAesStreamEncryptor

func NewAesStreamEncryptor(reader io.Reader, key []byte) StreamCryptor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL