Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
OtaK committed Jul 24, 2023
1 parent 386f1de commit 1ec9597
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"crypto-ffi",
"crypto-attributes",
"keystore",
"keystore-dump",
"mls-provider",
"interop"
]
Expand Down
15 changes: 15 additions & 0 deletions keystore-dump/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "keystore-dump"
version = "0.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
core-crypto-keystore = { path = "../keystore" }
clap = { version = "4", features = ["derive"] }
color-eyre = "0.6"
tokio = { version = "1", features = ["full"] }
serde_json = "1"
postcard = { version = "1.0", default-features = false, features = ["use-std"] }
serde-transcode = "1"
36 changes: 36 additions & 0 deletions keystore-dump/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use color_eyre::eyre::Result;
use core_crypto_keystore::{deser, entities::*, ser, Connection as Keystore};

#[derive(Debug, clap::Parser)]
#[command(author, version, about, long_about = None)]
struct Args {
#[arg(short, long)]
key: String,

path: String,
}

#[tokio::main]
async fn main() -> Result<()> {
use clap::Parser as _;
color_eyre::install()?;

let args = Args::parse();

let keystore = Keystore::open_with_key(&args.path, &args.key).await?;
let json_serializer = serde_json::Serializer::pretty(std::io::stdout());

for credential in keystore
.find_all::<MlsCredential>(Default::default())
.await?
.into_iter()
{
let deser = postcard::Deserializer::from_bytes(&cred.credential);
serde_transcode::transcode(&mut deser, &mut json_serializer)?;
}

// let mls_signature_keypairs: Vec<MlsSignatureKeyPair>
let mls_groups: Vec<PersistedMlsGroup> = keystore.find_all(Default::default()).await?;

Ok(())
}

0 comments on commit 1ec9597

Please sign in to comment.