error secret-json
What it means#
secret<T> fields travel only in the binary format (over TLS, or in an encrypted journal). The JSON encoder rejects them: when the format is statically known (Format.Json, formats.json, toJson, fromJson) it is a compile error, otherwise encode returns EncodeError.Secret at run time.
Example#
use std.ser { toJson }
data Login {
user: str
pass: secret<str>
}
fn dump(l: &Login) {
let s = toJson(l) // <- secret-json
}error
secret-json
How to fix#
Encode in the binary format, or serialize a view of the type without the secret field.