aries-cloudagent-python icon indicating copy to clipboard operation
aries-cloudagent-python copied to clipboard

Problem issue credentials (json-ld) using did:sov: as issuer and subject

Open MajdT51 opened this issue 2 years ago • 4 comments

I'm having a problem with the issue credentials (json-ld) between Alice and Faber

Faber "connection id": "8daa5789-487d-46cc-986a-cd7a2729a524" "did": "D3dJPj916xW2hkr5bwdkVx" (public and posted) "verkey": "7ZmwZTvLeCP5RZw6BASqY8kd3G7cQQYfPbdpyLC2n8Pg"

Alice "connection id": "c5d9affa-6e4d-45e0-b1ad-04d8c5b442f7" "did": "21gMuZprYu7FCWRp12C3a2" (public and posted) "verkey": "Yyww8YhX1CVLYGL7teqPEy6ERjxMnTqic4mcbtD3zSf"

Flow:

Faber send a credential to Alice (using the sov did of alice as subject)

curl -X 'POST' \
 'http://0.0.0.0:8021/issue-credential-2.0/send' -H 'accept: application/json'  -H 'Content-Type: application/json' \
 -d '{
 "connection_id": "8daa5789-487d-46cc-986a-cd7a2729a524",
 "filter": {
   "ld_proof": {
     "credential": {
       "@context": [ "https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/examples/v1"  ],
       "type": ["VerifiableCredential", "UniversityDegreeCredential"],
       "issuer": "did:sov:D3dJPj916xW2hkr5bwdkVx",
       "issuanceDate": "2020-01-01T12:00:00Z",
       "credentialSubject": {
         "id": "did:sov:21gMuZprYu7FCWRp12C3a2",
         "givenName": "Sally",
         "familyName": "Student",
         "degree": {  "type": "BachelorDegree",  "degreeType": "Undergraduate",  "name": "Bachelor of Science and Arts" },
         "college": "Faber College"
       }
     },
     "options": { "proofType": "Ed25519Signature2018" }
   }
 }
}'

Alice get the credential and store it using id 123456789, then i run
curl -X 'GET' 'http://0.0.0.0:8031/credential/w3c/123456789' .... and get the following:

{
  "contexts": [ "https://www.w3.org/2018/credentials/examples/v1", "https://www.w3.org/2018/credentials/v1"  ],
  "expanded_types": [ "https://www.w3.org/2018/credentials#VerifiableCredential", "https://example.org/examples#UniversityDegreeCredential"
  ],
  "schema_ids": [],
  "issuer_id": "did:sov:D3dJPj916xW2hkr5bwdkVx",
  "subject_ids": [
    "did:key:zUC76csfyLGwixjEMVGytesGBPBLo76gi9WVBJsiLu7y2jfm17rDiXiiVuJjoTNypykfeV7HpmcVowpErBprScBkmFE2e9pY7GZByBASei6wgS7s1wVFEL7NPDDrk7sPUqyE6pr"
  ],
  "proof_types": [ "Ed25519Signature2018" ],
  "cred_value": {
    "@context": [ "https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/examples/v1" ],
    "type": [  "VerifiableCredential", "UniversityDegreeCredential" ],
    "issuer": "did:sov:D3dJPj916xW2hkr5bwdkVx",
    "issuanceDate": "2020-01-01T12:00:00Z",
    "credentialSubject": {
      "id": "did:key:zUC76csfyLGwixjEMVGytesGBPBLo76gi9WVBJsiLu7y2jfm17rDiXiiVuJjoTNypykfeV7HpmcVowpErBprScBkmFE2e9pY7GZByBASei6wgS7s1wVFEL7NPDDrk7sPUqyE6pr",
      "givenName": "Sally", "familyName": "Student",
      "degree": { "type": "BachelorDegree", "degreeType": "Undergraduate", "name": "Bachelor of Science and Arts" },
      "college": "Faber College"
    },
    "proof": {
      "type": "Ed25519Signature2018",
      "proofPurpose": "assertionMethod",
      "verificationMethod": "did:sov:D3dJPj916xW2hkr5bwdkVx#key-1",
      "created": "2022-03-10T11:22:50.661957+00:00",
      "jws": "eyJhbGciOiAiRWREU0EiLCAiYjY0IjogZmFsc2UsICJjcml0IjogWyJiNjQiXX0..JSc56O5DSblGKtpEg8Xh7Rdim7E9NW0oMzmmcCsZ5S5T4UhmX1XS-l5jqMRBtVjPrmluwiLLQfoYXhgz_jiRDQ"
    }
  },
  "cred_tags": {},
  "record_id": "123456789"
}

Why credentialSubject.id has been changed? did:key:zUC76cs belong to Alice but it is bls12381g2 key, wallet_only and not sov did that i can use later for send presentations ?

MajdT51 avatar Mar 10 '22 12:03 MajdT51

@shaangill025 or @ianco -- can you please take a look at this? Thanks!

swcurran avatar Mar 10 '22 12:03 swcurran

I am not able to replicate the problem, it is working correctly on my end. I tried with bls12381g2 key [wallet_only] and without in wallet. Also tried with a different posted DID for Alice [holder].

  • POST issue-credential-2.0/send
    {
      "connection_id": "6300c34b-2a77-4dc3-ad9c-8d87e1a44fcc",
      "filter": {
        "ld_proof": {
          "credential": {
            "@context": ["https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/examples/v1"], 
            "type": ["VerifiableCredential", "UniversityDegreeCredential"], 
            "issuer": "did:sov:W1dd41kbhMNopR5h38PWsm", 
            "issuanceDate": "2020-01-01T12:00:00Z",
            "credentialSubject": {
                "id": "did:sov:FBmi5JLf5g58kDnNXMy4QM",
                "givenName": "Sally",
                "familyName": "Student",
                "degree": {  "type": "BachelorDegree",  "degreeType": "Undergraduate",  "name": "Bachelor of Science and Arts" },
                "college": "Faber College"
            }
          },
          "options": {
            "proofType": "Ed25519Signature2018"
          }
        }
      }
    }
    
  • POST /credentials/w3c
    {
      "results": [
        {
          "contexts": [
            "https://www.w3.org/2018/credentials/v1",
            "https://www.w3.org/2018/credentials/examples/v1"
          ],
          "expanded_types": [
            "https://www.w3.org/2018/credentials#VerifiableCredential",
            "https://example.org/examples#UniversityDegreeCredential"
          ],
          "schema_ids": [],
          "issuer_id": "did:sov:W1dd41kbhMNopR5h38PWsm",
          "subject_ids": [
            "did:sov:55GkHamhTU1ZbTbV2ab9DE"
          ],
          "proof_types": [
            "Ed25519Signature2018"
          ],
          "cred_value": {
            "@context": [
              "https://www.w3.org/2018/credentials/v1",
              "https://www.w3.org/2018/credentials/examples/v1"
            ],
            "type": [
              "VerifiableCredential",
              "UniversityDegreeCredential"
            ],
            "issuer": "did:sov:W1dd41kbhMNopR5h38PWsm",
            "issuanceDate": "2020-01-01T12:00:00Z",
            "credentialSubject": {
              "id": "did:sov:55GkHamhTU1ZbTbV2ab9DE",
              "givenName": "Sally",
              "familyName": "Student",
              "degree": {
                "type": "BachelorDegree",
                "degreeType": "Undergraduate",
                "name": "Bachelor of Science and Arts"
              },
              "college": "Faber College"
            },
            "proof": {
              "type": "Ed25519Signature2018",
              "proofPurpose": "assertionMethod",
              "verificationMethod": "did:sov:W1dd41kbhMNopR5h38PWsm#key-1",
              "created": "2022-03-17T02:31:56.381589+00:00",
              "jws": "eyJhbGciOiAiRWREU0EiLCAiYjY0IjogZmFsc2UsICJjcml0IjogWyJiNjQiXX0..WW4vpVQNlzIv75lU1AzqNK4e8xEhOmFTjnVQF066C0A8EuySkgMJ_4vqS0ItMXZFTLblP8UofqZGGVcrhJjMAw"
            }
          },
          "cred_tags": {},
          "record_id": "b4b744c9f39d40e68735a366634d2660"
        },
        {
          "contexts": [
            "https://www.w3.org/2018/credentials/v1",
            "https://www.w3.org/2018/credentials/examples/v1"
          ],
          "expanded_types": [
            "https://www.w3.org/2018/credentials#VerifiableCredential",
            "https://example.org/examples#UniversityDegreeCredential"
          ],
          "schema_ids": [],
          "issuer_id": "did:sov:W1dd41kbhMNopR5h38PWsm",
          "subject_ids": [
            "did:sov:FBmi5JLf5g58kDnNXMy4QM"
          ],
          "proof_types": [
            "Ed25519Signature2018"
          ],
          "cred_value": {
            "@context": [
              "https://www.w3.org/2018/credentials/v1",
              "https://www.w3.org/2018/credentials/examples/v1"
            ],
            "type": [
              "VerifiableCredential",
              "UniversityDegreeCredential"
            ],
            "issuer": "did:sov:W1dd41kbhMNopR5h38PWsm",
            "issuanceDate": "2020-01-01T12:00:00Z",
            "credentialSubject": {
              "id": "did:sov:FBmi5JLf5g58kDnNXMy4QM",
              "givenName": "Sally",
              "familyName": "Student",
              "degree": {
                "type": "BachelorDegree",
                "degreeType": "Undergraduate",
                "name": "Bachelor of Science and Arts"
              },
              "college": "Faber College"
            },
            "proof": {
              "type": "Ed25519Signature2018",
              "proofPurpose": "assertionMethod",
              "verificationMethod": "did:sov:W1dd41kbhMNopR5h38PWsm#key-1",
              "created": "2022-03-17T02:26:35.751468+00:00",
              "jws": "eyJhbGciOiAiRWREU0EiLCAiYjY0IjogZmFsc2UsICJjcml0IjogWyJiNjQiXX0..r_8qarB2v0PaCB6s6beeGm7zb0F1FgRSjadzVXzujDkAB_Ms312cbRNe31_z1YqAAeLRPSVPVWyvS0ORenQ2AQ"
            }
          },
          "cred_tags": {},
          "record_id": "d73483b85470471cb8de4822c0766838"
        },
        {
          "contexts": [
            "https://www.w3.org/2018/credentials/v1",
            "https://www.w3.org/2018/credentials/examples/v1"
          ],
          "expanded_types": [
            "https://www.w3.org/2018/credentials#VerifiableCredential",
            "https://example.org/examples#UniversityDegreeCredential"
          ],
          "schema_ids": [],
          "issuer_id": "did:sov:W1dd41kbhMNopR5h38PWsm",
          "subject_ids": [
            "did:sov:FBmi5JLf5g58kDnNXMy4QM"
          ],
          "proof_types": [
            "Ed25519Signature2018"
          ],
          "cred_value": {
            "@context": [
              "https://www.w3.org/2018/credentials/v1",
              "https://www.w3.org/2018/credentials/examples/v1"
            ],
            "type": [
              "VerifiableCredential",
              "UniversityDegreeCredential"
            ],
            "issuer": "did:sov:W1dd41kbhMNopR5h38PWsm",
            "issuanceDate": "2020-01-01T12:00:00Z",
            "credentialSubject": {
              "id": "did:sov:FBmi5JLf5g58kDnNXMy4QM",
              "givenName": "Sally",
              "familyName": "Student",
              "degree": {
                "type": "BachelorDegree",
                "degreeType": "Undergraduate",
                "name": "Bachelor of Science and Arts"
              },
              "college": "Faber College"
            },
            "proof": {
              "type": "Ed25519Signature2018",
              "proofPurpose": "assertionMethod",
              "verificationMethod": "did:sov:W1dd41kbhMNopR5h38PWsm#key-1",
              "created": "2022-03-17T02:23:11.881332+00:00",
              "jws": "eyJhbGciOiAiRWREU0EiLCAiYjY0IjogZmFsc2UsICJjcml0IjogWyJiNjQiXX0..bQMcjtUxX4xH7uA48MGWsRMQEZ3lEEqgpRU6WD7e9uxsW5tKvXIhp89EC_gDs1XsyDgXYAxVdWVx-TyfTSdRBg"
            }
          },
          "cred_tags": {},
          "record_id": "6b532d454b374766a4f270ce9a48d476"
        }
      ]
    }
    

shaangill025 avatar Mar 16 '22 19:03 shaangill025

@shaangill025 Thanks for your reply but what do you mean exactly with "I tried with bls12381g2 key"? When i generate the did for alice, i'm using "key_type": "ed25519" because i want a sov did. and then using that did as holder and the already generated did for faber as issuer.

Could the connection be the problem? What I'm doing is:

I'm starting Faber and Alice Demo like the following:

LEDGER_URL=http://dev.greenlight.bcovrin.vonx.io ./run_demo faber --events --no-auto --bg LEDGER_URL=http://dev.greenlight.bcovrin.vonx.io ./run_demo alice --events --no-auto --bg

Using Faber.agent: I call Get wallet/did and get the did (it has only 1 at the start) and this did is used as isser

Using Alice.agent: I create a local DID ("key_type": "ed25519" ), register it manually on http://dev.greenlight.bcovrin.vonx.io and assign it to public using Post wallet/did/public and this did is used as holder

Using Faber.agent i create out-of-band invitation (auto_accept: true, use_public_did: true and handshake_protocols: https://didcomm.org/didexchange/1.0)

Using Alice.agent i receive the invitation (auto_accept=true)

Alice connection:

  {
      "connection_protocol": "didexchange/1.0",
      "state": "active",
      "invitation_mode": "once",
      "alias": "Alice",
      "their_did": "2NZEiissFXBgGZnMHhbNWj",
      "their_label": "Invitation to Alice",
      "routing_state": "none",
      "created_at": "2022-03-17T13:58:46.075622Z",
      "their_role": "inviter",
      "updated_at": "2022-03-17T13:58:46.657273Z",
      "request_id": "2aa00d58-f1ee-4184-b7e2-a9faae8f6f61",
      "their_public_did": "ECZv4EdMXi4ZbT1fUpyuYP",
      "connection_id": "b224490f-48ed-46e0-b974-b45ac53faa9b",
      "invitation_msg_id": "97d75612-4451-4a6e-9265-c64bc9fe6ec5",
      "rfc23_state": "completed",
      "accept": "auto",
      "my_did": "FYA8jfVuGcTT3qUifnXqdB"
    }

Faber connection

  {
      "invitation_mode": "once",
      "my_did": "2NZEiissFXBgGZnMHhbNWj",
      "their_did": "FYA8jfVuGcTT3qUifnXqdB",
      "connection_id": "6d2db0ae-09d1-4736-9a1b-2cd305fff63e",
      "invitation_key": "8CG6fuG8fipqQMia7vPW1mxNq7yaCRTZrG53uMHYKLJ9",
      "connection_protocol": "didexchange/1.0",
      "routing_state": "none",
      "updated_at": "2022-03-17T13:58:46.696726Z",
      "request_id": "2aa00d58-f1ee-4184-b7e2-a9faae8f6f61",
      "state": "active",
      "invitation_msg_id": "97d75612-4451-4a6e-9265-c64bc9fe6ec5",
      "alias": "Faber",
      "accept": "auto",
      "rfc23_state": "completed",
      "their_label": "alice.agent",
      "their_role": "invitee",
      "created_at": "2022-03-17T13:58:12.810397Z"
  }

MajdT51 avatar Mar 18 '22 08:03 MajdT51

Any updates to this? @shaangill025 -- perhaps you could add this to your list to retry?

swcurran avatar Jun 03 '22 19:06 swcurran

This sounds like the holder DID override behavior that I corrected in #2341. Now, if the credential offer from the issuer contains a credentialSubject.id, as is the case in your example, the holder will NOT override the subject with a DID key. This was originally done to help ensure that the holder could later present a proof of possession for the credential subject ID.

dbluhm avatar Aug 22 '23 14:08 dbluhm