Warning: This package still is in very early development. Breaking changes without notice will happen at this point!
A Sphereon SSI-SDK
plugin to create DID configuration resources and domain linkage credentials conforming to the DIF spec for well-known DID Configurations. It is written in Typescript and can be compiled to any target JavaScript version.
- addLinkedDomainsService
- getDidConfigurationResource
- issueDidConfigurationResource
- issueDomainLinkageCredential
- registerCredentialIssuance
- removeCredentialIssuance
- saveDidConfigurationResource
import { IWellKnownDidIssuer, WellKnownDidIssuer } from '@sphereon/ssi-sdk.wellknown-did-issuer'
const agent = createAgent<IWellKnownDidIssuer>({
plugins: [
new WellKnownDidIssuer({
credentialIssuances: { issueVc: () => Promise.resolve({ ...attestationCredential }) },
}),
],
})
Registers a callback function.
agent
.registerCredentialIssuance({
callbackName: 'example_key',
credentialIssuance: () => Promise.resolve({ ...attestationCredential }),
})
.then(() => console.log('success'))
.catch(() => console.log('failed'))
Removes a registered callback function.
agent
.removeCredentialIssuance({ callbackName: 'example_key' })
.then(() => console.log('success'))
.catch(() => console.log('failed'))
Issues a DID configuration resource. Can optionally save it to a database using the save
flag.
agent
.issueDidConfigurationResource({
issuances: [
{
did: DID,
origin: ORIGIN,
issuanceDate: new Date().toISOString(),
expirationDate: new Date().toISOString(),
options: { proofFormat: ProofFormatTypesEnum.JSON_WEB_TOKEN },
},
],
credentialIssuance: 'example_key',
save: true,
})
.then((result: IDidConfiguration) => console.log(result))
.catch(() => console.log('failed'))
Get a DID configuration resource from the database.
agent
.getDidConfigurationResource({
origin: 'https://example.com',
})
.then((result: IDidConfiguration) => console.log(result))
.catch(() => console.log('failed'))
Saves a DID configuration resource to a database.
agent
.saveDidConfigurationResource({
origin: 'https://example.com',
didConfiguration,
})
.then((result: IResourceValidation) => console.log(result.status))
Issues a domain linkage credential. Can optionally save it to a database using the save
flag.
agent
.issueDomainLinkageCredential({
did: DID,
origin: ORIGIN,
issuanceDate: new Date().toISOString(),
expirationDate: new Date().toISOString(),
options: { proofFormat: ProofFormatTypesEnum.JSON_WEB_TOKEN },
credentialIssuance: 'example_key',
save: true,
})
.then((result: IResourceValidation) => console.log(result.status))
Adds a LinkedDomains service to a DID.
agent
.addLinkedDomainsService({
did: 'did:key:example',
origin: 'https://example.com',
servideId: 'linkedDomains1',
})
.then((result: IResourceValidation) => console.log(result.status))
yarn add @sphereon/ssi-sdk.wellknown-did-issuer
yarn build