0.0.15 • Published 2 years ago

ascertify-sdk v0.0.15

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

ascertify-sdk

Ascertify SDK is a javascript library to create W3C standard compliant Decentralized Identifiers (DIDs) and issue Verifiable Credentials (VCs) on Algorand ecosystem.

Prerequisites

This library leverages additional libraries including algosdk, and jose. To find out more, check out dependencies

Installing prerequisites

npm install algosdk
npm install jose

Installation

npm install ascertify-sdk

Quick Start

import {exportJWK, generateKeyPair} from 'jose';

const MNEMONIC = /* put your Algorand account mnemonic here and ensure its funded */

const ACCOUNT = algosdk.mnemonicToSecretKey(MNEMONIC);
const address = ACCOUNT.addr;

const sdk = new AscertifyID();

const { publicKey } = await generateKeyPair('ES256');
const pubKey = await exportJWK(publicKey);
const controller = ACCOUNT.addr;
const alsoKnownAs = 'https://ascertify.co';
const verificationMethod = {
    id: `did:ascertify:${ACCOUNT.addr}#keys-1`,
    type: 'JsonWebKey2020',
    controller: `did:ascertify:${ACCOUNT.addr}`,
    publicKeyJwk: {
        ...pubKey
    }
}
let did = await ascertify_sdk.createDID({address: address, controller:controller, alsoKnownAs: alsoKnownAs, verificationMethod: verificationMethod});

License

ascertify-sdk is licensed under an LGPL-2.1 license. See the LICENSE file for details.