fn seal
Encrypts one field of a topic element (@encrypted fields, §13.3): AES-256-GCM with the data key topic/<name>/<field> of the
node's KMS (D-4663). Store the result in a bytes field of the element; open reverses it. The field name is bound to the
ciphertext, so it does not open under another field.
Example:
use std.topic { seal, unseal }
use std.core { Utf8 }
fn main() -> () | TopicError io, db {
let sealed = seal("Payments", "card", Utf8.encode("4111"))?
let plain = unseal("Payments", "card", sealed)?
print("{Utf8.decode(plain)!}")
}Вывод
4111
pub(api) fn seal(name: str, field: str, plain: bytes) -> bytes | TopicError dbСложность. O(size of the field).
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
name | str |
field | str |
plain | bytes |
Возвращает
bytes
Ошибки
TopicError@error- `TopicError` when the data key is not available.
Эффекты
db
Определено в: std/topic/topic.oxl:713