Skip to content

Commit

Permalink
examples/cwt: demonstrate [private_]claim() (google#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddrysdale authored Jan 25, 2023
1 parent 8aa7edf commit 424f62b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/cwt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
////////////////////////////////////////////////////////////////////////////////

//! Example program demonstrating signed CWT processing.
use coset::{cwt, iana, CborSerializable, CoseError};
use coset::{cbor::value::Value, cwt, iana, CborSerializable, CoseError};

#[derive(Copy, Clone)]
struct FakeSigner {}
Expand Down Expand Up @@ -49,6 +49,13 @@ fn main() -> Result<(), CoseError> {
.not_before(cwt::Timestamp::WholeSeconds(1443944944))
.issued_at(cwt::Timestamp::WholeSeconds(1443944944))
.cwt_id(vec![0x0b, 0x71])
// Add additional standard claim.
.claim(
iana::CwtClaimName::Scope,
Value::Text("email phone".to_string()),
)
// Add additional private-use claim.
.private_claim(-70_000, Value::Integer(42.into()))
.build();
let aad = b"";

Expand Down

0 comments on commit 424f62b

Please sign in to comment.