0.30.1 • Published 7 months ago

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

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
7 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-fix.138

7 months ago

0.30.2-next.133

7 months ago

0.30.2-next.135

7 months ago

0.30.2-fix.136

7 months ago

0.30.2-next.129

7 months ago

0.30.2-next.125

7 months ago

0.30.2-next.103

7 months ago

0.30.2-fix.50

7 months ago

0.30.2-fix.48

7 months ago

0.30.2-fix.49

7 months ago

0.30.2-next.58

7 months ago

0.30.2-next.66

7 months ago

0.30.2-next.47

7 months ago

0.30.2-unstable.27

7 months ago

0.30.2-unstable.8

7 months ago

0.30.2-unstable.24

7 months ago

0.30.2-unstable.25

7 months ago

0.30.2-unstable.26

7 months ago

0.30.2-unstable.21

7 months ago

0.30.2-unstable.22

8 months ago

0.30.2-unstable.23

8 months ago

0.30.2-unstable.3

8 months ago

0.30.2-unstable.7

8 months ago

0.30.2-unstable.6

8 months ago

0.30.2-unstable.5

8 months ago

0.30.2-unstable.4

8 months ago

0.30.2-unstable.9

8 months ago

0.30.2-next.4

8 months ago

0.30.2-next.5

8 months ago

0.30.2-next.6

8 months ago

0.29.1-next.185

8 months ago

0.30.1

8 months ago

0.29.1-next.175

8 months ago

0.29.1-next.174

8 months ago

0.29.1-next.177

8 months ago

0.29.1-next.176

8 months ago

0.30.1-unstable.5

8 months ago

0.30.2-unstable.13

8 months ago

0.30.2-unstable.14

8 months ago

0.30.2-unstable.11

8 months ago

0.30.2-unstable.12

8 months ago

0.30.2-unstable.10

8 months ago

0.30.2-unstable.19

8 months ago

0.30.2-unstable.17

8 months ago

0.30.2-unstable.18

8 months ago

0.30.2-unstable.15

8 months ago

0.30.2-unstable.20

8 months ago

0.27.1-next.20

11 months ago

0.27.1-next.24

11 months ago

0.27.1-next.25

11 months ago

0.29.1-next.80

10 months ago

0.27.1-next.28

11 months ago

0.27.1-next.29

11 months ago

0.27.1-next.26

11 months ago

0.29.1-unstable.102

10 months ago

0.29.1-unstable.101

10 months ago

0.29.1-unstable.100

10 months ago

0.29.1-next.82

10 months ago

0.28.1-next.51

10 months ago

0.28.1-next.50

10 months ago

0.28.1-next.53

10 months ago

0.28.1-next.52

10 months ago

0.27.1-next.31

11 months ago

0.27.1-next.33

10 months ago

0.27.1-next.39

10 months ago

0.27.1-next.38

10 months ago

0.28.1-next.48

10 months ago

0.28.1-next.49

10 months ago

0.28.1-next.44

10 months ago

0.29.1-next.5

10 months ago

0.28.1-next.40

10 months ago

0.26.1-next.6

11 months ago

0.29.1-next.4

10 months ago

0.26.1-next.4

12 months ago

0.29.1-next.2

10 months ago

0.28.1-next.41

10 months ago

0.24.1-unstable.177

12 months ago

0.24.1-unstable.178

12 months ago

0.26.1-next.140

11 months ago

0.29.1-next.61

10 months ago

0.26.1-unstable.7

11 months ago

0.26.1-unstable.6

12 months ago

0.26.1-unstable.9

11 months ago

0.26.1-unstable.8

11 months ago

0.28.1-next.60

10 months ago

0.26.1-next.129

11 months ago

0.26.1-next.127

11 months ago

0.26.1-next.131

11 months ago

0.26.1-next.132

11 months ago

0.24.1-unstable.191

12 months ago

0.26.1-next.115

11 months ago

0.26.1-next.113

11 months ago

0.26.1-next.108

11 months ago

0.26.1-next.106

11 months ago

0.26.1-unstable.33

11 months ago

0.26.1-unstable.32

11 months ago

0.26.1-unstable.30

11 months ago

0.23.5-unstable.68

12 months ago

0.23.5-unstable.67

12 months ago

0.25.1-unstable.41

12 months ago

0.25.1-unstable.42

12 months ago

0.25.1-unstable.40

12 months ago

0.24.1-unstable.51

12 months ago

0.24.1-unstable.49

12 months ago

0.24.1-unstable.45

12 months ago

0.24.1-unstable.44

12 months ago

0.26.1-unstable.29

11 months ago

0.24.1-unstable.47

12 months ago

0.26.1-unstable.28

11 months ago

0.24.1-unstable.46

12 months ago

0.26.1-unstable.27

11 months ago

0.23.5-unstable.71

12 months ago

0.23.5-unstable.70

12 months ago

0.23.5-unstable.73

12 months ago

0.26.1-unstable.20

12 months ago

0.23.5-unstable.79

12 months ago

0.25.0

12 months ago

0.23.5-unstable.75

12 months ago

0.23.5-unstable.74

12 months ago

0.24.1-unstable.41

12 months ago

0.24.1-unstable.40

12 months ago

0.27.1-unstable.11

11 months ago

0.27.1-unstable.10

11 months ago

0.27.1-next.8

11 months ago

0.27.1-next.9

11 months ago

0.27.1-unstable.15

11 months ago

0.27.1-next.6

11 months ago

0.27.1-unstable.14

11 months ago

0.27.1-next.7

11 months ago

0.27.1-unstable.13

11 months ago

0.27.1-next.4

11 months ago

0.27.1-unstable.12

11 months ago

0.27.1-unstable.19

11 months ago

0.27.1-unstable.18

11 months ago

0.27.1-unstable.16

11 months ago

0.27.1-unstable.4

11 months ago

0.27.1-unstable.5

11 months ago

0.27.1-unstable.6

11 months ago

0.27.1-unstable.7

11 months ago

0.27.1-unstable.8

11 months ago

0.27.1-unstable.9

11 months ago

0.27.1-next.2

11 months ago

0.23.5-unstable.59

12 months ago

0.26.0

12 months ago

0.23.5-unstable.58

12 months ago

0.28.1-next.11

10 months ago

0.28.1-next.10

10 months ago

0.28.1-next.13

10 months ago

0.24.1-unstable.97

12 months ago

0.25.1-next.118

12 months ago

0.30.0-unstable.0

9 months ago

0.26.1-unstable.15

11 months ago

0.26.1-unstable.14

11 months ago

0.26.1-unstable.12

11 months ago

0.25.1-unstable.27

12 months ago

0.26.1-unstable.11

11 months ago

0.25.1-unstable.26

12 months ago

0.24.1-unstable.9

12 months ago

0.28.1-next.39

10 months ago

0.24.1-unstable.7

12 months ago

0.25.1-unstable.39

12 months ago

0.25.1-unstable.36

12 months ago

0.25.1-unstable.30

12 months ago

0.24.0

12 months ago

0.29.1-unstable.90

10 months ago

0.29.1-unstable.91

10 months ago

0.29.1-unstable.92

10 months ago

0.26.1-unstable.126

11 months ago

0.29.1-unstable.93

10 months ago

0.29.1-unstable.99

10 months ago

0.29.1-unstable.94

10 months ago

0.29.1-unstable.96

10 months ago

0.29.1-unstable.97

10 months ago

0.29.1-unstable.81

10 months ago

0.29.0

10 months ago

0.29.1-unstable.87

10 months ago

0.29.1-unstable.88

10 months ago

0.29.1-unstable.89

10 months ago

0.29.1-unstable.85

10 months ago

0.29.1-unstable.86

10 months ago

0.23.5-unstable.132

12 months ago

0.23.5-unstable.131

12 months ago

0.23.5-unstable.130

12 months ago

0.23.5-unstable.129

12 months ago

0.23.5-unstable.126

12 months ago

0.26.1-unstable.135

11 months ago

0.26.1-unstable.134

11 months ago

0.26.1-unstable.136

11 months ago

0.24.1-next.98

12 months ago

0.25.1-unstable.89

12 months ago

0.25.1-unstable.87

12 months ago

0.26.1-unstable.69

11 months ago

0.25.1-unstable.98

12 months ago

0.27.1-unstable.60

10 months ago

0.25.1-unstable.92

12 months ago

0.25.1-unstable.93

12 months ago

0.27.0

11 months ago

0.25.1-unstable.90

12 months ago

0.25.1-unstable.96

12 months ago

0.25.1-unstable.97

12 months ago

0.25.1-unstable.95

12 months ago

0.26.1-unstable.99

11 months ago

0.26.1-unstable.98

11 months ago

0.26.1-unstable.97

11 months ago

0.24.1-next.42

12 months ago

0.26.1-unstable.96

11 months ago

0.26.1-unstable.95

11 months ago

0.26.1-unstable.94

11 months ago

0.26.1-unstable.93

11 months ago

0.26.1-unstable.92

11 months ago

0.26.1-unstable.88

11 months ago

0.28.0

10 months ago

0.27.1-unstable.43

11 months ago

0.27.1-unstable.41

11 months ago

0.24.1-unstable.115

12 months ago

0.24.1-unstable.114

12 months ago

0.24.1-unstable.117

12 months ago

0.24.1-unstable.116

12 months ago

0.24.1-unstable.111

12 months ago

0.24.1-unstable.110

12 months ago

0.24.1-unstable.113

12 months ago

0.24.1-unstable.112

12 months ago

0.24.1-unstable.119

12 months ago

0.24.1-unstable.118

12 months ago

0.24.1-unstable.120

12 months ago

0.24.1-unstable.126

12 months ago

0.24.1-unstable.125

12 months ago

0.24.1-unstable.128

12 months ago

0.24.1-unstable.127

12 months ago

0.24.1-unstable.122

12 months ago

0.24.1-unstable.121

12 months ago

0.24.1-unstable.124

12 months ago

0.24.1-unstable.123

12 months ago

0.24.1-unstable.129

12 months ago

0.28.1-unstable.38

10 months ago

0.24.1-unstable.131

11 months ago

0.28.1-unstable.32

10 months ago

0.29.1-next.122

9 months ago

0.25.1-next.29

11 months ago

0.25.1-next.28

12 months ago

0.28.1-unstable.43

10 months ago

0.28.1-next.9

10 months ago

0.28.1-next.5

10 months ago

0.28.1-next.6

10 months ago

0.28.1-next.8

10 months ago

0.24.1-unstable.109

12 months ago

0.30.1-unstable.0

9 months ago

0.30.1-unstable.2

9 months ago

0.30.1-unstable.1

9 months ago

0.30.1-unstable.4

8 months ago

0.28.1-unstable.55

10 months ago

0.30.1-unstable.3

8 months ago

0.28.1-unstable.56

10 months ago

0.28.1-unstable.57

10 months ago

0.28.1-unstable.58

10 months ago

0.23.5-next.24

12 months ago

0.29.1-next.104

9 months ago

0.29.1-next.103

9 months ago

0.29.1-next.47

10 months ago

0.29.1-next.46

10 months ago

0.25.1-unstable.118

12 months ago

0.29.1-unstable.54

10 months ago

0.29.1-unstable.50

10 months ago

0.29.1-unstable.51

10 months ago

0.29.1-unstable.52

10 months ago

0.29.1-unstable.53

10 months ago

0.24.1-unstable.167

12 months ago

0.25.1-unstable.100

12 months ago

0.29.1-unstable.48

10 months ago

0.25.1-unstable.106

12 months ago

0.29.1-unstable.49

10 months ago

0.29.1-next.106

9 months ago

0.29.1-unstable.43

10 months ago

0.28.1-unstable.73

10 months ago

0.29.1-next.105

9 months ago

0.29.1-unstable.44

10 months ago

0.24.1-unstable.172

12 months ago

0.29.1-unstable.45

10 months ago

0.24.1-unstable.175

12 months ago

0.24.1-unstable.171

12 months ago

0.26.1-unstable.101

11 months ago

0.26.1-unstable.104

11 months ago

0.26.1-unstable.106

11 months ago

0.26.1-unstable.105

11 months ago

0.24.1-unstable.132

11 months ago

0.26.1-unstable.109

11 months ago

0.24.1-next.100

12 months ago

0.29.1-unstable.79

10 months ago

0.29.1-unstable.72

10 months ago

0.29.1-unstable.73

10 months ago

0.28.1-unstable.89

10 months ago

0.29.1-unstable.74

10 months ago

0.29.1-unstable.75

10 months ago

0.27.1-next.10

11 months ago

0.29.1-unstable.60

10 months ago

0.27.1-next.12

11 months ago

0.24.1-next.113

12 months ago

0.24.1-next.112

12 months ago

0.24.1-next.118

12 months ago

0.24.1-next.116

12 months ago

0.29.1-unstable.62

10 months 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.3-next.3

1 year ago

0.23.4

1 year ago

0.23.2-next.4

1 year ago

0.23.1-next.7

1 year ago

0.23.1

1 year ago

0.23.0

1 year ago

0.21.2-next.25

1 year ago

0.23.1-next.2

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.21.1-next.8

1 year ago

0.21.1-next.4

1 year ago

0.22.0

1 year ago

0.19.1-next.125

1 year ago

0.19.1-next.126

1 year ago

0.21.0

1 year ago

0.21.1-next.2

1 year ago

0.19.1-next.119

1 year ago

0.19.1-next.135

1 year ago

0.19.1-next.117

1 year ago

0.19.1-next.113

1 year ago

0.19.1-next.114

1 year ago

0.19.1-next.115

1 year ago

0.19.1-next.116

1 year ago

0.19.1-next.111

1 year ago

0.19.1-next.112

1 year ago

0.19.1-next.105

1 year ago

0.19.1-next.110

1 year ago

0.19.1-next.106

1 year ago

0.19.1-next.108

1 year ago

0.19.1-next.109

1 year ago

0.19.1-next.102

1 year ago

0.19.1-next.100

1 year ago

0.19.1-next.101

1 year ago

0.19.1-next.98

1 year ago

0.19.1-next.99

1 year ago

0.19.1-next.96

1 year ago

0.19.1-next.75

1 year ago

0.19.1-next.24

1 year ago

0.19.1-next.2

1 year ago

0.18.2-next.96

1 year ago

0.19.0

1 year ago

0.18.2-next.95

1 year ago

0.18.2-next.94

1 year ago

0.18.2-next.92

1 year ago

0.18.2-next.77

1 year ago