Documentation ¶
Index ¶
- Constants
- Variables
- func GetMeta[T MetaTypes](tx BackendTxn, key []byte) (T, error)
- func NewSalt(n int) ([]byte, error)
- func SetMeta[T MetaTypes](tx BackendTxn, key []byte, value T) error
- func SupportedVersion(version int) bool
- type ArgonParams
- type Backend
- type BackendTxn
- type Bucket
- type Closer
- type CloserFn
- type Crypto
- type EncryptionKey
- type Item
- type KV
- type KeyGen
- type KeyGenFn
- type MetaTypes
- type Nonce
- type Store
- type StoreTxn
- type Unlocker
- type UnlockerFn
Constants ¶
View Source
const ( MetadataPWHashSalt = "pwhash:salt" MetadataPWHashTime = "pwhash:time" MetadataPWHashMem = "pwhash:mem" MetadataVersion = "version" MetadataKeyCtlName = "keyctl:name" MetadataVerification = "verify:verify" )
View Source
const ( MinSupportedVersion = 0 MaxSupportedVersion = 0 Version = 0 )
View Source
const ( DefaultArgonTimeParam uint32 = 16 DefaultArgonMemParam uint32 = 2048 * 1024 // 2GiB MinArgonTimeParam uint32 = 1 MinArgonMemParam uint32 = 1024 //1MiB LowArgonTimeParam uint32 = 8 LowArgonMemParam uint32 = 1024 * 1024 //1GiB HighArgonTimeParam uint32 = 24 HighArgonMemParam uint32 = 4096 * 1024 // 4GiB )
View Source
const BlockSize = 16
View Source
const EncryptionKeySize = 64
View Source
const ItemOverheadBytes = 8 + 4
View Source
const NonceSize = 24
View Source
const SaltSize = 32
View Source
const (
VerificationMessage = "The quick brown fox jumps over the lazy dog. Sphinx of black quartz, judge my vow."
)
Variables ¶
View Source
var ErrNotFound = fmt.Errorf("requested value not found")
Functions ¶
func SupportedVersion ¶
Types ¶
type ArgonParams ¶
func ArgonDefault ¶
func ArgonDefault() ArgonParams
func ArgonHigh ¶
func ArgonHigh() ArgonParams
func ArgonLow ¶
func ArgonLow() ArgonParams
func (ArgonParams) Validate ¶
func (a ArgonParams) Validate() error
type Backend ¶
type Backend interface { Txn(func(BackendTxn) error) error Close() }
func NewBackend ¶
type BackendTxn ¶
type Crypto ¶
type Crypto interface { HMAC(data []byte) ([]byte, error) Encrypt(data []byte) ([]byte, error) Decrypt(cipher []byte) ([]byte, error) Close() // contains filtered or unexported methods }
func PasswordHash ¶
func PasswordHash(password, salt []byte, params ArgonParams) (Crypto, error)
type EncryptionKey ¶
type EncryptionKey [EncryptionKeySize]byte
type Item ¶
type Item interface { Key() []byte Value() []byte Timestamp() time.Time encoding.BinaryMarshaler encoding.BinaryUnmarshaler }
type KeyGen ¶
func PasswordKeyGen ¶
func PasswordKeyGen(fetcher func() ([]byte, error), params ArgonParams) KeyGen
type MetaTypes ¶
type MetaTypes interface { int64 | uint64 | float64 | bool | time.Time | time.Duration | string | []byte }
Metadata getter helpers
type Unlocker ¶
func FallbackUnlocker ¶
func KeyCtlUnlocker ¶
func KeyCtlUnlocker() Unlocker
func PasswordUnlocker ¶
Click to show internal directories.
Click to hide internal directories.