npm.io
0.0.26 • Published 2 years ago

@acme-ra/client

Licence
AGPL
Version
0.0.26
Deps
5
Size
91 kB
Vulns
0
Weekly
0

@acme-ra/client

This project provides a JavaScript/TypeScript client API into the ACME API

Installation

Using NPM:

npm install @acme-ra/client

Using Yarn:

yarn add @acme-ra/client

Usage

NodeJS
const acme = require("@acme-ra/client");

NodeJS requires to set WebCrypto provider and fetch function to client.

const fetch = require("node-fetch");
const { Crypto } = require("@peculiar/webcrypto");

const crypto = new Crypto();
const alg = { name: "ECDSA", namedCurve: "P-256" };
const keys = await crypto.subtle.generateKey(alg, false, ["sign", "verify"]);

const client = await ApiClient.create(
  keys,
  "http://localhost:4000/acme/directory",
  {
    fetch,
    crypto,
  });
Browser

Every release of @acme-ra/client will have new build of ./build/acme.min.js for use in the browser. To get access to module classes use acme global variable.

WARN: We recommend hosting and controlling your own copy for security reasons

<script src="https://unpkg.com/@acme-ra/client"></script>