Zero-dependency ACME Client
Uses:
Feature | Chrome | Firefox | Safari | NodeJS | Deno |
---|---|---|---|---|---|
SubtleCrypto | 37 | 34 | 11 | 15.0.0 | 1.17 |
Fetch | 42 | 39 | 10.1 | 18.0.0 | 1.0 |
EventTarget* | 64 | 59 | 14 | 15.0.0 | 1.0 |
BigInt† | 67 | 68 | 14 | 10.4.0 | 1.0 |
Supported | 67 | 68 | 14 | 18.0.0 | 1.17 |
*Used by helper functions
†Used by helper ASN1 operations
Notes:
- Compatibility may be extended via polyfills (not included)
- Deno does not support ECDSA P-521
- ACMEClient
- JOSE Functions
- JWA Functions
- JWE Functions (incomplete)
- JWK Functions
- JWS Functions
- KeyStore
- ASN1 Encoder/Decoder
- Base64 Encoder/Decoder
- Bit Functions
- SubtleCrypto Wrapper
- DNS Resolver
- PKCS1, PKCS8, PKCS10, SPKI, EC, PEM Functions
- UTF-8 Decoder
import { buildEventTarget } from '@shortfuse/acmejs/helpers/nameDotCom.js';
import { getWildcardCertificate } from '@shortfuse/acmejs/helpers/quickOrder.js';
// as JWK
const ACCOUNT_PRIVATE_KEY = {
alg: 'ES256',
kty: 'EC',
crv: 'P-256',
x: 'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU',
y: 'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0',
d: 'jpsQnnGQmL-YBIffH1136cspYG6-0iY7X1fCE9-E9LI',
};
// as PEM
const CSR_PRIVATE_KEY = `
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDD0tPV/du2vftjvXj1t/gXTK39
sNBVrOAEb/jKzXae+Xa0H+3LhZaQIQNMfACiBSgIfZUvEGb+7TqXWQpoLoFR/R7MvGWcSk98JyrV
tveD8ZmZYyItSY7m2hcasqAFiKyOouV5vzyRe87/lEyzzBpF3bQQ4IDaQu+K9Hj5fKuU6rrOeOhs
dnJc+VdDQLScHxvMoLZ9Vtt+o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O/BGf2o+cEdq0diYlGK64cEVwBwSBnSg4vzlBqRIAUejLjwED
AJyA4EE8Y5A9l04dzV7nJb5cRak6CrgXxay/mBJRFtaHxVlaZGxYPGSYE6UFS0+3EOmmevvDZQBf
4qECgYEA0ZF6Vavz28+8wLO6SP3w8NmpHk7K9tGEvUfQ30SgDx4G7qPIgfPrbB4OP/E0qCfsIImi
3sCPpjvUMQdVVZyPOIMuB+rV3ZOxkrzxEUOrpOpR48FZbL7RN90yRQsAsrp9e4iv8QwB3VxLe7X0
TDqqnRyqrc/osGzuS2ZcHOKmCU8=
-----END PRIVATE KEY-----
`;
const NAME_DOT_COM_USERNAME = 'foo';
const NAME_DOT_COM_TOKEN = 'bar';
const certificate = await getWildcardCertificate({
tosAgreed: true,
domain: 'foo.com',
accountKey: ACCOUNT_PRIVATE_KEY,
email: 'admin@foo.com',
eventTarget: buildEventTarget(NAME_DOT_COM_USERNAME, NAME_DOT_COM_TOKEN),
countryName: 'US',
localityName: 'New York',
organizationName: 'Foo Products',
organizationalUnitName: 'IT',
stateOrProvinceName: 'NY',
csrKey: CSR_PRIVATE_KEY,
},
});
await store('foo-com.crt', certificate);
See quickOrder.js source code for a working example.