Documentation
¶
Index ¶
- type KeyStore
- func (ks *KeyStore) DecoderByID(ctx context.Context, id int64) (typ int, dec func(dst, src []byte), err error)
- func (ks *KeyStore) EncoderByType(ctx context.Context, typ int) (id int64, enc func(dst, src []byte), err error)
- func (ks *KeyStore) NewKey(ctx context.Context, typ, keysize int) (int64, error)
- func (ks *KeyStore) Version() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyStore ¶
type KeyStore struct {
// contains filtered or unexported fields
}
KeyStore is an implementation of encid.KeyStore backed by a SQLite database.
func New ¶
func New(ctx context.Context, filename string, newcipher func([]byte) (cipher.Block, error)) (*KeyStore, error)
New creates a new SQLite-backed keystore using the given file. The newcipher function takes a key and returns a cipher for encrypting and decrypting. If newcipher is nil, it defaults to aes.NewCipher.
If the keystore is new (i.e., contains no keys), the version number of the keystore is set to 2. If the keystore is non-empty and was created before v1.5.0 of this module, its version will be 1. The version number controls whether the resulting encoded ids include a checksum. Version 1 ids are not compatible with version 2 ids.
func (*KeyStore) DecoderByID ¶
func (*KeyStore) EncoderByType ¶
Click to show internal directories.
Click to hide internal directories.