Skip to content

Commit

Permalink
testing parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jac18281828 committed Feb 14, 2024
1 parent 64b6ca7 commit 98234ab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"cargo": {
"args": [
"build",
"--bin=resolver",
"--package=resolver"
],
"filter": {
Expand All @@ -38,6 +37,9 @@
}
},
"args": [],
"env": {
"RPC_URL": "wss://eth-sepolia.g.alchemy.com/v2/uoO_-LFYsnyxFuDC1amzK6e_EPPz8Sh8",
},
"cwd": "${workspaceFolder}"
},
]
Expand Down
17 changes: 17 additions & 0 deletions lib/src/types/did_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit 98234ab

Please sign in to comment.