mirror of
https://github.com/aljazceru/cdk.git
synced 2026-01-05 22:15:46 +01:00
This brings decoded TokenV4s in line with the format specified in NUT-00, especially around how byte array fields are handled.
20 lines
420 B
Rust
20 lines
420 B
Rust
use std::str::FromStr;
|
|
|
|
use anyhow::Result;
|
|
use cdk::nuts::Token;
|
|
use cdk::util::serialize_to_cbor_diag;
|
|
use clap::Args;
|
|
|
|
#[derive(Args)]
|
|
pub struct DecodeTokenSubCommand {
|
|
/// Cashu Token
|
|
token: String,
|
|
}
|
|
|
|
pub fn decode_token(sub_command_args: &DecodeTokenSubCommand) -> Result<()> {
|
|
let token = Token::from_str(&sub_command_args.token)?;
|
|
|
|
println!("{:}", serialize_to_cbor_diag(&token)?);
|
|
Ok(())
|
|
}
|