-
Notifications
You must be signed in to change notification settings - Fork 1
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
add readme #9
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
<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> | ||
| | ||
<a href="#usage">Usage</a> | ||
| | ||
<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). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?