securedb

package
v6.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Bucket for all db metadata
	EncyptedMetaData = []byte("EncyptedDBMetaData")

	TimeCheck = time.Time{} // Used to Check if time has been initiated
)

Functions

func Decrypt

func Decrypt(ciphertext []byte, key []byte) ([]byte, error)

func Encrypt

func Encrypt(plaintext []byte, key []byte) ([]byte, error)

func GetKey

func GetKey(password string, salt []byte) ([]byte, error)

Types

type EncryptedDB

type EncryptedDB struct {

	// Allow the wallet to be locked, by gating access based
	// on time.
	UnlockedUntil time.Time
	// contains filtered or unexported fields
}

EncryptedDB is a database with symmetric encryption to encrypt all writes, and decrypt all reads

func NewEncryptedDB

func NewEncryptedDB(filename, dbtype, password string) (*EncryptedDB, error)

NewEncryptedDB takes the filename, dbtype, and password.

Dbtype :
	Map
	Bolt
	LevelDB

func (*EncryptedDB) Clear

func (db *EncryptedDB) Clear(bucket []byte) error

func (*EncryptedDB) Close

func (db *EncryptedDB) Close() error

func (*EncryptedDB) Delete

func (db *EncryptedDB) Delete(bucket []byte, key []byte) error

We don't care if delete works or not. If the key isn't there, that's ok

func (*EncryptedDB) DoesKeyExist

func (db *EncryptedDB) DoesKeyExist(bucket, key []byte) (bool, error)

func (*EncryptedDB) Get

func (db *EncryptedDB) Get(bucket []byte, key []byte, destination interfaces.BinaryMarshallable) (interfaces.BinaryMarshallable, error)

func (*EncryptedDB) GetAll

func (*EncryptedDB) Init

func (db *EncryptedDB) Init(filename string, dbtype string)

func (*EncryptedDB) ListAllBuckets

func (db *EncryptedDB) ListAllBuckets() ([][]byte, error)

func (*EncryptedDB) ListAllKeys

func (db *EncryptedDB) ListAllKeys(bucket []byte) (keys [][]byte, err error)

func (*EncryptedDB) Lock

func (db *EncryptedDB) Lock()

Lock locks the database such that further access calls will fail until it is unlocked

func (*EncryptedDB) Put

func (db *EncryptedDB) Put(bucket []byte, key []byte, data interfaces.BinaryMarshallable) error

func (*EncryptedDB) PutInBatch

func (db *EncryptedDB) PutInBatch(records []interfaces.Record) error

func (*EncryptedDB) Trim

func (db *EncryptedDB) Trim()

Can't trim a real database

func (*EncryptedDB) UnlockFor

func (db *EncryptedDB) UnlockFor(password string, duration time.Duration) error

type EncryptedMarshaler

type EncryptedMarshaler struct {
	EncryptionKey []byte

	Original interfaces.BinaryMarshallable
}

func NewEncryptedMarshaler

func NewEncryptedMarshaler(key []byte, o interfaces.BinaryMarshallable) *EncryptedMarshaler

func (*EncryptedMarshaler) MarshalBinary

func (e *EncryptedMarshaler) MarshalBinary() (rval []byte, err error)

func (*EncryptedMarshaler) New

func (*EncryptedMarshaler) UnmarshalBinary

func (e *EncryptedMarshaler) UnmarshalBinary(cipherData []byte) (err error)

func (*EncryptedMarshaler) UnmarshalBinaryData

func (e *EncryptedMarshaler) UnmarshalBinaryData(cipherData []byte) (newData []byte, err error)

type SecureDBMetaData

type SecureDBMetaData struct {
	Salt      primitives.ByteSlice
	Challenge primitives.ByteSlice
}

func NewSecureDBMetaData

func NewSecureDBMetaData() *SecureDBMetaData

func (*SecureDBMetaData) IsSameAs

func (m *SecureDBMetaData) IsSameAs(b *SecureDBMetaData) bool

func (*SecureDBMetaData) MarshalBinary

func (m *SecureDBMetaData) MarshalBinary() (rval []byte, err error)

func (*SecureDBMetaData) UnmarshalBinary

func (m *SecureDBMetaData) UnmarshalBinary(data []byte) (err error)

func (*SecureDBMetaData) UnmarshalBinaryData

func (m *SecureDBMetaData) UnmarshalBinaryData(data []byte) (newData []byte, err error)

Jump to

Keyboard shortcuts

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