From 98234ab0332560a68bfdd1423e9926c06a510305 Mon Sep 17 00:00:00 2001 From: John Cairns Date: Wed, 14 Feb 2024 09:28:10 -0600 Subject: [PATCH] testing parsing --- .vscode/launch.json | 4 +++- lib/src/types/did_parser.rs | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index f4719eb..7664e3d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -29,7 +29,6 @@ "cargo": { "args": [ "build", - "--bin=resolver", "--package=resolver" ], "filter": { @@ -38,6 +37,9 @@ } }, "args": [], + "env": { + "RPC_URL": "wss://eth-sepolia.g.alchemy.com/v2/uoO_-LFYsnyxFuDC1amzK6e_EPPz8Sh8", + }, "cwd": "${workspaceFolder}" }, ] diff --git a/lib/src/types/did_parser.rs b/lib/src/types/did_parser.rs index af228da..ee3ff34 100644 --- a/lib/src/types/did_parser.rs +++ b/lib/src/types/did_parser.rs @@ -285,6 +285,23 @@ mod tests { } } + #[test] + fn test_parse_hex_string() { + let decoded_data = + hex::decode("6469642f7376632f4d6573736167696e67536572766963650000000000000000") + .unwrap(); + let vec32 = String::from_utf8_lossy(decoded_data.as_slice().try_into().unwrap()); + let parsed = parse_attribute(&vec32); + assert_eq!( + parsed, + Ok(Attribute::PublicKey(PublicKey { + key_type: KeyType::EcdsaSecp256k1VerificationKey2019, + purpose: KeyPurpose::VerificationKey, + encoding: KeyEncoding::Hex + })) + ); + } + #[test] fn test_did_xmtp_attribute_parser() { let keys = [