Wondering what’s next for npm?Check out our public roadmap! »

@affinidi/affinity-metrics-lib
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Affinidi Metrics Client

For security reasons we hash a link before sending it over the network. In a most cases link should be any relevant id that could help with a tracking. :caution: Strongly avoid passing any ppi or sensitive data in a subcategory fields.

Usage

import { metrics, EventName, EventCategory, EventComponent} from '@affinidi/affinity-metrics-lib'

const event = {
  link:        'any_relevant_unique_id_will_be_hashed',
  name:        EventName.DID_CREATED,
  category:    EventCategory.DID,
  subCategory: 'registry',
  component:   EventComponent.AffinidiRegistry,
}

metrics.send(event, apiKeyHash, metricsUrl)

Parameters

EventName, EventComponent, and EventCategory are predefined library level enums, in case you need to add a new component or category do it via PR. Try to keep the category as generic as possible.

Setup Integration Tests

Test API key hash should be added to the top level .env file. Reach out to a team member for instructions on how to set up this file, or to obtain a copy.

Events

Metrics Event Description (When Does It Happen) Note
USER_ONBOARDED A developer has signed up for an API key. https://affinity-onboarding-frontend.dev.affinity-project.org/
DID_CREATED A DID has been created.
DID_UPDATED A DID has been updated.
VC_VERIFIED A VC has been verified. VC holder as the link.
VC_VERIFIED_PER_PARTY A VC has been verified. VC verifier as the link.
VC_SAVED A VC has been stored in a wallet. VC ID as the link and issuer ID as the secondary link.
VC_SIGNED A VC has been signed. VC holder as the link.
VC_REVOKED A VC has been revoked. Issuer DID as the link.
VP_VERIFIED A VP has been verified. VP holder as the link.
VP_SIGNED A VP has been signed. VP holder as the link and VP ID as the secondary link.
VP_VERIFIED_JWT A VP has been verified in JWT format. VP holder as the link.
VP_SIGNED_JWT A VP has been signed in JWT format. VP holder as the link and VP ID as the secondary link.

Install

npm i @affinidi/affinity-metrics-lib

DownloadsWeekly Downloads

1,148

Version

0.1.0

License

ISC

Unpacked Size

36.4 kB

Total Files

29

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar