0.34.0 • Published 4 months ago

@sphereon/ssi-sdk.siopv2-oid4vp-op-auth v0.34.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
4 months ago

Warning: This package still is in very early development. Breaking changes without notice will happen at this point!


A Veramo authentication plugin using the Self Issued OpenID Provider v2 (SIOP) authentication library for having clients / people conforming to the Self Issued OpenID Provider v2 (SIOPv2) and OpenID Connect for Verifiable Presentations (OIDC4VP) as specified in the OpenID Connect working group.

Self Issued OpenID Provider v2 (SIOP)

For more information about Self Issued OpenID Provider v2 (SIOP), see the documentation in the readme.

Requirements

For this plugin a DID resolver is also required. A DID resolver can be added to the agent as plugin as seen in the example below.

Available functions

  • getSessionForSiop
  • registerSessionForSiop
  • removeSessionForSiop
  • registerCustomApprovalForSiop
  • removeCustomApprovalForSiop
  • authenticateWithSiop
  • getSiopAuthorizationRequestFromRP
  • getSiopAuthorizationRequestDetails
  • verifySiopAuthorizationRequestURI
  • sendSiopAuthorizationResponse

The following functions can also be used on the session object without the need of a session id first.

  • authenticateWithSiop
  • getSiopAuthorizationRequestFromRP
  • getSiopAuthorizationRequestDetails
  • verifySiopAuthorizationRequestURI
  • sendSiopAuthorizationResponse

Usage

Adding the plugin to an agent:

import { IDidAuthSiopOpAuthenticator } from '@sphereon/ssi-sdk-did-auth-siop-authenticator'
import { Resolver } from 'did-resolver'
import { getDidKeyResolver } from '@veramo/did-provider-key'
import { DIDResolverPlugin } from '@veramo/did-resolver'
import { getUniResolver } from '@sphereon/did-uni-client'

const agent = createAgent<IDidAuthSiopOpAuthenticator & IResolver>({
  plugins: [
    new DidAuthSiopOpAuthenticator(),
    new DIDResolverPlugin({
      resolver: new Resolver({
        ...getDidKeyResolver(),
        ...getUniResolver('lto', { resolveUrl: 'https://uniresolver.test.sphereon.io/1.0/identifiers' }),
        ...getUniResolver('factom', { resolveUrl: 'https://uniresolver.test.sphereon.io/1.0/identifiers' }),
      }),
    }),
  ],
})

Get an OP session:

const sessionId = 'example_session_id'
const opSession = await agent.getSessionForSiop({
  sessionId,
})

Register an OP session:

const sessionId = 'example_session_id'
const identifier = {
  did: 'did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a',
  provider: 'example_provider',
  controllerKeyId: `did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller`,
  keys: [
    {
      kid: `did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller`,
      kms: 'example_kms',
      type: 'Ed25519' as const,
      publicKeyHex: '1e21e21e...',
      privateKeyHex: 'elfcvtswdbn...',
    },
  ],
  services: [],
}

const opSession = await agent.registerSessionForSiop({
  sessionId,
  identifier,
})

Remove an OP session:

const sessionId = 'example_session_id'
const opSession = await agent.removeSessionForSiop({
  sessionId,
})

Authenticate with DID auth SIOP:

It is possible to register custom approval functions as an extra confirmation before sending the authentication response. These functions can then be used as an optional parameter. It is also possible to directly provide a custom approval function.

These custom approval functions can also be provided at agent creation.

await agent.registerCustomApprovalForSiop({
  key: 'example_key',
  customApproval: (verifiedAuthorizationRequest: VerifiedAuthorizationRequest) => Promise.resolve(),
})
const sessionId = 'example_session_id'
const stateId = 'example_state_id'
const redirectUrl = 'https://example.com'
const customApprovalKey = 'example_key'
const authenticationResponse = await agent.authenticateWithSiop({
  sessionId,
  stateId,
  redirectUrl,
  customApproval: customApprovalKey,
})
const authenticationResponse = await agent.authenticateWithSiop({
  sessionId,
  stateId,
  redirectUrl,
  customApproval: (verifiedAuthorizationRequest: VerifiedAuthorizationRequest) => {
    return Promise.resolve()
  },
})

Get authorization request from the relying party:

For more detailed information see: Self Issued OpenID Provider v2 (SIOP)

const sessionId = 'example_session_id'
const stateId = 'example_state_id'
const redirectUrl = 'https://example.com'
const authorizationRequest = await agent.getSiopAuthorizationRequestFromRP({
  sessionId,
  stateId,
  redirectUrl,
})

Get authorization request details:

For more detailed information see: Self Issued OpenID Provider v2 (SIOP)

const sessionId = 'example_session_id'
const authorizationRequestDetailsResponse = await agent.getSiopAuthorizationRequestDetails({
  sessionId,
  verifiedAuthorizationRequest: createAuthorizationResponse,
})

Verify authorization request URI:

For more detailed information see: Self Issued OpenID Provider v2 (SIOP)

const sessionId = 'example_session_id'
const verifiedAuthorizationResponse = await agent.verifySiopAuthorizationRequestURI({
  sessionId,
  requestURI: createAuthorizationResponse,
})

Send authorization response:

For more detailed information see: Self Issued OpenID Provider v2 (SIOP)

const sessionId = 'example_session_id'
const authorizationResponse = await agent.sendSiopAuthorizationResponse({
  sessionId,
  verifiedAuthorizationRequest: verifiedAuthorizationResponse,
})

Installation

yarn add @sphereon/ssi-sdk-did-auth-siop-authenticator

Build

yarn build
0.30.2-next.394

10 months ago

0.30.2-next.395

10 months ago

0.30.2-fix.364

10 months ago

0.30.2-fix.363

10 months ago

0.30.2-fix.368

10 months ago

0.30.2-fix.367

10 months ago

0.30.2-next.373

10 months ago

0.31.1-fix.4

10 months ago

0.31.1-fix.5

10 months ago

0.33.0

6 months ago

0.30.2-next.148

11 months ago

0.30.2-next.145

11 months ago

0.31.1-next.4

10 months ago

0.30.2-next.390

10 months ago

0.31.0

10 months ago

0.30.2-next.191

11 months ago

0.30.2-fix.199

11 months ago

0.30.2-fix.198

11 months ago

0.30.2-next.328

10 months ago

0.30.2-next.329

10 months ago

0.32.1-next.291

6 months ago

0.32.1-next.287

6 months ago

0.30.2-fix.395

10 months ago

0.30.2-fix.393

10 months ago

0.30.2-next.365

10 months ago

0.30.2-next.367

10 months ago

0.30.2-next.362

10 months ago

0.30.2-next.363

10 months ago

0.30.2-fix.139

11 months ago

0.30.2-fix.140

11 months ago

0.31.1-fix.20

10 months ago

0.30.2-next.276

10 months ago

0.30.2-next.279

10 months ago

0.30.2-next.273

10 months ago

0.30.2-next.275

10 months ago

0.30.2-next.281

10 months ago

0.32.0

10 months ago

0.30.2-next.285

10 months ago

0.30.2-next.259

10 months ago

0.32.1-next.113

8 months ago

0.30.2-next.269

10 months ago

0.30.2-next.267

10 months ago

0.31.1-next.44

10 months ago

0.31.1-next.42

10 months ago

0.31.1-next.41

10 months ago

0.31.1-next.39

10 months ago

0.31.1-next.33

10 months ago

0.31.1-next.32

10 months ago

0.32.1-fix.160

8 months ago

0.31.1-next.30

10 months ago

0.32.1-next.161

8 months ago

0.33.1-next.3

5 months ago

0.33.1-next.2

5 months ago

0.31.1-next.62

10 months ago

0.32.1-next.54

8 months ago

0.32.1-next.157

8 months ago

0.31.1-next.60

10 months ago

0.32.1-next.150

8 months ago

0.32.1-next.141

8 months ago

0.32.1-next.145

8 months ago

0.33.1-next.73

4 months ago

0.32.1-fix.143

8 months ago

0.32.1-fix.142

8 months ago

0.33.1-next.68

4 months ago

0.30.2-next.200

11 months ago

0.31.1-next.29

10 months ago

0.31.1-next.26

10 months ago

0.31.1-next.28

10 months ago

0.31.1-next.21

10 months ago

0.31.1-next.24

10 months ago

0.31.1-next.23

10 months ago

0.31.1-next.19

10 months ago

0.31.1-next.14

10 months ago

0.31.1-next.17

10 months ago

0.31.1-next.13

10 months ago

0.34.0

4 months ago

0.30.2-fix.278

10 months ago

0.30.2-fix.270

10 months ago

0.30.2-fix.280

10 months ago

0.30.2-next.215

11 months ago

0.30.2-next.221

11 months ago

0.30.2-next.223

10 months ago

0.30.2-fix.266

10 months ago

0.30.2-fix.265

10 months ago

0.30.2-fix.263

10 months ago

0.30.2-fix.262

10 months ago

0.32.1-fix.15

9 months ago

0.32.1-next.13

10 months ago

0.32.1-next.17

9 months ago

0.32.1-next.18

9 months ago

0.32.1-next.12

10 months ago

0.32.1-next.20

8 months ago

0.30.2-fix.138

11 months ago

0.30.2-next.133

11 months ago

0.30.2-next.135

11 months ago

0.30.2-fix.136

11 months ago

0.30.2-next.129

11 months ago

0.30.2-next.125

11 months ago

0.30.2-next.103

11 months ago

0.30.2-fix.50

11 months ago

0.30.2-fix.48

11 months ago

0.30.2-fix.49

11 months ago

0.30.2-next.58

11 months ago

0.30.2-next.66

11 months ago

0.30.2-next.47

11 months ago

0.30.2-unstable.27

11 months ago

0.30.2-unstable.8

11 months ago

0.30.2-unstable.24

11 months ago

0.30.2-unstable.25

11 months ago

0.30.2-unstable.26

11 months ago

0.30.2-unstable.21

11 months ago

0.30.2-unstable.22

11 months ago

0.30.2-unstable.23

11 months ago

0.30.2-unstable.3

12 months ago

0.30.2-unstable.7

12 months ago

0.30.2-unstable.6

12 months ago

0.30.2-unstable.5

12 months ago

0.30.2-unstable.4

12 months ago

0.30.2-unstable.9

12 months ago

0.30.2-next.4

12 months ago

0.30.2-next.5

12 months ago

0.30.2-next.6

12 months ago

0.29.1-next.185

12 months ago

0.30.1

12 months ago

0.29.1-next.175

12 months ago

0.29.1-next.174

12 months ago

0.29.1-next.177

12 months ago

0.29.1-next.176

12 months ago

0.29.1-unstable.185

12 months ago

0.29.1-unstable.184

12 months ago

0.29.1-unstable.183

12 months ago

0.29.1-unstable.182

12 months ago

0.30.1-unstable.5

12 months ago

0.30.2-unstable.13

12 months ago

0.30.2-unstable.14

12 months ago

0.30.2-unstable.11

12 months ago

0.30.2-unstable.12

12 months ago

0.30.2-unstable.10

12 months ago

0.30.2-unstable.19

12 months ago

0.30.2-unstable.17

12 months ago

0.30.2-unstable.18

12 months ago

0.30.2-unstable.15

12 months ago

0.30.2-unstable.20

12 months ago

0.29.1-unstable.158

12 months ago

0.27.1-next.20

1 year ago

0.27.1-next.24

1 year ago

0.27.1-next.25

1 year ago

0.29.1-next.80

1 year ago

0.27.1-next.28

1 year ago

0.27.1-next.29

1 year ago

0.27.1-next.26

1 year ago

0.29.1-next.82

1 year ago

0.28.1-next.51

1 year ago

0.28.1-next.50

1 year ago

0.28.1-next.53

1 year ago

0.28.1-next.52

1 year ago

0.27.1-next.31

1 year ago

0.27.1-next.33

1 year ago

0.27.1-next.39

1 year ago

0.27.1-next.38

1 year ago

0.28.1-next.48

1 year ago

0.28.1-next.49

1 year ago

0.28.1-next.44

1 year ago

0.29.1-next.5

1 year ago

0.28.1-next.40

1 year ago

0.26.1-next.6

1 year ago

0.29.1-next.4

1 year ago

0.26.1-next.4

1 year ago

0.29.1-next.2

1 year ago

0.28.1-next.41

1 year ago

0.26.1-next.140

1 year ago

0.29.1-next.61

1 year ago

0.28.1-next.60

1 year ago

0.26.1-next.129

1 year ago

0.26.1-next.127

1 year ago

0.26.1-next.131

1 year ago

0.26.1-next.132

1 year ago

0.26.1-next.115

1 year ago

0.26.1-next.113

1 year ago

0.26.1-next.108

1 year ago

0.26.1-next.106

1 year ago

0.25.0

1 year ago

0.27.1-next.8

1 year ago

0.27.1-next.9

1 year ago

0.27.1-next.6

1 year ago

0.27.1-next.7

1 year ago

0.27.1-next.4

1 year ago

0.27.1-next.2

1 year ago

0.29.1-unstable.154

12 months ago

0.26.0

1 year ago

0.28.1-next.11

1 year ago

0.28.1-next.10

1 year ago

0.28.1-next.13

1 year ago

0.25.1-next.118

1 year ago

0.28.1-next.39

1 year ago

0.24.0

1 year ago

0.29.0

1 year ago

0.24.1-next.98

1 year ago

0.27.0

1 year ago

0.24.1-next.42

1 year ago

0.28.0

1 year ago

0.29.1-next.122

1 year ago

0.25.1-next.29

1 year ago

0.25.1-next.28

1 year ago

0.28.1-next.9

1 year ago

0.28.1-next.5

1 year ago

0.28.1-next.6

1 year ago

0.28.1-next.8

1 year ago

0.30.1-unstable.4

12 months ago

0.30.1-unstable.3

12 months ago

0.23.5-next.24

1 year ago

0.29.1-next.104

1 year ago

0.29.1-next.103

1 year ago

0.29.1-next.47

1 year ago

0.29.1-next.46

1 year ago

0.29.1-next.106

1 year ago

0.29.1-next.105

1 year ago

0.24.1-next.100

1 year ago

0.27.1-next.10

1 year ago

0.27.1-next.12

1 year ago

0.24.1-next.113

1 year ago

0.24.1-next.112

1 year ago

0.24.1-next.118

1 year ago

0.24.1-next.116

1 year ago

0.23.5-next.22

1 year ago

0.23.5-next.12

1 year ago

0.23.5-next.11

1 year ago

0.23.5-next.10

1 year ago

0.23.1-next.7

1 year ago

0.23.3-next.3

1 year ago

0.23.4

1 year ago

0.23.2

1 year ago

0.23.2-next.4

1 year ago

0.23.1-next.2

1 year ago

0.23.1

1 year ago

0.23.0

1 year ago

0.21.2-next.25

1 year ago

0.21.2-next.23

1 year ago

0.21.2-next.8

1 year ago

0.21.2-next.7

1 year ago

0.21.2-next.6

1 year ago

0.21.2-next.17

1 year ago

0.21.1

1 year ago

0.22.0

1 year ago

0.21.1-next.8

1 year ago

0.21.1-next.4

1 year ago

0.19.1-next.125

2 years ago

0.19.1-next.126

2 years ago

0.21.0

2 years ago

0.19.1-next.119

2 years ago

0.19.1-next.135

2 years ago

0.21.1-next.2

2 years ago

0.19.1-next.117

2 years ago

0.19.1-next.113

2 years ago

0.19.1-next.114

2 years ago

0.19.1-next.115

2 years ago

0.19.1-next.116

2 years ago

0.19.1-next.111

2 years ago

0.19.1-next.112

2 years ago

0.19.1-next.105

2 years ago

0.19.1-next.110

2 years ago

0.19.1-next.106

2 years ago

0.19.1-next.108

2 years ago

0.19.1-next.109

2 years ago

0.19.1-next.98

2 years ago

0.19.1-next.99

2 years ago

0.19.1-next.102

2 years ago

0.19.1-next.100

2 years ago

0.19.1-next.101

2 years ago

0.19.1-next.96

2 years ago

0.19.1-next.75

2 years ago

0.19.1-next.2

2 years ago

0.19.1-next.24

2 years ago

0.19.0

2 years ago

0.18.2-next.96

2 years ago

0.18.2-next.95

2 years ago

0.18.2-next.94

2 years ago

0.18.2-next.92

2 years ago

0.18.2-next.58

2 years ago

0.18.2-next.62

2 years ago

0.18.2-next.77

2 years ago

0.18.2-next.57

2 years ago

0.18.2-next.47

2 years ago

0.18.2-next.15

2 years ago

0.18.2-next.17

2 years ago

0.18.2-next.14

2 years ago

0.18.2-next.12

2 years ago

0.18.2-next.9

2 years ago

0.18.2-next.3

2 years ago

0.18.1

2 years ago

0.18.1-next.8

2 years ago

0.18.1-next.3

2 years ago

0.18.1-next.2

2 years ago

0.18.1-next.4

2 years ago

0.17.6-next.61

2 years ago

0.18.0

2 years ago

0.17.6-next.58

2 years ago

0.17.6-next.57

2 years ago

0.17.6-next.56

2 years ago

0.17.6-next.52

2 years ago

0.17.2

2 years ago

0.17.3

2 years ago

0.17.4

2 years ago

0.17.5

2 years ago

0.16.1-next.3

2 years ago

0.17.0

2 years ago

0.17.1

2 years ago

0.17.2-next.2

2 years ago

0.17.2-next.4

2 years ago

0.15.2-next.96

2 years ago

0.15.2-next.95

2 years ago

0.15.2-next.97

2 years ago

0.13.1-next.3

2 years ago

0.13.1-next.4

2 years ago

0.13.1-next.5

2 years ago

0.13.1-next.6

2 years ago

0.13.1-next.7

2 years ago

0.13.1-next.8

2 years ago

0.13.1-next.32

2 years ago

0.17.1-next.2

2 years ago

0.13.1-next.33

2 years ago

0.15.0

2 years ago

0.15.1

2 years ago

0.13.1-next.17

2 years ago

0.13.1-next.14

2 years ago

0.13.1-next.15

2 years ago

0.13.1-next.10

2 years ago

0.13.1-next.18

2 years ago

0.16.0

2 years ago

0.13.1-next.27

2 years ago

0.13.1-next.28

2 years ago

0.13.1-next.25

2 years ago

0.13.1-next.26

2 years ago

0.13.1-next.23

2 years ago

0.13.1-next.24

2 years ago

0.15.1-next.2

2 years ago

0.17.3-next.2

2 years ago

0.15.2-next.39

2 years ago

0.15.2-next.32

2 years ago

0.15.2-next.33

2 years ago

0.15.2-next.113

2 years ago

0.15.2-next.110

2 years ago

0.15.2-next.111

2 years ago

0.17.6-next.7

2 years ago

0.17.6-next.6

2 years ago

0.17.6-next.9

2 years ago

0.17.6-next.3

2 years ago

0.17.6-next.2

2 years ago

0.17.6-next.5

2 years ago

0.17.6-next.4

2 years ago

0.14.2-next.28

2 years ago

0.14.2-next.27

2 years ago

0.14.2-next.29

2 years ago

0.14.2-next.23

2 years ago

0.15.2-next.103

2 years ago

0.14.2-next.26

2 years ago

0.15.2-next.104

2 years ago

0.14.2-next.25

2 years ago

0.14.0

2 years ago

0.15.2-next.109

2 years ago

0.14.1

2 years ago

0.15.2-next.124

2 years ago

0.15.2-next.121

2 years ago

0.15.2-next.29

2 years ago

0.14.2-next.18

2 years ago

0.15.2-next.116

2 years ago

0.15.2-next.117

2 years ago

0.15.2-next.114

2 years ago

0.14.2-next.14

2 years ago

0.15.2-next.118

2 years ago

0.14.2-next.40

2 years ago

0.15.2-next.4

2 years ago

0.15.2-next.5

2 years ago

0.15.2-next.6

2 years ago

0.14.2-next.49

2 years ago

0.14.2-next.45

2 years ago

0.14.2-next.48

2 years ago

0.14.2-next.47

2 years ago

0.15.2-next.77

2 years ago

0.14.2-next.43

2 years ago

0.15.2-next.101

2 years ago

0.14.2-next.39

2 years ago

0.14.2-next.38

2 years ago

0.14.1-next.2

2 years ago

0.14.2-next.35

2 years ago

0.14.2-next.34

2 years ago

0.14.2-next.37

2 years ago

0.14.2-next.36

2 years ago

0.14.2-next.31

2 years ago

0.14.2-next.30

2 years ago

0.14.2-next.33

2 years ago

0.14.2-next.32

2 years ago

0.14.2-next.51

2 years ago

0.14.2-next.50

2 years ago

0.17.6-next.16

2 years ago

0.15.2-next.3

2 years ago

0.14.2-next.58

2 years ago

0.13.0

2 years ago

0.12.1-next.21

2 years ago

0.12.1-next.20

2 years ago

0.12.1-next.19

2 years ago

0.12.0

2 years ago

0.11.1-next.154

2 years ago

0.11.1-next.153

2 years ago

0.11.1-next.152

2 years ago

0.11.1-next.162

2 years ago

0.11.1-next.151

2 years ago

0.11.1-next.150

2 years ago

0.11.1-next.149

2 years ago

0.11.1-next.148

2 years ago

0.11.1-next.147

2 years ago

0.11.1-next.146

2 years ago

0.11.1-next.145

2 years ago

0.11.1-next.144

2 years ago

0.11.1-next.142

2 years ago

0.11.1-next.141

2 years ago

0.11.1-next.140

2 years ago

0.11.1-next.131

2 years ago

0.11.1-next.112

2 years ago

0.11.1-next.106

2 years ago

0.11.1-next.72

2 years ago

0.11.1-next.70

2 years ago

0.11.1-next.65

2 years ago