Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement verify verifiable message #240

Merged
merged 5 commits into from
Feb 13, 2024

Conversation

rabe1028
Copy link
Contributor

@rabe1028 rabe1028 commented Feb 8, 2024

Description

  • Implementation of a verifiable message api, except for sending message activities to Studio.
  • Add e2e test scenario for a create-verifiable-message api and a verify-verifiable-message api.
  • Add OpenAPI yaml to run mock server of NodeX Studio and SideTree.
  • Add docker compose to run mock server.

Check

  • Run E2E Test.
  • Verify check with curl

You can check with following command.

curl -v --unix-socket ~/.nodex/run/nodex.sock \
-X POST \
-H "Content-Type: application/json" \
-d '{"message": "received from create api" }' \
http://localhost/verify-verifiable-message

Here is my result.

MESSAGE=$(curl --unix-socket ~/.nodex/run/nodex.sock \
-X POST \
-H "Content-Type: application/json" \
-d '{"destination_did" : "did:nodex:test:EiD_ZSrS4E4FZruAIJnMt1KjvH1HvwCRYdnIzYpQr4vsuQ" , "message" : "test"}' \
http://localhost/create-verifiable-message)

echo $MESSAGE | jaq .
{
  "@context": [
    "https://www.w3.org/2018/credentials/v1"
  ],
  "credentialSubject": {
    "container": {
      "created_at": "2024-02-10T10:39:45.034719+00:00",
      "destination_did": "did:nodex:test:EiD_ZSrS4E4FZruAIJnMt1KjvH1HvwCRYdnIzYpQr4vsuQ",
      "message_id": "0df7e86f-4f3c-4239-8cda-4faa11d461ad",
      "payload": "test",
      "project_hmac": "69e49a9a6f03b14ab6d702dc960110e70ae2c64e73a9badd641b54d0f28efef3"
    }
  },
  "issuanceDate": "2024-02-10T10:39:45.034719+00:00",
  "issuer": {
    "id": "did:nodex:test:EiDEp_0NuvczSI9n-8B5NmQoBQX__QORK-uZOhRs2zc_6A"
  },
  "proof": {
    "challenge": null,
    "controller": null,
    "created": "2024-02-10T10:39:45.039202+00:00",
    "domain": null,
    "jws": "eyJhbGciOiJFUzI1NksiLCJiNjQiOmZhbHNlLCJjcml0IjpbImI2NCJdfQ..dL3Gy5qZb3tJ7j7WlGH3lhlGey2s-X5GcVHh7gUf6wI2f7lRrrweCYbXIAIFg4aernE909G7WVS8iXr-kmnNEg",
    "proofPurpose": "authentication",
    "type": "EcdsaSecp256k1Signature2019",
    "verificationMethod": "did:nodex:test:EiDEp_0NuvczSI9n-8B5NmQoBQX__QORK-uZOhRs2zc_6A#signingKey"
  },
  "type": [
    "VerifiableCredential"
  ]
}

BODY=$(jaq -n --arg message $MESSAGE '$ARGS.named')

curl -v --unix-socket ~/.nodex/run/nodex.sock \
-X POST \
-H "Content-Type: application/json" \
-d  $BODY \
http://localhost/verify-verifiable-message

@rabe1028 rabe1028 force-pushed the implement-verify-verifiable-message branch 4 times, most recently from 9ced417 to 1c37642 Compare February 10, 2024 10:02
@rabe1028 rabe1028 force-pushed the implement-verify-verifiable-message branch from 1c37642 to 6e30c62 Compare February 10, 2024 10:14
@rabe1028 rabe1028 marked this pull request as ready for review February 10, 2024 11:55
@rabe1028 rabe1028 requested a review from a team as a code owner February 10, 2024 11:55
curry-like
curry-like previously approved these changes Feb 11, 2024
da13da
da13da previously approved these changes Feb 12, 2024
Copy link
Contributor

@da13da da13da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

yokishava
yokishava previously approved these changes Feb 12, 2024
Base automatically changed from implement-create-verifiable-message to main February 12, 2024 11:05
@rabe1028 rabe1028 dismissed stale reviews from yokishava, da13da, and curry-like February 12, 2024 11:05

The base branch was changed.

@rabe1028 rabe1028 merged commit 9adc9d1 into main Feb 13, 2024
5 checks passed
@rabe1028 rabe1028 deleted the implement-verify-verifiable-message branch February 13, 2024 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants