Encode a certificate for transport: JCS-canonical bytes, base64url, no pad. Canonical rather than "whatever bytes we happened to store" so the encoding is deterministic — which is what lets a server cache a verified certificate by content hash and recognise the same one next request.
(document: &Value)
| 290 | /// is deterministic — which is what lets a server cache a verified certificate |
| 291 | /// by content hash and recognise the same one next request. |
| 292 | pub fn encode_for_transport(document: &Value) -> String { |
| 293 | let canonical = jcs::canonicalize(document); |
| 294 | data_encoding::BASE64URL_NOPAD.encode(canonical.as_bytes()) |
| 295 | } |
| 296 | |
| 297 | /// Decode a certificate presented in a request header. |
| 298 | /// |