Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add readme #9

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 163 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,175 @@
Install deps:
<p align="center">
<div align="center">
<img src="assets/icon.png" alt="Paradym Logo" height="176px" />
</div>
<h1 align="center"><b>Paradym TypeScript SDK</b></h1>
</p>


<p align="center">
<a href="https://typescriptlang.org">
<img src="https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg" alt="TypeScript" />
</a>
<a href="https://opensource.org/licenses/Apache-2.0">
<img src="https://img.shields.io/badge/License-Apache_2.0-yellowgreen.svg" alt="Apache 2.0 License" />
</a>
Comment on lines +13 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not open source, will we make the SDK open source? If not we sohuld remove this probably

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WE should probably add this to docs.paradym.id?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assume that the endgoal of this would be to open source the library. It does not really change that as much the built code is almost the same as the source, right?

<a href="https://badge.fury.io/js/@paradym%2Fsdk">
<img src="https://badge.fury.io/js/@paradym%2Fsdk.svg" alt="npm version">
</a>
</p>

<p align="center">
<a href="#getting-started">Getting started</a>
&nbsp;|&nbsp;
<a href="#usage">Usage</a>
&nbsp;|&nbsp;
<a href="#contributing">License</a>
</p>

---
The Paradym TypeScript SDK offers seamless integration with the [Paradym API](https://paradym.id/reference), 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:

```sh
pnpm install
npm install @paradym/sdk
# or
yarn add @paradym/sdk
```

Copy env example and modify it to your needs:
## Usage

```sh
cp .env.example .env
#### Initialize client
Initialize the client with your API key, which you can find in the [Paradym Dashboard](https://paradym.id/app/settings/api-keys). Set up the client as follows:

```ts
import Paradym from '@paradym/sdk'

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

Generate:
#### Create a SD-JWT-VC Credential Template
```typescript
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
}
}
}
})

```sh
pnpm generate
```

Start
#### Create an Issuance Offer:
```typescript
import Paradym from '@paradym/sdk'
const paradym = new Paradym({
apiKey: "API_KEY"
})

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

#### Create a SD-JWT presentation template:
```ts
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:
```ts
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](https://opensource.org/licenses/Apache-2.0).
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.