Warning
This specification is still a work in progress and may be subject to change. Feedback and contributions are welcome.
0.1.0
Decentralized Identifiers (DIDs) provide a self-sovereign way for individuals and organizations to manage identity information in a secure and privacy-preserving manner. The did:wk
method builds upon existing DID concepts and leverages the widely established infrastructure of the web to offer a decentralized solution that prioritizes user control and robust verification.
Motivation
While DID methods like did:key
1 offer simplicity, they lack a robust mechanism to establish verifiable ownership of the underlying key pair. Conversely, did:web
2 relies on domain names, but doesn't offer an intrinsic way to prove the connection between the DID document and the controller of the domain. The did:wk
method aims to bridge this gap by:
- Strong Ownership Proof: Incorporating a cryptographic signature within the DID document to establish a verifiable link between the document and the corresponding public key.
- Decentralized Foundation: Utilizing user-owned web servers to promote self-sovereignty, giving users control over their DID documents.
- Flexibility: Optionally linking to a hosted DID document for richer metadata and features, while also functioning directly as a key-based DID when needed.
Target Audience
The did:wk
method is designed for:
- Individual Users seeking enhanced control over their online identity.
- Organizations wanting a self-hosted, verifiable approach to digital identity.
The method name for this specification is wk
. The abbreviation 'wk' stands for "web key".
The did:wk
method is designed to be used within decentralized systems and applications that can resolve URLs within the HTTPS scheme to locate DID documents. These systems may be built on top of distributed ledger technologies, peer-to-peer networks, or traditional web architectures.
The method-specific identifier of a did:wk
DID is comprised of the following components:
- Scheme:
did:wk:
- Encoded Public Key: A public key, encoded using:
- Multicodec to specify the key type and format.
- Multibase to represent the encoded key as a string.
- Optional Locator Component: Comprised of:
- The
@
symbol as a separator. - The host portion of a domain name.
- An optional port component preceded by a
:
. - An optional path component for more specific resource locations.
- The
Here is the grammar for the did:wk
format:
did-wk = "did:wk:" multibase-key [ "@" locator-component ]
locator-component = <host> [ ":" <port> ] [ <path-abempty> ]
multibase-key = <MULTIBASE(base-encoding-type, MULTICODEC(public-key-type, raw-public-key-bytes))>
<host>
, <port>
and <path-abempty>
are defined as per the URI specification 3.
<MULTIBASE>
and <MULTICODEC>
are defined in the Multiformats 4 specification.
Examples:
did:wk:z6MkwFK7L2unwCxXNaws5wxbWKbzEiC84mCYno7RW5dZ7rzq@steve.monocore.dev/pub
did:wk:z6MkwFK7L2unwCxXNaws5wxbWKbzEiC84mCYno7RW5dZ7rzq@steve.monocore.dev
did:wk:z6MkwFK7L2unwCxXNaws5wxbWKbzEiC84mCYno7RW5dZ7rzq
Explanation:
- If a locator component is not present, the
did:wk
functions similarly to adid:key
1. The core identifier is derived from the public key, enabling basic verification. - If the locator component is provided, it points to a hosted DID document. The document, located at the well-known path (
https://<locator-component>/.well-known/did.json
), contains further metadata, authentication methods, service endpoints, and a mandatoryproof
section cryptographically linking the DID document to the public key.
This section outlines the steps involved in creating a did:wk
DID, generating the associated cryptographic material, and optionally, the initial DID document structure.
-
Generate Key Pair: Choose a supported cryptographic algorithm (e.g., Ed25519, Secp256k1). Generate a new key pair for this DID.
-
Determining DID Document Mode:
- No Locator Component: If the DID does not include a locator component (
@<locator-component>
), the DID and DID document are determined as per thedid:key
specification. - Locator Component Present: Proceed to steps 3 and 4 to create and fetch a hosted DID document.
- No Locator Component: If the DID does not include a locator component (
-
DID Document Template (locator mode):
{
"@context": "https://www.w3.org/ns/did/v1",
"id": "did:wk:<encoded-public-key>[@<locator-component>]",
"verificationMethod": [
{
"id": "did:wk:<encoded-public-key>[@<locator-component>]#keys-1",
"type": "Ed25519VerificationKey2018", // Or other supported type
"controller": "did:wk:<encoded-public-key>[@<locator-component>]",
"publicKeyBase58": "<base58-encoded-public-key>"
}
],
"authentication": ["did:wk:<encoded-public-key>[@<locator-component>]#keys-1"],
"proof": {
// Signature details to be added later
}
}
-
Replace Placeholders:
<encoded-public-key>
: Replace with the encoded public key generated in step 1 (See section 3.1.4).<locator-component>
: Replace these with the corresponding URL segments for the planned location of the DID document.
-
Proof Creation: Proceed to section 3.1.2.
-
Choose Signing Algorithm: Select a supported signature algorithm for the
proof
section. -
Populate "proof" Section:
type
: Set to the chosen signature type (e.g.,"Ed25519Signature2018"
).created
: Set to a current timestamp in ISO 8601 format.verificationMethod
: Set to theid
of the verification method in the DID document associated with the signing key (likelydid:wk:<encoded-public-key>[@<locator-component>]]#keys-1
).proofPurpose
: Set to"assertionMethod"
.nonce
: Generate a sufficiently random nonce to prevent replay attacks. This field is optional but generally recommended.
- Generate Signature:
- Serialize Document: Canonicalize the DID document, excluding the
proof
section itself, according to the chosen serialization format. - Sign: Sign the serialized document using the private key corresponding to the public key in the
verificationMethod
. - Base64 Encode: Encode the signature bytes using Base64.
- Set
signatureValue
: Set thesignatureValue
field in theproof
section to the encoded signature.
- Extract Encoded Key: Identify the portion of the
did:wk
method-specific identifier following thedid:wk:
scheme and up to the optional@
symbol. - Multibase Decoding: Decode the extracted portion using the specified multibase encoding (e.g., base58btc).
- Multicodec Decoding: Decode the raw bytes from step 2 according to the multicodec prefix, yielding the raw public key bytes in their original format.
- Multicodec Encoding:
- Choose a multicodec identifier based on the public key type (e.g.,
ed25519-pub
). - Encode the raw public key bytes according to the multicodec specification.
- Multibase Encoding: Encode the multicodec output using the desired multibase format (e.g.,
base58btc
).
-
Resolve DID:
- No Locator Component: Resolve the DID according to the
did:key
specification. The DID document itself is derived from the public key portion of the DID. - Locator Component Present
- Fetch: Retrieve the DID document from the final URL (
https://<locator-component>/.well-known/did.json
). - Verify Signature:
- Locate the
proof
section within the document. - Ensure the
verificationMethod
matches a key controlled by the entity resolving the DID. - Validate the created timestamp and nonce.
- Verify the signature against the serialized DID document (excluding the
proof
section).
- Locate the
- Fetch: Retrieve the DID document from the final URL (
- No Locator Component: Resolve the DID according to the
-
Utilizing the DID Document: Once resolved and validated (if applicable), the DID document is used as per the standard DID specifications (authentication, service endpoints, etc.).
Updates primarily apply when a locator component is present and the corresponding DID document is hosted.
-
Key Rotation:
- Generate a new key pair.
- Modify the DID Document:
- Add a new
verificationMethod
section for the new key. - Optionally, revoke (or mark as superseded) the old key in the appropriate DID document sections.
- Update the
proof
section with a new signature generated using the new signing key.
- Add a new
- Upload the modified DID document to the specified host/path.
-
Service Endpoint Changes:
- Modify the relevant sections in the DID document.
- Update the
proof
with a new signature. - Upload the modified DID document to the specified host/path.
Deactivation has different implications depending on whether the DID functions in 'key mode' or has a resolvable URL.
-
No Locator Component (did:key mode): Deactivation is implied by the loss or revocation of the private key associated with the DID. There is no hosted DID document to modify in this scenario.
-
Locator Component Present:
- Option 1: Removal Delete the DID document from the hosted location. Resolution will fail.
- Option 2: Revocation Metadata Add a 'revoked' status or similar mechanism within the DID document itself, update the
proof
with a new signature, and upload the modified document.
Considerations
- Revocation Detail: The specific mechanisms of revocation (how it's represented in the DID document) would likely need its own section in your proposal if you envision complex revocation scenarios.
- Authorization: If DID document updates are to be protected, you'll need to outline an authorization mechanism for controlling who is permitted to make changes.
- Regular Rotation: Proactive key rotation is a best practice. Consider rotating keys periodically (e.g., annually) or in response to suspected compromise.
- Rotation Procedure:
- Generate a new key pair.
- Update the DID document:
- Add the new key to
verificationMethod
. - Optionally, mark the old key as superseded or remove it (depending on revocation policy).
- Create a new signature in the
proof
section.
- Add the new key to
- Upload the modified DID document (if a locator component is present).
- Revocation Mechanisms:
- Status Flag: Add a
revoked: true
field to the relevantverificationMethod
section in the DID document. - Key Removal: Fully remove the compromised key from the
verificationMethod
section. Optionally include a reason for revocation.
- Status Flag: Add a
- Propagation: Implement strategies to notify parties that may have the DID cached:
- Versioning within the DID document.
- Utilizing external revocation lists, if applicable.
- Domain Security: While the
proof
mechanism withindid:wk
DID documents mitigates some risks associated with domain ownership, secure domain management (strong passwords, 2FA, reputable registrars) remains good practice for overall security and to avoid potential disruptions due to expiration or non-renewal. - Availability: If a DID document is hosted, outages or disruptions could affect DID resolution. Consider redundancy (multiple hosts) or local caching mechanisms to improve resilience.
- Signature Freshness: The
proof
section's timestamps and nonce prevent replay attacks. Verifiers should reject signatures exceeding a specified maximum age.