Skip to content

The JavaScript (TypeScript) in-browser postMessage-based API

License

Notifications You must be signed in to change notification settings

dicekeys/dicekeys-api-js

Repository files navigation

DiceKeys PostMessage Api

This package contains the DiceKeys app's Application Programming Interface (API), for use by websites and browser-based via the browser's PostMessage interface.

Your app can use this API to ask the user to user their DiceKey to:

  • Derive a password or secret from the user's DiceKey
  • Derive a cryptographic key from the user's DiceKey
  • Unseal (decrypt and authenticate) secrets encrypted with keys derived from the user's DiceKey
  • Sign messages with a signing key derived from the user's DiceKey
import {
  Recipe,
  getPassword
} from "@dicekeys/dicekeys-api-js"

// See https://dicekeys.github.io/seeded-crypto/recipe_format.html
const recipe = JSON.stringify(Recipe({
  type: "Secret",
  mutable: true,
  wordLimit: 13,
  allow: [{"host": document.location.host}]
}));

// Call the API to request a password specific to this host
// derived from the user's DiceKey
const {password} = await getPassword({recipe});

Installation

In your .npmrc file

@dicekeys:registry=https://npm.pkg.github.com
> npm install @dicekeys/dicekeys-api-js

Documentation

Generated via TypeDoc

About

The JavaScript (TypeScript) in-browser postMessage-based API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages