Skip to content

Commit

Permalink
Send no attachment in requests
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
  • Loading branch information
mirgee authored and Patrik-Stas committed Nov 1, 2023
1 parent fa6825f commit 5a63a13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pub async fn did_doc_from_did(
let service = resolve_service(ledger, &OobService::Did(did.id().to_string())).await?;
let did_url: DidUrl = format!("{}#vm-0", did.to_string()).try_into()?;
let vm = VerificationMethod::builder(did_url, did.clone(), VerificationMethodType::Ed25519VerificationKey2020)
// TODO: Make it easier to get the first key in base58 (regardless of initial kind) from ServiceSov
.add_public_key_base58(
service
.recipient_keys
Expand All @@ -82,11 +81,7 @@ pub async fn did_doc_from_did(
}

// TODO: Replace by a builder
pub fn construct_request(
invitation_id: String,
our_did: String,
attachment: Option<Attachment>,
) -> Result<Request, AriesVcxError> {
pub fn construct_request(invitation_id: String, our_did: String) -> Result<Request, AriesVcxError> {
let request_id = Uuid::new_v4().to_string();
let thread = {
let mut thread = Thread::new(request_id.clone());
Expand All @@ -107,7 +102,7 @@ pub fn construct_request(
goal_code: Some(MaybeKnown::Known(ThreadGoalCode::AriesRelBuild)),
// Interop note: Should not have to send both DID and DDO if did resolvable
did: our_did,
did_doc: attachment,
did_doc: None,
};
Ok(Request::with_decorators(request_id.clone(), content, decorators))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ impl DidExchangeRequester<RequestSent> {
&wallet,
)
.await?;
let request = construct_request(
invitation.id.clone(),
our_did_document.id().to_string(),
Some(signed_attach),
)?;
let request = construct_request(invitation.id.clone(), our_did_document.id().to_string())?;

Ok(TransitionResult {
state: DidExchangeRequester::from_parts(
Expand Down Expand Up @@ -84,7 +80,7 @@ impl DidExchangeRequester<RequestSent> {
))?
.public_key()?;
let signed_attach = jws_sign_attach(ddo_sov_to_attach(our_did_document.clone())?, key, &wallet).await?;
let request = construct_request(invitation_id.clone(), our_did.to_string(), Some(signed_attach))?;
let request = construct_request(invitation_id.clone(), our_did.to_string())?;

Ok(TransitionResult {
state: DidExchangeRequester::from_parts(
Expand Down Expand Up @@ -156,6 +152,7 @@ impl DidExchangeRequester<RequestSent> {
invitation_id: self.state.invitation_id,
request_id: self.state.request_id,
},
// TODO: Make sure to make the DDO identifier did:peer:3 for both
did_document,
self.our_did_document,
),
Expand Down

0 comments on commit 5a63a13

Please sign in to comment.