Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/decentralized-identity/ion-sdk
TypeScript SDK for ION
https://github.com/decentralized-identity/ion-sdk
wg-sidetree
Last synced: 18 days ago
JSON representation
TypeScript SDK for ION
- Host: GitHub
- URL: https://github.com/decentralized-identity/ion-sdk
- Owner: decentralized-identity
- License: apache-2.0
- Created: 2020-09-18T22:02:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-25T22:15:11.000Z (9 months ago)
- Last Synced: 2024-04-26T22:25:23.923Z (9 months ago)
- Topics: wg-sidetree
- Language: TypeScript
- Homepage:
- Size: 157 KB
- Stars: 30
- Watchers: 10
- Forks: 14
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TypeScript/JavaScript SDK for `did:ion`
- This SDK allows you to create `did:ion` operations that are ready to be submitted to an ION node.
- You can also use the SDK to create long-form ION DIDs.
- This SDK is compatible with both node.js and browser.Code Coverage
![Statements](https://img.shields.io/badge/statements-100%25-brightgreen.svg?style=flat) ![Branches](https://img.shields.io/badge/branches-100%25-brightgreen.svg?style=flat) ![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg?style=flat) ![Lines](https://img.shields.io/badge/lines-100%25-brightgreen.svg?style=flat)
```
npm i @decentralized-identity/ion-sdk --save
```## Additional Setup
This package depends on the [`@noble/ed25519`](https://github.com/paulmillr/noble-ed25519#usage) and [`@noble/secp256k1`](https://github.com/paulmillr/noble-secp256k1#usage) v2, thus additional steps are needed for some environments:```ts
// node.js 18 and earlier, needs globalThis.crypto polyfill
import { webcrypto } from 'node:crypto';
// @ts-ignore
if (!globalThis.crypto) globalThis.crypto = webcrypto;// React Native needs crypto.getRandomValues polyfill and sha256 for `@noble/secp256k1`
import 'react-native-get-random-values';
import { hmac } from '@noble/hashes/hmac';
import { sha256 } from '@noble/hashes/sha256';
secp.etc.hmacSha256Sync = (k, ...m) => hmac(sha256, k, secp.etc.concatBytes(...m));
secp.etc.hmacSha256Async = (k, ...m) => Promise.resolve(secp.etc.hmacSha256Sync(k, ...m));// React Native needs crypto.getRandomValues polyfill and sha512 for `@noble/ed25519`
import 'react-native-get-random-values';
import { sha512 } from '@noble/hashes/sha512';
ed.etc.sha512Sync = (...m) => sha512(ed.etc.concatBytes(...m));
ed.etc.sha512Async = (...m) => Promise.resolve(ed.etc.sha512Sync(...m));
```