npm.io
1.0.9 • Published 4 years ago

@gooddollar/ceramic-seed-sdk

Licence
ISC
Version
1.0.9
Deps
5
Size
43 kB
Vulns
0
Weekly
0

CeramicSeedSDK

Manage a privatekey or seed by multiple Ids

Getting Started

Install Ceramic-seed-sdk into your project

yarn add @gooddollar/ceramic-seed-sdk

Usage

import { CeramicSDK } from '@gooddollar/ceramic-seed-sdk'
  • Create a new instance of the sdk:

const sdk = new CeramicSDK("https://ceramic-clay.3boxlabs.com");
  • Initialize a DID based on private key and create a new one if none exists:
    const sdkClient = new CeramicSDK(NODE_URL_3BOXLABS);
    const myPrvkey = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; // Length need to be 32
    const res = await sdkClient.initialize(myPrvkey, "pubkeyToUseAsAuthId");
  • Add the given private key as another authSecret that can access the DID seed:
    const res = await sdkClient.addAuthenticator(myNewPrvkey, derivedPubkey2);
  • Remove the provided authenticator:
    const removed = await sdkClient.removeAuthenticator(pubkey);
  • Retrieves the unencrypted master seed:
    const ms = await sdkClient.getMasterSeed();