0.34.0 • Published 6 months ago

@sphereon/ssi-sdk.oid4vci-holder v0.34.0

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

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


A Veramo event logger plugin. This plugin allows for listening to events and to persist them into a database. There are also functions that can be manually called to persist events. Current, only audit events are supported that can be used to create an audit log.

Ideally this plugin should be used in combination with the event logger from our core package. This event logger will also default debug the events. This is mainly as a fallback for when no listener is present within the agent.

Available functions

  • loggerGetAuditEvents
  • loggerStoreAuditEvent

Usage

Adding the plugin to an agent:

import { migrations, Entities } from '@veramo/data-store'
import { EventLogger, IEventLogger } from '@sphereon/ssi-sdk.event-logger'
import { EventLoggerStore, DataStoreMigrations, DataStoreEventLoggerEntities, LoggingEventType } from '@sphereon/ssi-sdk.data-store'

const dbConnection = createConnection({
  type: 'react-native',
  database: 'app.sqlite',
  location: 'default',
  logging: false,
  synchronize: false,
  migrationsRun: true,
  migrations: [...DataStoreMigrations, ...migrations],
  entities: [...DataStoreEventLoggerEntities, ...Entities],
})

const agent = createAgent<IEventLogger>({
  plugins: [
    new EventLogger({
      eventTypes: [LoggingEventType.AUDIT],
      store: new EventLoggerStore(dbConnection),
    }),
  ],
})

Log event using event listener:

import {
  EventLogger,
  EventLoggerBuilder,
  LoggingEventType,
  LogLevel,
  System,
  SubSystem,
  ActionType,
  InitiatorType,
  SystemCorrelationIdType,
  PartyCorrelationType,
} from '@sphereon/ssi-sdk.core'

const agentContext = { agent }
const logger: EventLogger = new EventLoggerBuilder().withContext(agentContext).withNamespace('custom_namespace').build()

await logger.logEvent({
  type: LoggingEventType.AUDIT,
  data: {
    level: LogLevel.DEBUG,
    correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
    system: System.GENERAL,
    subSystemType: SubSystem.DID_PROVIDER,
    actionType: ActionType.CREATE,
    actionSubType: 'Key generation',
    initiatorType: InitiatorType.EXTERNAL,
    systemCorrelationIdType: SystemCorrelationIdType.DID,
    systemCorrelationId: 'did:example:123456789abcdefghi',
    systemAlias: 'test_alias',
    partyCorrelationType: PartyCorrelationType.DID,
    partyCorrelationId: 'did:example:123456789abcdefghi',
    partyAlias: 'test_alias',
    description: 'test_description',
    data: 'test_data_string',
    diagnosticData: { data: 'test_data_string' },
  },
})

Log event manually:

import {
  AuditLoggingEvent,
  LogLevel,
  System,
  SubSystem,
  ActionType,
  InitiatorType,
  SystemCorrelationIdType,
  PartyCorrelationType,
} from '@sphereon/ssi-sdk.core'
import { GetAuditEventsArgs, NonPersistedAuditLoggingEvent } from '@sphereon/ssi-sdk.event-logger'

const auditEvent: NonPersistedAuditLoggingEvent = {
  level: LogLevel.DEBUG,
  correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
  system: System.GENERAL,
  subSystemType: SubSystem.DID_PROVIDER,
  actionType: ActionType.CREATE,
  actionSubType: 'Key generation',
  initiatorType: InitiatorType.EXTERNAL,
  systemCorrelationIdType: SystemCorrelationIdType.DID,
  systemCorrelationId: 'did:example:123456789abcdefghi',
  systemAlias: 'test_alias',
  partyCorrelationType: PartyCorrelationType.DID,
  partyCorrelationId: 'did:example:123456789abcdefghi',
  partyAlias: 'test_alias',
  description: 'test_description',
  data: 'test_data_string',
  diagnosticData: { data: 'test_data_string' },
}

const result: AuditLoggingEvent = await agent.loggerLogAuditEvent({ event: auditEvent })

Retrieve audit events:

import {
  AuditLoggingEvent,
  LogLevel,
  System,
  SubSystem,
  ActionType,
  InitiatorType,
  SystemCorrelationIdType,
  PartyCorrelationType,
} from '@sphereon/ssi-sdk.core'
import { GetAuditEventsArgs, NonPersistedAuditLoggingEvent } from '@sphereon/ssi-sdk.event-logger'

const auditEvent: NonPersistedAuditLoggingEvent = {
  level: LogLevel.DEBUG,
  correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
  system: System.GENERAL,
  subSystemType: SubSystem.DID_PROVIDER,
  actionType: ActionType.CREATE,
  actionSubType: 'Key generation',
  initiatorType: InitiatorType.EXTERNAL,
  systemCorrelationIdType: SystemCorrelationIdType.DID,
  systemCorrelationId: 'did:example:123456789abcdefghi',
  systemAlias: 'test_alias',
  partyCorrelationType: PartyCorrelationType.DID,
  partyCorrelationId: 'did:example:123456789abcdefghi',
  partyAlias: 'test_alias',
  description: 'test_description',
  data: 'test_data_string',
  diagnosticData: { data: 'test_data_string' },
}

await agent.loggerLogAuditEvent({ event: auditEvent })
const getAuditEventArgs: GetAuditEventsArgs = {
  filter: [{ correlationId: auditEvent.correlationId }],
}
const result: Array<AuditLoggingEvent> = await agent.loggerGetAuditEvents(getAuditEventArgs)

Installation

yarn add @sphereon/ssi-sdk.event-logger

Build

yarn build
0.30.2-next.394

1 year ago

0.30.2-next.395

1 year ago

0.30.2-fix.364

1 year ago

0.30.2-fix.363

1 year ago

0.30.2-fix.368

1 year ago

0.30.2-fix.367

1 year ago

0.30.2-next.373

1 year ago

0.31.1-fix.4

1 year ago

0.31.1-fix.5

1 year ago

0.33.0

9 months ago

0.30.2-next.148

1 year ago

0.30.2-next.145

1 year ago

0.31.1-next.4

1 year ago

0.30.2-next.390

1 year ago

0.31.0

1 year ago

0.30.2-next.191

1 year ago

0.30.2-fix.199

1 year ago

0.30.2-fix.198

1 year ago

0.30.2-next.328

1 year ago

0.30.2-next.329

1 year ago

0.32.1-next.291

9 months ago

0.32.1-next.287

9 months ago

0.30.2-fix.395

1 year ago

0.30.2-fix.393

1 year ago

0.30.2-next.365

1 year ago

0.30.2-next.367

1 year ago

0.30.2-next.362

1 year ago

0.30.2-next.363

1 year ago

0.30.2-fix.139

1 year ago

0.30.2-fix.140

1 year ago

0.31.1-fix.20

12 months ago

0.30.2-next.276

1 year ago

0.30.2-next.279

1 year ago

0.30.2-next.273

1 year ago

0.30.2-next.275

1 year ago

0.30.2-next.281

1 year ago

0.32.0

12 months ago

0.30.2-next.285

1 year ago

0.30.2-next.259

1 year ago

0.32.1-next.113

10 months ago

0.30.2-next.269

1 year ago

0.30.2-next.267

1 year ago

0.31.1-next.44

12 months ago

0.31.1-next.42

12 months ago

0.31.1-next.41

12 months ago

0.31.1-next.39

12 months ago

0.31.1-next.33

12 months ago

0.31.1-next.32

12 months ago

0.32.1-fix.160

10 months ago

0.31.1-next.30

12 months ago

0.32.1-next.161

10 months ago

0.33.1-next.3

7 months ago

0.33.1-next.2

7 months ago

0.31.1-next.62

12 months ago

0.32.1-next.54

10 months ago

0.32.1-next.157

10 months ago

0.31.1-next.60

12 months ago

0.32.1-next.150

10 months ago

0.32.1-next.141

10 months ago

0.32.1-next.145

10 months ago

0.33.1-next.73

6 months ago

0.32.1-fix.143

10 months ago

0.32.1-fix.142

10 months ago

0.33.1-next.68

7 months ago

0.30.2-next.200

1 year ago

0.31.1-next.29

12 months ago

0.31.1-next.26

12 months ago

0.31.1-next.28

12 months ago

0.31.1-next.21

12 months ago

0.31.1-next.24

12 months ago

0.31.1-next.23

12 months ago

0.31.1-next.19

12 months ago

0.31.1-next.14

1 year ago

0.31.1-next.17

12 months ago

0.31.1-next.13

1 year ago

0.34.0

6 months ago

0.30.2-fix.278

1 year ago

0.30.2-fix.270

1 year ago

0.30.2-fix.280

1 year ago

0.30.2-next.215

1 year ago

0.30.2-next.221

1 year ago

0.30.2-next.223

1 year ago

0.30.2-fix.266

1 year ago

0.30.2-fix.265

1 year ago

0.30.2-fix.263

1 year ago

0.30.2-fix.262

1 year ago

0.32.1-fix.15

12 months ago

0.32.1-next.13

12 months ago

0.32.1-next.17

12 months ago

0.32.1-next.18

11 months ago

0.32.1-next.12

12 months ago

0.32.1-next.20

11 months ago

0.30.2-fix.138

1 year ago

0.30.2-next.133

1 year ago

0.30.2-next.135

1 year ago

0.30.2-fix.136

1 year ago

0.30.2-next.129

1 year ago

0.30.2-next.125

1 year ago

0.30.2-next.103

1 year ago

0.30.2-fix.50

1 year ago

0.30.2-fix.48

1 year ago

0.30.2-fix.49

1 year ago

0.30.2-next.58

1 year ago

0.30.2-next.66

1 year ago

0.30.2-next.47

1 year ago

0.30.2-next.4

1 year ago

0.30.2-next.5

1 year ago

0.30.2-next.6

1 year ago

0.29.1-next.185

1 year ago

0.30.1

1 year ago

0.29.1-next.175

1 year ago

0.29.1-next.174

1 year ago

0.29.1-next.177

1 year ago

0.29.1-next.176

1 year 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.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.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

2 years ago

0.23.5-next.12

2 years ago

0.23.5-next.11

2 years ago

0.23.5-next.10

2 years ago

0.23.3-next.3

2 years ago

0.23.4

2 years ago

0.23.2-next.4

2 years ago

0.23.1-next.7

2 years ago

0.23.1

2 years ago

0.23.0

2 years ago

0.21.2-next.25

2 years ago

0.23.1-next.2

2 years ago

0.21.2-next.23

2 years ago

0.21.2-next.8

2 years ago

0.21.2-next.7

2 years ago

0.21.2-next.6

2 years ago

0.21.2-next.17

2 years ago

0.21.1

2 years ago

0.21.1-next.8

2 years ago

0.21.1-next.4

2 years ago

0.22.0

2 years ago

0.19.1-next.125

2 years ago

0.19.1-next.126

2 years ago

0.21.0

2 years ago

0.21.1-next.2

2 years ago

0.19.1-next.119

2 years ago

0.19.1-next.135

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

2 years ago

0.19.1-next.100

2 years ago

0.19.1-next.101

2 years ago

0.19.1-next.98

2 years ago

0.19.1-next.99

2 years ago

0.19.1-next.96

2 years ago

0.19.1-next.75

2 years ago

0.19.1-next.24

2 years ago

0.19.1-next.2

2 years ago

0.18.2-next.96

2 years ago

0.19.0

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

2 years ago