eclipse-tractusx / managed-identity-wallet

Apache License 2.0
9 stars 22 forks source link

Enhancement: did document fields #292

Closed borisrizov-zf closed 2 months ago

borisrizov-zf commented 5 months ago

Description

The current implementation of the MIW doesn't fully describe the DID document. The verificationMethod field and the assertionMethod field must be optimised.

Acceptance Criteria

Additional Information

Examples:

VerificationMethod with one embedded public key (Ed25519) in JsonWebKey2020 format and a reference inside the assertionMethod

# a snippet from a did document
...
"verificationMethod": [{
    "id": "did:example:123#_Qq0UL2Fq651Q0Fjd6TvnYE-faHiOpRlPVQcY_-tA4A",
    "type": "JsonWebKey2020", 
    "controller": "did:example:123",
    "publicKeyJwk": {
      "crv": "Ed25519", 
      "x": "VCpo2LMLhn6iWku8MKvSLg2ZAoC-nlOyPVQaO3FxVeQ", 
      "kty": "OKP", 
      "kid": "_Qq0UL2Fq651Q0Fjd6TvnYE-faHiOpRlPVQcY_-tA4A" 
    }
  }],
"assertionMethod" ["did:example:123#_Qq0UL2Fq651Q0Fjd6TvnYE-faHiOpRlPVQcY_-tA4A"],
...

Same as above, but a 'secp256k1' key

# a snippet from a did document
...
"verificationMethod": [{
      "id": "did:example:123#key-2",
      "type": "JsonWebKey2020",
      "controller": "did:example:123",
      "publicKeyJwk": {
        "kty": "EC", // external (property name)
        "crv": "secp256k1", // external (property name)
        "x": "Z4Y3NNOxv0J6tCgqOBFnHnaZhJF6LdulT7z8A-2D5_8", // external (property name)
        "y": "i5a2NtJoUKXkLm6q8nOEu9WOkso1Ag6FTUT6k_LMnGk" // external (property name)
      }
    }],
"assertionMethod" ["did:example:123#key-2"],
...
nitin-vavdiya commented 2 months ago

updated did document:

{
  "assertionMethod": [
    "did:web:localhost:BPNL000000000000#719273e5-f1d4-4a48-b981-c29f47d99d60",
    "did:web:localhost:BPNL000000000000#a14a1135-09d7-4ff1-9896-2336f915a698"
  ],
  "id": "did:web:localhost:BPNL000000000000",
  "verificationMethod": [
    {
      "publicKeyJwk": {
        "kty": "OKP",
        "crv": "Ed25519",
        "x": "J7bSq0d5Vq7hfGJNBv7W-JLf6YndRLC2JGLLFi0f7-A"
      },
      "controller": "did:web:localhost:BPNL000000000000",
      "id": "did:web:localhost:BPNL000000000000#719273e5-f1d4-4a48-b981-c29f47d99d60",
      "type": "JsonWebKey2020"
    },
    {
      "publicKeyJwk": {
        "crv": "secp256k1",
        "y": "KYE6l0muY7iVCbyipjo3r-6oro5UKi5THbOH5AQGiI8",
        "x": "O8z3qeiui-zJy2-rf98j3-vchUK_G6RZz1vSGltFC0o",
        "kty": "EC"
      },
      "controller": "did:web:localhost:BPNL000000000000",
      "id": "did:web:localhost:BPNL000000000000#a14a1135-09d7-4ff1-9896-2336f915a698",
      "type": "JsonWebKey2020"
    }
  ],
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3c.github.io/vc-jws-2020/contexts/v1"
  ],
  "service": [
    {
      "serviceEndpoint": "https://localhost/api/token",
      "id": "did:web:localhost:BPNL000000000000#SecurityTokenService",
      "type": "SecurityTokenService"
    },
    {
      "serviceEndpoint": "https://localhost",
      "id": "did:web:localhost:BPNL000000000000#CredentialService",
      "type": "CredentialService"
    }
  ]
}