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

@affinidi-tdk/credential-issuance-client

v1.37.0

Published

Affinidi TDK typescript client for Affinidi CREDENTIAL ISSUANCE

Downloads

670

Readme

@affinidi-tdk/credential-issuance-client

Service API Endpoints and Models

Please check the documentation for API Endpoints and Models for more details.

Usage

npm install @affinidi-tdk/credential-issuance-client --save

Http Client settings

We use Axios plugin that intercepts failed requests and retries them whenever possible.

You can configure some of retry parameters:

| Name | Type | Default | Description | | ------------------ | --------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | retries | Number | 3 | The number of times to retry before failing. 1 = One retry after first failure. The number can be between 0 and 3. | | isExponentialDelay | Boolean | false | By default there is no delay between retries. When option is set to true (See Exponential Backoff), the client will periodically retry a failed request over an increasing amount of time. |

Please note that retry condition is not configurable and axios-retry default value is used isNetworkOrIdempotentRequestError. It retries if it is a network error or a 5xx error on an idempotent request (GET, HEAD, OPTIONS, PUT or DELETE).

With project scoped token and a custom Http client settings

import {
  SomeClassApi,
  Configuration,
} from '@affinidi-tdk/credential-issuance-client'

const projectScopedToken = '...' // NOTE: you can get it after making Affinidi Login (via CLI, Dev Portal)

const retryConfig = {
  retries: 2,
  isExponentialDelay: true,
}

const api = new SomeClassApi(
  new Configuration({
    apiKey: projectScopedToken,
  }),
  retryConfig,
)

await api.oneOfMethods()

With PAT

💡 To create PAT, use Affinidi CLI's create-token command.

affinidi token create-token -n MyNewToken -w -p YOUR-SECRET-PASSPHRASE

This command will return you variables to initialize AuthProvider as required below.

import {
  SomeClassApi,
  Configuration,
} from '@affinidi-tdk/credential-issuance-client'
import { AuthProvider } from '@affinidi-tdk/auth-provider'

const authProvider = new AuthProvider({
  apiGatewayUrl,
  keyId,
  tokenId,
  passphrase,
  privateKey,
  projectId,
  tokenEndpoint,
})

const api = new SomeClassApi(
  new Configuration({
    apiKey: authProvider.fetchProjectScopedToken.bind(authProvider),
  }),
)

await api.oneOfMethods()

With session ID via BFF

import {
  SomeClassApi,
  Configuration,
} from '@affinidi-tdk/credential-issuance-client'
import { getBffHeaders } from '@affinidi-tdk/auth-provider'

const headers = getBffHeaders(cookieName, sessionId)

const baseOptions = { headers }

const api = new SomeClassApi(
  new Configuration({ basePath: `${bffHost}/cis`, baseOptions }),
)

await api.oneOfMethods()