Skip to content

jimmywarting/acme-easy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tests

acme-easy

An ACME client for the browser that authenticates via DNS-01 challenge and supports LetsEncrypt by default.

Use like so:

import AcmeClient from 'acme-easy'

const domainName = 'example.com';

const ac = await AcmeClient('letsencrypt'); // You can also use 'letsencrypt-staging' for testing
const { recordName, recordText, order } = await ac.requestDnsChallenge(domainName);
console.log(`set a DNS record with host: ${recordName} and TXT: ${recordText}`);

/* Then set the DNS record and wait ~10 minutes */

const { pemCertChain, pkcs8Key } = await ac.submitDnsChallengeAndFinalize(order);
console.log(pemCertChain)

Or, if you need persistence:

import AcmeClient from 'acme-easy'

const domainName = 'example.com';

// Generate a JWK and create a new account at LetsEncrypt
const ac = await AcmeClient('letsencrypt'); // You can also use 'letsencrypt-staging' for testing
// Generate and submt an new CSR then return the challenge text
const { recordName, recordText, order } = await ac.requestDnsChallenge(domainName);
// Save `jwk` and `order` objects (`setStore` is not a real function)
setStore({ jwk: ac.exportJwk(), order });
console.log(`set a DNS record with host: ${recordName} and TXT: ${recordText}`);

/* Close the app, set the DNS record and wait ~10 minutes */

/* Then reopen the app */

// Get objects from storage
const { jwk, order } = getStore();
// Log back in to your account by passing its JWK to the constructor
const ac = await AcmeClient('letsencrypt', jwk);
// Submit, finalize, and return the signed certificate and its private key
const { pemCertChain, pkcs8Key } = await ac.submitDnsChallengeAndFinalize(order);
console.log(pemCertChain)

tests requrire >=Nodev16

About

An ACME client for the browser that authenticates via DNS-01 challenge and supports LetsEncrypt by default.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%