Skip to content

Latest commit

 

History

History
180 lines (162 loc) · 5.84 KB

Out-of-Band.md

File metadata and controls

180 lines (162 loc) · 5.84 KB

Aries Out-of-Band

Aries RFCs provides Out-of-Band protocol describing the way of creating new connections and reusing of existing. Futheremore Out-of-Band allows to attach an additional action which should be started right after connection completion.

This document contains guidelines on how to handle all possible cases for Out-of-Band invitation using Mobile-SDK.

On scanned Out-of-Band Invitation application should check whether connection already exists or not. Connection exists if one of the following conditions resolve for one of the existing connections:

  • @id field of original invitation is the same - means that we scan exactly the same invitation JSON.

  • public_did field of original invitation is the same - means that we scan invitation from same Inviter

  • recipient_keys[0] field of original invitation is the same - means that we scan invitation from same Inviter

    The next steps depend on connection existence and the Invitation format. Specifically on values of handshake_protocols and request~attach fields.

`handshake_protocols` Present? `request~attach` Present? Connection exists? Actions
NO NO NO
  1. Invalid Invitation format. Throw error.
NO NO YES
  1. Invalid Invitation format. Throw error.
YES NO NO
  1. Call ConnectionApi.vcxCreateConnectionWithOutofbandInvite function to accept Invitation and create Connection state object.
  2. Complete Connection with regular steps.
    1. ConnectionApi.vcxConnectionConnect to start connection
    2. Wait until complete: int state = ConnectionApi.vcxConnectionUpdateState in a loop until state != 4
NO YES NO
  1. Call ConnectionApi.vcxCreateConnectionWithOutofbandInvite function to accept Invitation and create Connection state object.

  2. Connection will be immediately created in the completed state - 4.

  3. Extract the original message from invitation request~attach field:

    iOS
    [appDelegate.sdkApi extractAttachedMessage:invite
      completion:^(NSError *error, NSString *attachedMessage) {
          // ...
    }];
    Android
    String attachment = UtilsApi.vcxExtractAttachedMessage(invite).get();
  4. Start protocol related to the extracted message:

    • proof request - DisclosedProofApi.proofCreateWithRequest
    • question - answer question
  5. Complete protocol using connection created on step 1.

YES YES NO
  1. Call ConnectionApi.vcxCreateConnectionWithOutofbandInvite function to accept Invitation and create Connection state object.

  2. Complete Connection with regular steps.

    1. ConnectionApi.vcxConnectionConnect to start connection
    2. Wait until complete: int state = ConnectionApi.vcxConnectionUpdateState in a loop until state != 4
  3. Extract the original message from invitation request~attach field:

    iOS
    [appDelegate.sdkApi extractAttachedMessage:invite
      completion:^(NSError *error, NSString *attachedMessage) {
          // ...
    }];
    Android
    String attachment = UtilsApi.vcxExtractAttachedMessage(invite).get();
  4. Start protocol related to the extracted message:

    • credential offer - CredentialApi.credentialCreateWithOffer ...
    • proof request - DisclosedProofApi.proofCreateWithRequest ...
    • question - answer question ...
  5. Complete protocol using connection created on step 1.

YES NO YES
  1. Reuse existing connection.
    1. call ConnectionApi.connectionSendReuse using existing connection.
    2. wait until handshake-reuse-accepted message is received.
      • UtilsApi.vcxGetMessages to download message
      • find message by thread['@thid']
NO YES YES
  1. Extract the original message from invitation request~attach field:

    iOS
    [appDelegate.sdkApi extractAttachedMessage:invite
      completion:^(NSError *error, NSString *attachedMessage) {
          // ...
    }];
    Android
    String attachment = UtilsApi.vcxExtractAttachedMessage(invite).get();
  2. Start protocol related to the extracted message:

    • credential offer - CredentialApi.credentialCreateWithOffer ...
    • proof request - DisclosedProofApi.proofCreateWithRequest
    • question - answer question
  3. Complete protocol using existing connection.

YES YES YES
  1. Reuse existing connection.

    1. call ConnectionApi.connectionSendReuse using existing connection.
    2. wait until handshake-reuse-accepted message is received.
      • UtilsApi.vcxGetMessages to download message
      • find message by thread['@thid']
  2. Extract the original message from invitation request~attach field:

    iOS

    [appDelegate.sdkApi extractAttachedMessage:invite
      completion:^(NSError *error, NSString *attachedMessage) {
          // ...
    }];

    Android

    String attachment = UtilsApi.vcxExtractAttachedMessage(invite).get();
  3. Start protocol related to the extracted message:

    • credential offer - CredentialApi.credentialCreateWithOffer ...
    • proof request - DisclosedProofApi.proofCreateWithRequest
    • question - answer question
  4. Complete protocol using existing connection.