decentralized-identity / ethr-did-resolver

DID resolver for Ethereum Addresses with support for key management

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add publicKeyPem as possible key types

gjgd opened this issue · comments

commented

The specs mention the possibility to add a RSA key like this:

"publicKey": [{
    "id": "did:example:123456789abcdefghi#keys-1",
    "type": "RsaVerificationKey2018",
    "owner": "did:example:123456789abcdefghi",
    "publicKeyPem": "-----BEGIN PUBLIC KEY...END PUBLIC KEY-----\r\n"
  }],

Desired behavior:

const rsa4096PublicKey = "-----BEGIN PUBLIC KEY...END PUBLIC KEY-----\r\n" 
await ethrDid.setAttribute('did/pub/Rsa/veriKey/pem', rsa4096PublicKey)

should create the key

{
    "id": "did:ethr:123456789abcdefghi#delegate-1",
    "type": "RsaVerificationKey2018",
    "owner": "did:ethr:123456789abcdefghi",
    "publicKeyPem": "-----BEGIN PUBLIC KEY...END PUBLIC KEY-----\r\n"
}

Current behavior

it creates the key

{
    "id": "did:ethr:123456789abcdefghi#delegate-1",
    "type": "RsaVerificationKey2018",
    "owner": "did:ethr:123456789abcdefghi",
    "value": "0x2d2d2d2d2d424547494e205055424c4943204b45592e2e2e454e44205055424c4943204b45592d2d2d2d2d0d0a"
}

Two problems:

  • Key is displayed in hex format instead of utf8
  • Key type is "value" instead of "publicKeyPem"