0.9.0 • Published 1 year ago

@sphereon/ssi-sdk-connection-manager v0.9.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 Veramo connection manager plugin. This plugin manages connection configurations to third parties and persists them. These configurations can then be used to establish the connection.

Supported connection types

For now the following connection types are supported:

  • OpenID
  • DID AUTH SIOP

Available functions

  • cmGetParty
  • cmGetParties
  • cmAddParty
  • cmUpdateParty
  • cmRemoveParty
  • cmGetConnection
  • cmGetConnections
  • cmAddConnection
  • cmUpdateConnection
  • cmRemoveConnection

Usage

Adding the plugin to an agent:

import Entities from '@sphereon/ssi-sdk-connection-manager'
const dbConnection = createConnection({
    'type': 'react-native',
    'database': 'app.sqlite',
    'location': 'default',
    'logging': true,
    'synchronize': true,
    'entities': Entities
});

const agent = createAgent<IConnectionManager>({
  plugins: [
    new ConnectionManager({
      store: new TestConnectionStore(dbConnection)
    }),
  ],
})

Get a party:

const partyId = '8efb937f-4e90-4056-9a4d-7185ce8dc173'
const result = await agent.cmGetConnection({
  partyId,
})

Get parties:

const result = await agent.cmGetParties()

Add a party:

const result = await agent.cmAddParty({ name: 'Party' })

Update a party:

const partyId = '8efb937f-4e90-4056-9a4d-7185ce8dc173'
const party = await agent.cmGetConnection({
  partyId
}).then(party => {
  return {...party, name: 'new_name'}
})

const result = await agent.cmUpdateParty({ party })

Remove a party:

const partyId = 'ef6e13b2-a520-4bb6-9a13-9be529ce22b8'
const result = await agent.cmRemoveParty({ partyId })

Get a connection:

const connectionId = 'cdfd231c-6d40-4e43-9bd0-e8c97262ffe1'
const result = await agent.cmGetConnection({
  connectionId,
})

Get connections:

const partyId = '00492d95-22b9-41c1-b475-90bf1667ae52'
const result = await agent.cmGetConnections({ partyId })

Add a connection:

const partyId = 'a4a47842-43a7-4741-9562-0fb3a973ec98'
const connection: {
  type: ConnectionTypeEnum.OPENID,
  identifier: {
    type: ConnectionIdentifierEnum.URL,
    correlationId: 'https://example.com'
  },
  config: {
    clientId: '138d7bf8-c930-4c6e-b928-97d3a4928b01',
    clientSecret: '03b3955f-d020-4f2a-8a27-4e452d4e27a0',
    scopes: ['auth'],
    issuer: 'https://example.com/app-test',
    redirectUrl: 'app:/callback',
    dangerouslyAllowInsecureHttpRequests: true,
    clientAuthMethod: 'post'
  },
  metadata: [
    {
      label: 'Authorization URL',
      value: 'https://example.com'
    },
    {
      label: 'Scope',
      value: 'Authorization'
    }
  ]
}
const result = await agent.cmAddConnection({
  partyId,
  connection
})

Update a connection:

const connectionId = 'cdfd231c-6d40-4e43-9bd0-e8c97262ffe1'
const result = await agent.cmGetConnection({
  connectionId,
}).then(connection => {
  return {...connection, identifier: {...connection.identifier, correlationId: 'new_id'}}
})
const connection = await agent.cmUpdateConnection({ connection })

Remove a connection:

const connectionId = 'cdfd231c-6d40-4e43-9bd0-e8c97262ffe1'
await agent.cmRemoveConnection({
  connectionId,
})

Installation

yarn add @sphereon/ssi-sdk-connection-manager

Build

yarn build
0.9.1-next.42

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.11

1 year ago

0.9.1-next.10

1 year ago

0.9.1-next.21

1 year ago

0.9.1-next.9

1 year ago

0.8.1-next.272

1 year ago

0.9.0

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.114

1 year ago

0.8.1-next.117

1 year ago

0.8.1-next.119

1 year ago

0.8.1-next.120

1 year ago

0.8.1-next.121

1 year ago

0.8.1-next.122

1 year ago

0.8.1-next.123

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.159

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.165

1 year ago

0.8.1-next.166

1 year ago

0.8.1-next.167

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.26

2 years ago

0.8.1-next.31

2 years ago

0.8.1-next.42

2 years ago

0.8.1-next.50

2 years ago

0.8.1-next.57

2 years ago

0.8.1-next.55

2 years ago

0.8.1-next.66

2 years ago

0.8.1-next.77

2 years ago

0.8.1-next.84

2 years ago

0.8.1-unstable.9

2 years ago

0.8.1-unstable.5

2 years ago

0.8.1-unstable.4

2 years ago

0.7.1-next.66

2 years ago

0.7.1-next.68

2 years ago

0.8.1-next.3

2 years ago

0.8.1-next.6

2 years ago

0.8.1-next.2

2 years ago

0.7.1-next.54

2 years ago

0.8.1-next.12

2 years ago

0.8.1-next.18

2 years ago

0.8.0

2 years ago

0.7.1-next.43

2 years ago

0.7.1-next.40

2 years ago

0.7.1-next.38

2 years ago

0.5.2-next.73

2 years ago

0.6.1-next.6

2 years ago

0.6.1-next.8

2 years ago

0.6.1-next.9

2 years ago

0.7.1-unstable.9

2 years ago

0.7.1-next.39

2 years ago

0.6.1-next.50

2 years ago

0.7.0

2 years ago

0.6.1-next.66

2 years ago

0.6.1-next.67

2 years ago

0.7.1-next.18

2 years ago

0.5.2-next.113

2 years ago

0.6.1-next.76

2 years ago

0.6.1-next.79

2 years ago

0.5.2-next.116

2 years ago

0.6.1-next.78

2 years ago

0.6.0

2 years ago

0.5.2-next.70

2 years ago