Skip to content

DID Integration

SAP integrates with W3C Decentralized Identifiers (DIDs) to provide interoperability with the broader decentralized identity ecosystem.

A Decentralized Identifier (DID) is a globally unique identifier that:

  • Is created and controlled by the identity owner
  • Can be resolved to a DID Document containing public keys and service endpoints
  • Enables cryptographic verification of identity claims
did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
│ │ └──────────────────────────────────────────────────┘
│ │ Method-specific identifier
│ └── DID Method (key, peer, web, etc.)
└── DID URI Scheme

SAP uses did:key as the primary identifier because:

BenefitDescription
No registryID derived directly from public key
Offline verifiableNo network required to verify
Cost-freeNo blockchain fees or registration
Self-certifyingKey proves identity, identity proves key
did:key:<multibase-encoded-public-key>

The multibase encoding includes:

  1. Multicodec header indicating key type
  2. Raw public key bytes
  3. Base58btc encoding with ‘z’ prefix
Key TypeMulticodecPrefixSAP Status
Ed255190xed01z6Mk✅ Primary
secp256k10xe701zQ3s🔄 Planned
P-2560x1200zDn📋 Future
function deriveDIDKey(ed25519PublicKey) {
// 1. Prepend Ed25519 multicodec header
const ED25519_CODEC = Buffer.from([0xed, 0x01]);
const withCodec = Buffer.concat([ED25519_CODEC, ed25519PublicKey]);
// 2. Encode as base58btc with 'z' prefix
const multibase = 'z' + base58btc.encode(withCodec);
// 3. Construct DID
return `did:key:${multibase}`;
}
FeatureW3C DID DocumentSAP PID
IdentifierAny DID methoddid:key (RIK-derived)
Verification methodsFlexible arrayStructured operationalKeys with validity
ServicesGeneric endpointsAgent-specific service types
ProofOptionalRequired (RIK signature)
Key rotationMethod-dependentSentinel rotation chain
function pidToDIDDocument(pid) {
return {
'@context': ['https://www.w3.org/ns/did/v1'],
'id': pid.id,
'controller': pid.controller,
'verificationMethod': pid.operationalKeys.map(ok => ({
'id': `${pid.id}#${ok.id}`,
'type': ok.type,
'controller': pid.id,
'publicKeyMultibase': ok.publicKeyMultibase
})),
'authentication': pid.operationalKeys
.filter(ok => isCurrentlyValid(ok))
.map(ok => `${pid.id}#${ok.id}`),
'service': pid.services?.map(svc => ({
'id': `${pid.id}#${svc.id}`,
'type': svc.type,
'serviceEndpoint': svc.serviceEndpoint
}))
};
}

SAP works with W3C Verifiable Credentials (VCs) for attestations:

{
"@context": ["https://www.w3.org/2018/credentials/v1"],
"type": ["VerifiableCredential", "AgentCapabilityCredential"],
"issuer": "did:key:z6MkIssuer...",
"credentialSubject": {
"id": "did:key:z6MkAgent...",
"capability": "commerce",
"scope": ["buy", "sell"]
},
"proof": {
"type": "Ed25519Signature2020",
"verificationMethod": "did:key:z6MkIssuer...#key-1",
"proofValue": "z3Mc..."
}
}

With did:key, the identifier is the key. Rotating the key changes the DID.

Time T₁: RIK₁ → did:key:z6MkOLD
Time T₂: Rotation entry signed by z6MkOLD authorizing z6MkNEW
Time T₃: RIK₂ → did:key:z6MkNEW
Verifier traces: z6MkNEW → z6MkOLD via rotation chain
1. Parse did:key → derive public key
2. Check for SAP PID at well-known location
3. Verify PID signature matches did:key
4. Return PID if available, else basic DID Document