Documentation
¶
Overview ¶
Copyright © 2024 Thomas von Dein
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2024 Thomas von Dein ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2024 Thomas von Dein ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2024 Thomas von Dein ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2024 Thomas von Dein ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- func AskForPassword() ([]byte, error)
- func Decrypt(pass []byte, cipherb []byte) ([]byte, error)
- func Encrypt(pass []byte, attr *DbAttr) error
- func Exists[K comparable, V any](m map[K]V, v K) bool
- func GetDbFile(file string) string
- func GetRandom(size int, capacity int) ([]byte, error)
- type BucketInfo
- type DB
- func (db *DB) Close() error
- func (db *DB) Del(attr *DbAttr) error
- func (db *DB) Get(attr *DbAttr) (*DbEntry, error)
- func (db *DB) Getall(attr *DbAttr) (DbEntries, error)
- func (db *DB) Import(attr *DbAttr) (string, error)
- func (db *DB) Info() (*DbInfo, error)
- func (db *DB) List(attr *DbAttr, fulltext bool) (DbEntries, error)
- func (db *DB) Open() error
- func (db *DB) Set(attr *DbAttr) error
- type DbAttr
- type DbEntries
- type DbEntry
- func (*DbEntry) Descriptor() ([]byte, []int)deprecated
- func (x *DbEntry) GetBinary() bool
- func (x *DbEntry) GetCreated() *timestamppb.Timestamp
- func (x *DbEntry) GetEncrypted() bool
- func (x *DbEntry) GetId() string
- func (x *DbEntry) GetKey() string
- func (x *DbEntry) GetPreview() string
- func (x *DbEntry) GetSize() uint64
- func (x *DbEntry) GetTags() []string
- func (x *DbEntry) GetValue() string
- func (*DbEntry) ProtoMessage()
- func (x *DbEntry) ProtoReflect() protoreflect.Message
- func (x *DbEntry) Reset()
- func (x *DbEntry) String() string
- func (entry *DbEntry) Taglist() string
- type DbInfo
- type DbTag
- type Key
Constants ¶
const ( ArgonMem uint32 = 64 * 1024 ArgonIter uint32 = 5 ArgonParallel uint8 = 2 ArgonSaltLen int = 16 ArgonKeyLen uint32 = 32 B64SaltLen int = 16 //22 )
const BucketData string = "data"
const MaxValueWidth int = 60
Variables ¶
var File_app_dbentry_proto protoreflect.FileDescriptor
Functions ¶
func AskForPassword ¶ added in v0.0.2
called from interactive thread, hides input and returns clear text password
func Encrypt ¶ added in v0.0.2
Encrypt clear text given in attr using ChaCha20 and auhtenticate using the mac Poly1305. The cipher text will be put into attr, thus modifying it.
The cipher text consists of: password-salt) + (12 byte nonce + ciphertext + 16 byte mac)
func Exists ¶
func Exists[K comparable, V any](m map[K]V, v K) bool
look if a key in a map exists, generic variant
Types ¶
type BucketInfo ¶ added in v0.0.5
type DbAttr ¶
type DbAttr struct { Key string Preview string Val []byte Args []string Tags []string File string Encrypted bool Binary bool // conf flags, needed for incoming rest requests Fulltext bool }
func (*DbAttr) GetFileValue ¶
type DbEntry ¶
type DbEntry struct { Id string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id,omitempty"` Key string `protobuf:"bytes,2,opt,name=Key,proto3" json:"Key,omitempty"` Preview string `protobuf:"bytes,3,opt,name=Preview,proto3" json:"Preview,omitempty"` Tags []string `protobuf:"bytes,4,rep,name=Tags,proto3" json:"Tags,omitempty"` Created *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=Created,proto3" json:"Created,omitempty"` Size uint64 `protobuf:"varint,6,opt,name=Size,proto3" json:"Size,omitempty"` Encrypted bool `protobuf:"varint,7,opt,name=Encrypted,proto3" json:"Encrypted,omitempty"` Binary bool `protobuf:"varint,8,opt,name=Binary,proto3" json:"Binary,omitempty"` Value string `protobuf:"bytes,9,opt,name=Value,proto3" json:"Value,omitempty"` // contains filtered or unexported fields }
func (*DbEntry) Descriptor
deprecated
added in
v0.1.0
func (*DbEntry) GetCreated ¶ added in v0.1.0
func (x *DbEntry) GetCreated() *timestamppb.Timestamp
func (*DbEntry) GetEncrypted ¶ added in v0.1.0
func (*DbEntry) GetPreview ¶ added in v0.1.0
func (*DbEntry) ProtoMessage ¶ added in v0.1.0
func (*DbEntry) ProtoMessage()
func (*DbEntry) ProtoReflect ¶ added in v0.1.0
func (x *DbEntry) ProtoReflect() protoreflect.Message
type DbInfo ¶ added in v0.0.5
type DbInfo struct { Buckets []BucketInfo Path string }
type Key ¶ added in v0.0.2
func DeriveKey ¶ added in v0.0.2
We're using the Argon2id key derivation algorithm to derive a secure key from the given password. This is important, because users might use unsecure passwords. The resulting encrypted data might of course easily be decrypted using brute force methods if a weak password was used, but that would cost, because of the key derivation. It does several rounds of hash calculations which take a considerable amount of cpu time. For our legal user that's no problem because it's being executed only once, but an attacker has to do it in a forever loop, which will take a lot of time.