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

@ula-aca/wallet

v0.0.2

Published

Universal Ledger Agent plugin for managing the wallet in Aries Cloudagent

Downloads

12

Readme

Universal Ledger Agent - Aries Cloudagent Wallet Plugin

npm (scoped)

This package handles everything that has to do with the wallet in Hyperledger Aries.

Usage

WalletController

import { EventHandler } from 'universal-ledger-agent'
import { WalletController } from '@ula-aca/wallet'

const walletController = new WalletController({
  basePath: 'https://aca-py-api.com'
})

const eventHandler = new EventHandler([walletController])

@ula-aca/wallet/get-dids

List wallet DIDs

import { EventHandler, UlaResponse } from 'universal-ledger-agent'
import {
  WalletController,
  GetDidsMessage,
  GetDidsResult,
  WalletMessageTypes
} from '@ula-aca/wallet'

const walletController = new WalletController({
  basePath: 'https://aca-py-api.com'
})

const eventHandler = new EventHandler([walletController])

const message: GetDidsMessage = {
  type: WalletMessageTypes.GET_DIDS,
  body: {
    public: 'false',
    did: 'WgWxqztrNooG92RXvxSTWv',
    verkey: 'H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV'
  }
}

eventHandler.processMsg(message, (response: UlaResponse) => {
  if (response.statusCode < 200 || response.statusCode >= 300) {
    // error
  } else {
    // response.body is response from /wallet/did api endpoint in aca-py
    // https://ula-aca.github.io/aries-cloudagent-interface-javascript/#/wallet/get_wallet_did
    const result: GetDidsResult = response.body
  }
})

@ula-aca/wallet/create-local-did

Create a local DID

import { EventHandler, UlaResponse } from 'universal-ledger-agent'
import {
  WalletController,
  CreateLocalDidMessage,
  CreateLocalDidResult,
  WalletMessageTypes
} from '@ula-aca/wallet'

const walletController = new WalletController({
  basePath: 'https://aca-py-api.com'
})

const eventHandler = new EventHandler([walletController])

const message: CreateLocalDidMessage = {
  type: WalletMessageTypes.CREATE_LOCAL_DID
}

eventHandler.processMsg(message, (response: UlaResponse) => {
  if (response.statusCode < 200 || response.statusCode >= 300) {
    // error
  } else {
    // response.body is response from /wallet/did/create POST api endpoint in aca-py
    // https://ula-aca.github.io/aries-cloudagent-interface-javascript/#/wallet/post_wallet_did_create
    const result: CreateLocalDidResult = response.body
  }
})

@ula-aca/wallet/fetch-public-did

Fetch the current public DID

import { EventHandler, UlaResponse } from 'universal-ledger-agent'
import {
  WalletController,
  FetchPublicDidMessage,
  FetchPublicDidResult,
  WalletMessageTypes
} from '@ula-aca/wallet'

const walletController = new WalletController({
  basePath: 'https://aca-py-api.com'
})

const eventHandler = new EventHandler([walletController])

const message: FetchPublicDidMessage = {
  type: WalletMessageTypes.FETCH_PUBLIC_DID
}

eventHandler.processMsg(message, (response: UlaResponse) => {
  if (response.statusCode < 200 || response.statusCode >= 300) {
    // error
  } else {
    // response.body is response from /wallet/did/public api endpoint in aca-py
    // https://ula-aca.github.io/aries-cloudagent-interface-javascript/#/wallet/get_wallet_did_public
    const result: FetchPublicDidResult = response.body
  }
})

@ula-aca/wallet/assign-public-did

Assign the current public DID

import { EventHandler, UlaResponse } from 'universal-ledger-agent'
import {
  WalletController,
  AssignPublicDidMessage,
  AssignPublicDidResult,
  WalletMessageTypes
} from '@ula-aca/wallet'

const walletController = new WalletController({
  basePath: 'https://aca-py-api.com'
})

const eventHandler = new EventHandler([walletController])

const message: AssignPublicDidMessage = {
  type: WalletMessageTypes.ASSIGN_PUBLIC_DID,
  body: {
    did: 'WgWxqztrNooG92RXvxSTWv'
  }
}

eventHandler.processMsg(message, (response: UlaResponse) => {
  if (response.statusCode < 200 || response.statusCode >= 300) {
    // error
  } else {
    // response.body is response from /wallet/did/public api endpoint in aca-py
    // https://ula-aca.github.io/aries-cloudagent-interface-javascript/#/wallet/get_wallet_did_public
    const result: AssignPublicDidResult = response.body
  }
})

@ula-aca/wallet/get-tagging-policy

Get the tagging policy for a credential definition

import { EventHandler, UlaResponse } from 'universal-ledger-agent'
import {
  WalletController,
  GetTagPolicyMessage,
  GetTagPolicyResult,
  WalletMessageTypes
} from '@ula-aca/wallet'

const walletController = new WalletController({
  basePath: 'https://aca-py-api.com'
})

const eventHandler = new EventHandler([walletController])

const message: GetTagPolicyMessage = {
  type: WalletMessageTypes.GET_TAG_POLICY,
  body: {
    credential_definition_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6'
  }
}

eventHandler.processMsg(message, (response: UlaResponse) => {
  if (response.statusCode < 200 || response.statusCode >= 300) {
    // error
  } else {
    // response.body is response from /wallet/tag-policy/{id} api endpoint in aca-py
    // https://ula-aca.github.io/aries-cloudagent-interface-javascript/#/wallet/get_wallet_tag_policy__id_
    const result: GetTagPolicyResult = response.body
  }
})

@ula-aca/wallet/set-tagging-policy

Set the tagging policy for a credential definition

import { EventHandler, UlaResponse } from 'universal-ledger-agent'
import {
  WalletController,
  SetTagPolicyMessage,
  SetTagPolicyResult,
  WalletMessageTypes
} from '@ula-aca/wallet'

const walletController = new WalletController({
  basePath: 'https://aca-py-api.com'
})

const eventHandler = new EventHandler([walletController])

const message: SetTagPolicyMessage = {
  type: WalletMessageTypes.SET_TAG_POLICY,
  body: {
    credential_definition_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
    taggables: ['score']
  }
}

eventHandler.processMsg(message, (response: UlaResponse) => {
  if (response.statusCode < 200 || response.statusCode >= 300) {
    // error
  } else {
    // response.body is response from /wallet/tag-policy/{id} api endpoint in aca-py
    // https://ula-aca.github.io/aries-cloudagent-interface-javascript/#/wallet/get_wallet_tag_policy__id_
    const result: SetTagPolicyResult = response.body
  }
})

Examples

For example usage see the examples/ directory.