npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sphereon/ssi-sdk-contact-manager

v0.11.0

Published

<!--suppress HtmlDeprecatedAttribute --> <h1 align="center"> <br> <a href="https://www.sphereon.com"><img src="https://sphereon.com/content/themes/sphereon/assets/img/logo.svg" alt="Sphereon" width="400"></a> <br>Contact Manager (Typescript) <br>

Downloads

3

Readme


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


A Veramo contact manager plugin. This plugin manages contacts and identity configurations to third parties and persists them. These configurations can then be used to establish a connection.

Supported identity connection types

For now the following connection types are supported:

  • OpenID Connect
  • Self Issued OpenID v2

Available functions

  • cmGetContact
  • cmGetContacts
  • cmAddContact
  • cmUpdateContact
  • cmRemoveContact
  • cmGetIdentity
  • cmGetIdentities
  • cmAddIdentity
  • cmUpdateIdentity
  • cmRemoveIdentity

Usage

Adding the plugin to an agent:

import { migrations, Entities } from '@veramo/data-store'
import DataStoreConnectionEntities from '@sphereon/ssi-sdk-contact-manager'
import { ContactStore, DataStoreMigrations } 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: [...DataStoreConnectionEntities, ...Entities],
})

const agent = createAgent<IContactManager>({
  plugins: [
    new ContactManager({
      store: new ContactStore(dbConnection),
    }),
  ],
})

Get a contact:

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

Get contacts:

const result = await agent.cmGetContacts()

Add a contact:

const result = await agent.cmAddContact({ name: 'contact_name', alias: 'contact_alias' })

Update a contact:

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

const result = await agent.cmUpdateContact({ contact })

Remove a contact:

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

Get an identity:

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

Get identities:

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

Add an identity:

const contactId = 'a4a47842-43a7-4741-9562-0fb3a973ec98'
const identity = {
  alias: correlationId,
  identifier: {
    type: CorrelationIdentifierEnum.URL,
    correlationId,
  },
  connection: {
    type: ConnectionTypeEnum.DIDAUTH,
    config: {
      identifier: {
        did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
        provider: 'test_provider',
        keys: [],
        services: [],
      },
      redirectUrl: 'https://example.com',
      stateId: 'e91f3510-5ce9-42ee-83b7-fa68ff323d27',
      sessionId: 'https://example.com/did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
    },
  },
  metadata: [
    {
      label: 'Authorization URL',
      value: 'https://example.com',
    },
    {
      label: 'Scope',
      value: 'Authorization',
    },
  ],
}

const result = await agent.cmAddIdentity({
  contactId,
  identity,
})

Update an identity:

const identityId = 'cdfd231c-6d40-4e43-9bd0-e8c97262ffe1'
const identity = await agent
  .cmGetIdentity({
    identityId,
  })
  .then((identity) => {
    return { ...identity, alias: 'new_alias' }
  })
const result = await agent.cmUpdateIdentity({ identity })

Remove an identity:

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

Installation

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

Build

yarn build