Documentation ¶
Index ¶
Constants ¶
const (
// RequiredKeyLength determinate the exact length of the encrypt key
RequiredKeyLength = 32
)
Variables ¶
var DefaultOptions = &Options{
LocalDBDir: "/tmp/badger",
EndPointConnection: "localhost:5001",
}
DefaultOptions is used with any options passed, this config saves your db file into your temporal computer files (UNIX) TODO: Improve to another SO
Functions ¶
func UnixTimePrefixedRandomNonce ¶
UnixTimePrefixedRandomNonce takes an int for the nonce size and returns a byte slice of length size. A byte slice is created for the nonce and filled with random data from `crypto/rand`, then the first 4 bytes of the nonce are overwritten with LittleEndian encoding of `time.Now().Unix()` The purpose of this function is to avoid an unlikely collision in randomly generating nonces by prefixing the nonce with time series data.
func ValidateKey ¶
ValidateKey takes a byte slice and checks that minimum requirements are met for the key. It returns an error if the requirements are not met.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents a blackhole db instance, this struct is the real db when it's sync with the ipfs files
func (*DB) Get ¶
Get performs a get action of your Blachole db, it works in two stages (like set function), firs read the relation between your key and a one cid, second, collect this cid from ipfs and finally tries to decrypt and return the value of your key
func (*DB) GetQmFromKey ¶
GetQmFromKey returns your cid related to your key, if exist, of course