1.1.4 • Published 4 months ago

@mdip/keymaster v1.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

MDIP Keymaster

Keymaster is a client library for the MDIP. It manages a wallet with any number of identities.

Installation

npm install @mdip/keymaster

Usage

Library

The library must be configured by calling the start function with 3 dependencies:

  • a configured gatekeeper instance
  • a wallet database
  • a cipher library (@mdip/cipher/node for servers or @mdip/cipher/web for web browsers)

Node application

// Import using subpaths
import GatekeeperClient from '@mdip/gatekeeper/client';
import WalletJson from '@mdip/keymaster/wallet/json';
import CipherNode from '@mdip/cipher/node';
import Keymaster from '@mdip/keymaster';

// Non-subpath imports
import { GatekeeperClient } from '@mdip/gatekeeper';
import Keymaster, { WalletJson } from '@mdip/keymaster';
import CipherNode from '@mdip/cipher';

const gatekeeper = new GatekeeperClient();
await gatekeeper.connect({
    url: 'http://gatekeeper-host:4224',
    waitUntilReady: true,
    intervalSeconds: 5,
    chatty: true,
});
const wallet = new WalletJson();
const cipher = new CipherNode();
const keymaster = new Keymaster({
    gatekeeper,
    wallet,
    cipher
});

const newId = await keymaster.createId('Bob');

Browser wallet

// Import using subpaths
import GatekeeperClient from '@mdip/gatekeeper/client';
import WalletWeb from '@mdip/keymaster/wallet/web';
import CipherWeb from '@mdip/cipher/web';
import Keymaster from '@mdip/keymaster';

// Non-subpath imports
import { GatekeeperClient } from '@mdip/gatekeeper';
import Keymaster, { WalletWeb } from '@mdip/keymaster';
import CipherWeb from '@mdip/cipher';

const gatekeeper = new GatekeeperClient();
await gatekeeper.connect({
    url: 'http://gatekeeper-host:4224',
    waitUntilReady: true,
    intervalSeconds: 5,
    chatty: true
});
const wallet = new WalletWeb();
const cipher = new CipherWeb();
const keymaster = new Keymaster({
    gatekeeper,
    wallet,
    cipher
});

const newId = await keymaster.createId('Bob');

Client

The KeymasterClient is used to communicate with a keymaster REST API service.

// Import using subpaths
import KeymasterClient from '@mdip/keymaster/client';

// Non-subpath imports
import { KeymasterClient } from '@mdip/keymaster';

const keymaster = new KeymasterClient();
await keymaster.connect({
    url: 'http://keymaster-host:4226',
    waitUntilReady: true,
    intervalSeconds: 5,
    chatty: true
});

const newId = await keymaster.createId('Bob');
1.1.1

5 months ago

1.1.0

6 months ago

1.0.0

8 months ago

1.1.4

4 months ago

1.1.3

5 months ago

1.1.2

5 months ago

0.5.0

10 months ago

0.4.1

11 months ago

0.4.0

11 months ago

0.6.0

9 months ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago