Warning: This package still is in very early development. Breaking changes without notice will happen at this point!
A Sphereon SSI-SDK
plugin to verify relationships between the controller of an origin and a DID conforming to the DIF spec for well-known DID Configurations It is written in Typescript and can be compiled to any target JavaScript version.
- registerSignatureValidation
- removeSignatureValidation
- verifyDomainLinkage
- verifyDidConfigurationResource
import { IWellKnownDidVerifier, WellKnownDidVerifier } from '@sphereon/ssi-sdk.wellknown-did-verifier'
const agent = createAgent<IWellKnownDidVerifier>({
plugins: [
new WellKnownDidVerifier({
signatureVerifications: { verified: () => Promise.resolve({ verified: true }) },
onlyVerifyServiceDids: true,
}),
],
})
Registers a callback function to be called within the verification process, to verify the signature of the credentials within the DID configuration resource.
agent
.registerSignatureVerification({
callbackName: 'example_key',
signatureVerification: () => Promise.resolve({ verified: true }),
})
.then(() => console.log('success'))
.catch(() => console.log('failed'))
Removes a registered callback function.
agent
.removeSignatureVerification({ callbackName: 'example_key' })
.then(() => console.log('success'))
.catch(() => console.log('failed'))
Verifies the relationship between the controller of an origin and a given DID. Option available to only verify the service DID.
agent
.verifyDomainLinkage({
did: 'did:key:z6MkoTHsgNNrby8JzCNQ1iRLyW5QQ6R8Xuu6AA8igGrMVPUM',
signatureVerification: 'verified',
onlyVerifyServiceDids: false,
})
.then((result: IDomainLinkageValidation) => console.log(result.status))
Verifies a DID configuration resource and domain linkage credentials it holds.
You can either pass in a DID configuration resource or fetch it remotely by setting a secure well-known location (origin). Option available to only verify a given DID.
agent
.verifyDidConfigurationResource({
signatureVerification: () => Promise.resolve({ verified: true }),
origin: 'https://example.com',
did: 'did:key:z6MkoTHsgNNrby8JzCNQ1iRLyW5QQ6R8Xuu6AA8igGrMVPUM#foo',
})
.then((result: IResourceValidation) => console.log(result.status))
yarn add @sphereon/ssi-sdk.wellknown-did-verifier
yarn build