Expand description
DAG-JOSE codec.
Structures are provided for encoding and decoding JSON Web Signatures and Encryption values.
use dag_jose::{DagJoseCodec, Jose};
use ipld_core::codec::Codec;
let data = hex::decode("
a2677061796c6f616458240171122089556551c3926679cc52c72e182a5619056a4727409ee93a26
d05ad727ca11f46a7369676e61747572657381a26970726f7465637465644f7b22616c67223a2245
64445341227d697369676e61747572655840fbff49e4e65c979955b9196023534913373416a11beb
fdb256c9146903ddb9c450e287be379ca70a5e7bc039b848fb66d4bd5b96dae986941e04e7968d55
b505".chars().filter(|c| !c.is_whitespace()).collect::<String>()).unwrap();
// Decode binary data into an JOSE value.
let jose: Jose = DagJoseCodec::decode_from_slice(&data).unwrap();
// Encode an JOSE value into bytes
let bytes = DagJoseCodec::encode_to_vec(&jose).unwrap();
assert_eq!(data, bytes);
Enable the feature ‘dag-json’ to be able to encode/decode Jose values using DAG-JSON.
Structs§
- DAG-JOSE codec
- A JSON Web Encryption object as defined in RFC7516.
- A JSON Web Signature object as defined in RFC7515.
- A recipient of a JSON Web Encryption message.
- A signature part of a JSON Web Signature.
Enums§
- A JSON Object Signing and Encryption value as defined in RFC7165.