Setup of .well-known/did.json
If you are choosing to use the did
Overview
The .well-known/did.json file connects your domain with a Decentralized Identifier (DID) and exposes the public key used to sign declarations. This enables verifiers to confirm that the same entity controls both the cryptographic key and the domain used in your Liccium declarations.
What is a DID Document?
A DID document is a JSON-LD file containing one or more cryptographic public keys and metadata linked to a Decentralized Identifier. With did
Prerequisites
To complete the setup, ensure you have:
- Your X.509 certificate in .p12 format
- openssl installed on your system
- Node.js and npm (for the key conversion script)
- Access to your domain's web server
Step-by-Step Setup
Step 1: Convert .p12 to .pem Certificate
Extract your certificate (with public key) from the .p12 container:
Code(bash)
Replace your_cert.p12
with your actual file. This creates a cert.pem
file.
Step 2: Extract the RSA Public Key
Code(bash)
This creates a pubkey.pem
file containing your RSA public key.
Step 3: Convert the Public Key to JWK Format (RSA)
Use node-jose to convert the PEM to JWK format:
JavaScript Script (Node.js)
Code(javascript)
Install and Run:
Code(bash)
The output will contain a JWK like:
Code(json)
Step 4: Generate the .well-known/did.json File
Create a JSON file at /.well-known/did.json
using the extracted values:
Code(json)
Important:
- Replace
yourdomain.com
with your actual domain name - Use the real
n
,e
, andx5t#S256
values from your conversion
Step 5: Deploy the DID Document
Place the did.json
file at:
Code
Your web server must:
- Serve the file over HTTPS
- Return
application/json
content type - Respond to CORS requests if needed
Testing Your Setup
To check your configuration:
Code(bash)
Ensure:
- The document loads successfully
- The JSON is valid and contains the public key
- HTTPS and domain control are in place
Security Considerations
- Never publish private keys – only the public key belongs in the DID document
- Ensure your domain uses HTTPS
- Keep the certificate and private key securely stored
Next Steps
Once your .well-known/did.json
is deployed and verified:
- Use the corresponding private key to sign Liccium declarations
- Submit your declarations via the Liccium Declaration API
- Enable cryptographic verification of your declarations by third parties using your domain-bound DID