EncryptedValue
A value sealed by crypto.encrypt: its version, algorithm, key identity, nonce, ciphertext and tag. Ciphertext, so it may be stored and sent; only crypto.decrypt, with the key, reads what it holds.
Security; not ordered; since Jadpo 0.1.0.
Make one
Build one from Bytes, EncryptedValue(bytes), which checks them: bytes that aren't one break format.
text.parse(raw, as: EncryptedValue) reads one from its text; text that isn't one at all fails malformed, such as "".
Text, JSON and storage
text.from writes its canonical text, the one form text.parse reads back. JSON sends its canonical text as a string.
| Text | JSON |
|---|---|
AQGhssPUAAECAwQFBgcICQoLDA0ODxAREhMUFRYXgIGCg4SFhoeIiYqLjI2Ojw== |
"AQGhssPUAAECAwQFBgcICQoLDA0ODxAREhMUFRYXgIGCg4SFhoeIiYqLjI2Ojw==" |
AQGhssPUGBkaGxwdHh8gISIjJCUmJygpKissLS4vaGVsbG+QkZKTlJWWl5iZmpucnZ6f |
"AQGhssPUGBkaGxwdHh8gISIjJCUmJygpKissLS4vaGVsbG+QkZKTlJWWl5iZmpucnZ6f" |
It is stored in one column named for the field, of type bytea. AQGhssPUGBkaGxwdHh8gISIjJCUmJygpKissLS4vaGVsbG+QkZKTlJWWl5iZmpucnZ6f is stored as E'\\x0101a1b2c3d418191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f68656c6c6f909192939495969798999a9b9c9d9e9f'::bytea.
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
AQGhssPUAAECAwQFBgcICQoLDA0ODxAREhMUFRYXgIGCg4SFhoeIiYqLjI2Ojw== |
AQGhssPUAAECAwQFBgcICQoLDA0ODxAREhMUFRYXgIGCg4SFhoeIiYqLjI2Ojw== |
AQGhssPUGBkaGxwdHh8gISIjJCUmJygpKissLS4vaGVsbG+QkZKTlJWWl5iZmpucnZ6f |
AQGhssPUGBkaGxwdHh8gISIjJCUmJygpKissLS4vaGVsbG+QkZKTlJWWl5iZmpucnZ6f |
Operations
It has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-encrypted-value.md.Built from Jadpo main at e00e61f.