@gaia-x/did-web-generator
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Gaia-X AISBL DID Generator Library

This library allows you to generate a ready to use DID.

It uses your certificate to generate it, and thus relies on several x509/crypto libraries to work.

Usage

import {createDidDocument} from '@gaia-x/did-web-generator'
//...
function getDid(){
    return createDidDocument("https://mycompanydomain.com", "x509Certificate.pem", myX509Cert)
}

will return a json object looking like this

{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/suites/jws-2020/v1"
  ],
  "id": "did:web:mycompanydomain.com",
  "verificationMethod": [
    {
      "@context": "https://w3c-ccg.github.io/lds-jws2020/contexts/v1/",
      "id": "did:web:mycompanydomain.com#X509-JWK2020",
      "type": "JsonWebKey2020",
      "controller": "did:web:mycompanydomain.com",
      "publicKeyJwk": {
        "kty": "RSA",
        "n": "...",
        "e": "AQAB",
        "alg": "RS384",
        "x5u": "http://mycompanydomain.com/.well-known/x509Certificate.pem"
      }
    }
  ],
  "assertionMethod": [
    "did:web:mycompanydomain.com#X509-JWK2020"
  ]
}

The DID creation process requires certificate analysis, we suggest you cache the result DID to avoid more computation

/@gaia-x/did-web-generator/

    Package Sidebar

    Install

    npm i @gaia-x/did-web-generator

    Weekly Downloads

    7

    Version

    1.0.1

    License

    EPL-2.0

    Unpacked Size

    137 kB

    Total Files

    40

    Last publish

    Collaborators

    • vincentkelleher
    • arthursore
    • ysellamigx
    • adeprez
    • egavard-gaia-x