Files
Gokapi/internal/models/End2EndEncryption.go
Marc Ole Bulling 9c9ea6dbb7 Add end-to-end encryption (#71)
* Added WASM module for e2e

* Added cmd util to read database

* Changed to go 1.19

* Fixed crash with random string generator

* Fixed typos and tests

* Host service worker on github
2022-08-11 13:37:55 +02:00

34 lines
989 B
Go

package models
// E2EInfoPlainText is stored locally and will be encrypted before storing on server
type E2EInfoPlainText struct {
Files []E2EFile `json:"files"`
}
// E2EInfoEncrypted is the struct that is stored on the server and decrypted locally
type E2EInfoEncrypted struct {
Version int `json:"version"`
Nonce []byte `json:"nonce"`
Content []byte `json:"content"`
AvailableFiles []string `json:"availablefiles"`
}
// HasBeenSetUp returns true if E2E setup has been run
func (e *E2EInfoEncrypted) HasBeenSetUp() bool {
return e.Version != 0 && len(e.Content) != 0
}
// E2EFile contains information about a stored e2e file
type E2EFile struct {
Uuid string `json:"uuid"`
Id string `json:"id"`
Filename string `json:"filename"`
Cipher []byte `json:"cipher"`
}
// E2EHashContent contains the info that is added after the hash for an e2e link
type E2EHashContent struct {
Filename string `json:"f"`
Cipher string `json:"c"`
}