mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-23 23:55:01 +01:00
CLI decode_token: use CBOR diagnostic format instead of pure JSON
This brings decoded TokenV4s in line with the format specified in NUT-00, especially around how byte array fields are handled.
This commit is contained in:
@@ -2,6 +2,7 @@ use std::str::FromStr;
|
||||
|
||||
use anyhow::Result;
|
||||
use cdk::nuts::Token;
|
||||
use cdk::util::serialize_to_cbor_diag;
|
||||
use clap::Args;
|
||||
|
||||
#[derive(Args)]
|
||||
@@ -13,6 +14,6 @@ pub struct DecodeTokenSubCommand {
|
||||
pub fn decode_token(sub_command_args: &DecodeTokenSubCommand) -> Result<()> {
|
||||
let token = Token::from_str(&sub_command_args.token)?;
|
||||
|
||||
println!("{:}", serde_json::to_string_pretty(&token)?);
|
||||
println!("{:}", serialize_to_cbor_diag(&token)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user