0.11.0 • Published 2 years ago

@sphereon/ssi-sdk-wellknown-did-issuer v0.11.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

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.

Available functions

  • addLinkedDomainsService
  • getDidConfigurationResource
  • issueDidConfigurationResource
  • issueDomainLinkageCredential
  • registerCredentialIssuance
  • removeCredentialIssuance
  • saveDidConfigurationResource

Usage

Adding the plugin to an agent:

import { IWellKnownDidIssuer, WellKnownDidIssuer } from '@sphereon/ssi-sdk-wellknown-did-issuer'

const agent = createAgent<IWellKnownDidIssuer>({
  plugins: [
    new WellKnownDidIssuer({
      credentialIssuances: { issueVc: () => Promise.resolve({ ...vc }) },
    }),
  ],
})

Register credential issuance callback:

Registers a callback function.

agent
  .registerCredentialIssuance({
    callbackName: 'example_key',
    credentialIssuance: () => Promise.resolve({ ...vc }),
  })
  .then(() => console.log('success'))
  .catch(() => console.log('failed'))

Remove credential issuance callback:

Removes a registered callback function.

agent
  .removeCredentialIssuance({ callbackName: 'example_key' })
  .then(() => console.log('success'))
  .catch(() => console.log('failed'))

Issue DID configuration resource:

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 DID configuration resource:

Get a DID configuration resource from the database.

agent
  .getDidConfigurationResource({
    origin: 'https://example.com',
  })
  .then((result: IDidConfiguration) => console.log(result))
  .catch(() => console.log('failed'))

Save DID configuration resource:

Saves a DID configuration resource to a database.

agent
  .saveDidConfigurationResource({
    origin: 'https://example.com',
    didConfiguration,
  })
  .then((result: IResourceValidation) => console.log(result.status))

Issue domain linkage credential:

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))

Add linked domains service:

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))

Installation

yarn add @sphereon/ssi-sdk-wellknown-did-issuer

Build

yarn build
0.10.1-next.14

2 years ago

0.10.1-next.13

2 years ago

0.10.0

2 years ago

0.10.2-next.11

2 years ago

0.11.0

2 years ago

0.10.1-next.6

2 years ago

0.10.1-next.9

2 years ago

0.10.1-next.8

2 years ago

0.10.1-next.2

2 years ago

0.9.1-next.121

2 years ago

0.9.1-next.42

2 years ago

0.9.1-next.109

2 years ago

0.9.1-next.107

2 years ago

0.9.1-next.105

2 years ago

0.9.1-next.103

2 years ago

0.9.1-next.100

2 years ago

0.9.1-next.56

2 years ago

0.9.1-next.55

2 years ago

0.9.1-next.9

2 years ago

0.9.1-next.69

2 years ago

0.9.1-next.62

2 years ago

0.9.1-next.89

2 years ago

0.8.1-next.272

2 years ago

0.9.1-next.17

2 years ago

0.9.1-next.16

2 years ago

0.9.1-next.15

2 years ago

0.9.1-next.13

2 years ago

0.9.1-next.12

2 years ago

0.9.1-next.99

2 years ago

0.9.1-next.11

2 years ago

0.9.1-next.10

2 years ago

0.9.1-next.97

2 years ago

0.9.1-next.96

2 years ago

0.9.0

2 years ago

0.9.1-next.118

2 years ago

0.9.1-next.116

2 years ago

0.9.1-next.114

2 years ago

0.9.1-next.113

2 years ago

0.9.1-next.21

2 years ago

0.9.1-next.120

2 years ago

0.8.1-next.190

2 years ago

0.8.1-next.192

2 years ago

0.8.1-next.194

2 years ago

0.8.1-next.146

3 years ago

0.8.1-next.154

3 years ago

0.8.1-next.156

3 years ago

0.8.1-next.157

3 years ago

0.8.1-next.158

3 years ago

0.8.1-next.114

3 years ago

0.8.1-next.159

3 years ago

0.8.1-next.117

3 years ago

0.8.1-next.119

3 years ago

0.8.1-next.161

3 years ago

0.8.1-next.162

3 years ago

0.8.1-next.163

3 years ago

0.8.1-next.164

3 years ago

0.8.1-next.120

3 years ago

0.8.1-next.165

3 years ago

0.8.1-next.121

3 years ago

0.8.1-next.166

3 years ago

0.8.1-next.122

3 years ago

0.8.1-next.167

3 years ago

0.8.1-next.123

3 years ago

0.8.1-next.168

3 years ago

0.8.1-next.169

3 years ago

0.8.1-next.179

2 years ago

0.8.1-next.84

3 years ago

0.8.1-next.26

3 years ago

0.8.1-next.42

3 years ago

0.8.1-next.66

3 years ago

0.8.1-next.50

3 years ago

0.8.1-next.57

3 years ago

0.8.1-next.31

3 years ago

0.8.1-next.77

3 years ago

0.8.1-next.55

3 years ago

0.8.1-next.18

3 years ago

0.8.1-next.12

3 years ago

0.8.1-unstable.9

3 years ago

0.8.1-next.6

3 years ago

0.8.1-unstable.5

3 years ago

0.8.1-unstable.4

3 years ago

0.8.1-next.3

3 years ago

0.8.1-next.2

3 years ago

0.8.0

3 years ago

0.7.1-next.68

3 years ago

0.7.1-next.66

3 years ago