-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(()) | ||
} |