Documentation ¶
Index ¶
- Variables
- type Row
- func (row *Row) Decrypt(key *[32]byte) error
- func (row *Row) Decrypted() []byte
- func (row *Row) HasPlainTag(plain string) bool
- func (row *Row) HasRandomTag(randtag string) bool
- func (row *Row) PlainTags() []string
- func (row *Row) Populate(key *[32]byte, pairs TagPairs) error
- func (row *Row) SetPlainTags(pairs TagPairs) error
- type RowSorter
- type Rows
- type TagPair
- type TagPairs
Constants ¶
This section is empty.
Variables ¶
var (
Debug = false
)
var (
ErrRowsNotFound = errors.New("No rows found")
)
var (
ErrTagPairNotFound = errors.New("TagPair(s) not found")
)
Functions ¶
This section is empty.
Types ¶
type Row ¶
type Row struct { // Populated by server Encrypted []byte `json:"data"` RandomTags []string `json:"tags"` Nonce *[24]byte `json:"nonce"` // contains filtered or unexported fields }
Row represents one piece of data and the tags it has been tagged with.
The (untrusted) machine storing a Row can only see its ciphertext, nonce, and random strings (RandomTags), where each RandomTag (e.g., "sqmgxo6xg") is a string that CrypTag randomly generates and pairs with each plainTag, where a plainTag is a human-readable string (e.g., "programming" or "type:file") that is either human-generated (like "programming"), auto-generated by CrypTag (like "type:file", "id:a91d46c7-45bb-48e4-43d1-642196df15b2", or "created:20160710072200"), or auto-generated by a CrypTag app (like "type:chatmessage" or "app:cryptagnotes"). (To learn more about CrypTag's tagging conventions, see <https://github.com/cryptag/cryptag/wiki/Advice,-Conventions,-and-Constraints>)
Each of these mappings from plainTag to RandomTag is stored in a TagPair -- the other core CrypTag type.
func NewRow ¶
NewRow returns a *Row containing/tagged with the passed-in plainTags, in addition to a unique ID tag ("id:..."), a timestamp tag ("created:created:20170105092731"), and the "all" tag. The *Row returned also contains and a new, random, cryptographic nonce.
func NewRowFromBytes ¶
NewRowFromBytes unmarshals b into a new *Row.
func (*Row) Decrypt ¶
Decrypt sets row.decrypted, row.nonce based upon row.Encrypted, nonce. The passed-in `decrypt` function will typically be bkend.Decrypt, where `bkend` is the backend storing this Row.
func (*Row) Decrypted ¶
Decrypted returns row.decrypted, row's (unexported) decrypted data (if any).
func (*Row) HasPlainTag ¶
HasPlainTag answers the question, "does row have the plain tag plain?"
func (*Row) HasRandomTag ¶
HasRandomTag answers the question, "does row have the random tag randtag?"
func (*Row) PlainTags ¶
PlainTags returns row.plaintags, row's (unexported) plain (human-entered, human-readable) tags.
func (*Row) Populate ¶
Populate sets row.decrypted based on row.Encrypted and row.plainTags based on row.RandomTags, thereby populating row with plaintext data.
func (*Row) SetPlainTags ¶
SetPlainTags uses row.RandomTags and pairs to set row.plainTags
type Rows ¶
type Rows []*Row
func (Rows) WithAllRandomTags ¶
WithAllRandomTags returns the Rows within rows that has all the random strings in random
type TagPair ¶
type TagPair struct { PlainEncrypted []byte `json:"plain_encrypted"` Random string `json:"random"` Nonce *[24]byte `json:"nonce"` // contains filtered or unexported fields }