Skip to content

Commit

Permalink
small patch re acapy testing
Browse files Browse the repository at this point in the history
Signed-off-by: George Mulhearn <[email protected]>
  • Loading branch information
gmulhearn-anonyome committed Jun 24, 2024
1 parent 40f1f28 commit 732f260
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ pub(crate) async fn jws_verify_attachment(
"Cannot verify JWS of a non-base64-encoded attachment",
));
};
// aries attachments do not REQUIRE that the attachment has no padding,
// but JWS does, so remove it; just incase.
let attach_base64 = attach_base64.replace("=", "");

let Some(ref jws) = attach.data.jws else {
return Err(AriesVcxError::from_msg(
AriesVcxErrorKind::InvalidInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ async fn extract_and_verify_responder_did_doc(
let their_did = response.content.did;

if let Some(did_doc_attach) = response.content.did_doc {
debug!(
"Verifying signature of DIDDoc attached to response: {did_doc_attach:?} against \
expected key {invitation_key:?}"
);
let verified_signature =
jws_verify_attachment(&did_doc_attach, invitation_key, wallet).await?;
if !verified_signature {
Expand All @@ -160,6 +164,10 @@ async fn extract_and_verify_responder_did_doc(
}

if let Some(did_rotate_attach) = response.content.did_rotate {
debug!(
"Verifying signature of DID Rotate attached to response: {did_rotate_attach:?} \
against expected key {invitation_key:?}"
);
let verified_signature =
jws_verify_attachment(&did_rotate_attach, invitation_key, wallet).await?;
if !verified_signature {
Expand Down

0 comments on commit 732f260

Please sign in to comment.