@paradym/sdk
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Paradym Logo

Paradym TypeScript SDK

TypeScript Apache 2.0 License npm version

Getting started  |  Usage  |  License


The Paradym TypeScript SDK offers seamless integration with the Paradym API, enabling developers to interact with Paradym's features from TypeScript applications. This SDK simplifies the process of making API requests, allowing you to focus on building your application.

Getting Started

First, you need to add the dependency to your project:

npm install @paradym/sdk
# or 
yarn add @paradym/sdk

Usage

Initialize client

Initialize the client with your API key, which you can find in the Paradym Dashboard. Set up the client as follows:

import Paradym from '@paradym/sdk'

const paradym = new Paradym({
    apiKey: "API_KEY"
})

Create a SD-JWT-VC Credential Template

import Paradym from '@paradym/sdk'

const paradym = new Paradym({
    apiKey: "API_KEY"
})

paradym.templates.credentials.createSdJwtVcTemplate({
  projectId: 'clwt6e610000101s69ubga6lk',
  requestBody: { 
    name: "My SD-JWT VC template", 
    description: "This is a description", 
    issuer: "did:web", 
    background: { 
      color: "#FFFFFF", 
      url: "https://example.com/image.png" 
    }, 
    text: { 
      color: "#000000" 
    }, 
    validFrom: "2024-04-11", 
    validUntil: { 
      start: "validFrom", 
      future: { years: 5 } 
    }, 
    type: "UniversityCard", 
    revocable: false, 
    attributes: { 
      myAttribute: { 
        type: "string", 
        name: "My attribute", 
        description: "This is a attribute", 
        required: true, 
        alwaysDisclosed: false 
      } 
    } 
  }
})

Create an Issuance Offer:

import Paradym from '@paradym/sdk'
const paradym = new Paradym({
    apiKey: "API_KEY"
})

paradym.openId4Vc.issuance.createIssuanceOffer({
  projectId: 'clwt6e610000101s69ubga6lk',
  requestBody: {
    credentials: [{
      credentialTemplateId: 'clwt6e610000101s69ubga6lk',
      attributes: {
        "name": "John Doe"
      },
    }]
  }
})

Create a SD-JWT presentation template:

import Paradym from '@paradym/sdk'
const paradym = new Paradym({
    apiKey: "API_KEY"
})

const sdJwtPresentationTemplate = await paradym.templates.presentations.createPresentationTemplate({
    projectId: 'clwt6e620000101s69ubga6lk',
    requestBody: {
        credentials: [
            {
                description: 'This is a description',
                name: 'My SD-JWT VC credential',
                format: 'sd-jwt-vc',
                type: 'https://metadata.paradym.id/types/28dc88-UniversityCard',
                attributes: {
                    myAttribute1: {
                        type: 'string',
                        value: 'myValue',
                    },
                    myAttribute2: {
                        type: 'number',
                        minimum: 1,
                        maximum: 10,
                    },
                    myAttribute3: {
                        type: 'boolean',
                        value: true,
                    },
                },
            },
        ],
        description: 'This is a description',
        name: 'My SD-JWT VC presentation',
    },
})

Create a SD-JWT Verification Request:

import Paradym from '@paradym/sdk'
const paradym = new Paradym({
    apiKey: "API_KEY"
})

paradym.openId4Vc.verification.createVerificationRequest({
  projectId: 'clwt6e610000101s69ubga6lk',
  requestBody: {
    presentationTemplateId: 'clwt6e610000101s69ubga6lk',
  }
})

License

This project is licensed under the Apache 2.0 License.

Readme

Keywords

none

Package Sidebar

Install

npm i @paradym/sdk

Weekly Downloads

46

Version

1.1.0

License

Apache-2.0

Unpacked Size

538 kB

Total Files

45

Last publish

Collaborators

  • animo-bot