0.11.0 • Published 1 year ago

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

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year 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

1 year ago

0.10.1-next.13

1 year ago

0.10.0

1 year ago

0.10.2-next.11

1 year ago

0.11.0

1 year ago

0.10.1-next.6

1 year ago

0.10.1-next.9

1 year ago

0.10.1-next.8

1 year ago

0.10.1-next.2

1 year ago

0.9.1-next.121

1 year ago

0.9.1-next.42

1 year ago

0.9.1-next.109

1 year ago

0.9.1-next.107

1 year ago

0.9.1-next.105

1 year ago

0.9.1-next.103

1 year ago

0.9.1-next.100

1 year ago

0.9.1-next.56

1 year ago

0.9.1-next.55

1 year ago

0.9.1-next.9

1 year ago

0.9.1-next.69

1 year ago

0.9.1-next.62

1 year ago

0.9.1-next.89

1 year ago

0.8.1-next.272

1 year ago

0.9.1-next.17

1 year ago

0.9.1-next.16

1 year ago

0.9.1-next.15

1 year ago

0.9.1-next.13

1 year ago

0.9.1-next.12

1 year ago

0.9.1-next.99

1 year ago

0.9.1-next.11

1 year ago

0.9.1-next.10

1 year ago

0.9.1-next.97

1 year ago

0.9.1-next.96

1 year ago

0.9.0

1 year ago

0.9.1-next.118

1 year ago

0.9.1-next.116

1 year ago

0.9.1-next.114

1 year ago

0.9.1-next.113

1 year ago

0.9.1-next.21

1 year ago

0.9.1-next.120

1 year ago

0.8.1-next.190

1 year ago

0.8.1-next.192

1 year ago

0.8.1-next.194

1 year ago

0.8.1-next.146

1 year ago

0.8.1-next.154

1 year ago

0.8.1-next.156

1 year ago

0.8.1-next.157

1 year ago

0.8.1-next.158

1 year ago

0.8.1-next.114

1 year ago

0.8.1-next.159

1 year ago

0.8.1-next.117

1 year ago

0.8.1-next.119

1 year ago

0.8.1-next.161

1 year ago

0.8.1-next.162

1 year ago

0.8.1-next.163

1 year ago

0.8.1-next.164

1 year ago

0.8.1-next.120

1 year ago

0.8.1-next.165

1 year ago

0.8.1-next.121

1 year ago

0.8.1-next.166

1 year ago

0.8.1-next.122

1 year ago

0.8.1-next.167

1 year ago

0.8.1-next.123

1 year ago

0.8.1-next.168

1 year ago

0.8.1-next.169

1 year ago

0.8.1-next.179

1 year ago

0.8.1-next.84

2 years ago

0.8.1-next.26

2 years ago

0.8.1-next.42

2 years ago

0.8.1-next.66

2 years ago

0.8.1-next.50

2 years ago

0.8.1-next.57

2 years ago

0.8.1-next.31

2 years ago

0.8.1-next.77

2 years ago

0.8.1-next.55

2 years ago

0.8.1-next.18

2 years ago

0.8.1-next.12

2 years ago

0.8.1-unstable.9

2 years ago

0.8.1-next.6

2 years ago

0.8.1-unstable.5

2 years ago

0.8.1-unstable.4

2 years ago

0.8.1-next.3

2 years ago

0.8.1-next.2

2 years ago

0.8.0

2 years ago

0.7.1-next.68

2 years ago

0.7.1-next.66

2 years ago