Class: AcmeClient

AcmeClient~AcmeClient

AcmeClient

Constructor

new AcmeClient(directory_url, jWebClient)

ACME protocol implementation from client perspective
Parameters:
Name Type Description
directory_url string Address of directory
jWebClient module:JWebClient~JWebClient Reference to JSON-Web-Client
Source:

Members

clientProfilePubKey :Object

Cached public key obtained from profile
Type:
  • Object
Source:

days_valid :number

Validity period in days
Type:
  • number
Default Value:
  • 1
Source:

defaultRsaKeySize :number

Key strength in bits
Type:
  • number
Default Value:
  • 4096
Source:

directory :Object

Hash map of REST URIs
Type:
  • Object
Source:

directory_url :string

Address of directory
Type:
  • string
Source:

emailDefaultPrefix :string

Prefix of email address if constructed from domain name
Type:
  • string
Default Value:
  • "hostmaster"
Source:

emailOverride :string

Email address to use
Type:
  • string
Source:

jWebClient :module:JWebClient~JWebClient

Reference to JSON-Web-Client
Type:
Source:
Cached registration URI
Type:
  • string
Source:
Cached terms of service URI
Type:
  • string
Source:

webroot :string

Path to server web root (or path to store challenge data)
Type:
  • string
Default Value:
  • "."
Source:

well_known_path :string

Directory structure for challenge data
Type:
  • string
Default Value:
  • "/.well-known/acme-challenge/"
Source:

withInteraction :boolean

Determines if interaction of user is required
Type:
  • boolean
Default Value:
  • true
Source:

Methods

acceptChallenge(challenge, callback)

tell server which challenge will be accepted
Parameters:
Name Type Description
challenge Object
callback function first argument will be the answer object
Source:

agreeTos(tosLink, callback)

agree with terms of service (update agreement status in profile)
Parameters:
Name Type Description
tosLink string
callback function first argument will be the answer object
Source:

authorizeDomain(domain, callback)

authorize domain using challenge-response-method
Parameters:
Name Type Description
domain string
callback function first argument will be the answer object
Source:

createAccount(email, callback)

create new account (assumes directory lookup has already occured)
Parameters:
Name Type Description
email string
callback function first argument will be the registration URI
Source:

createKeyPair(bit, c, o, cn, e, callback)

External: Create key pair
Parameters:
Name Type Description
bit number key strength, expected to be already sanitized
c string country code, expected to be already sanitized
o string organization, expected to be already sanitized
cn string common name (domain name), expected to be already sanitized
e string email address, expected to be already sanitized
callback function
Source:

emptyCallback()

Helper: Empty callback
Source:

extractEmail(profile) → {string}

Helper: Extract first found email from profile (without mailto prefix)
Parameters:
Name Type Description
profile Object
Source:
Returns:
Type
string

getDirectory(callback)

retrieve directory entries (directory url must be set prior to execution)
Parameters:
Name Type Description
callback function first argument will be the answer object
Source:

getProfile(callback)

retrieve profile of user (will make directory lookup and registration check)
Parameters:
Name Type Description
callback function first argument will be the answer object
Source:

getRegistration(uri, payload, callback)

get information about registration
Parameters:
Name Type Description
uri string will be exposed when trying to register
payload Object update information
callback function first argument will be the answer object
Source:
Helper: Extract TOS Link, e.g. from "<http://...>;rel="terms-of-service"
Parameters:
Name Type Description
linkStr string
Source:
Returns:
Type
string

makeCertRequest(csr, days_valid) → {Object}

Make ACME-Request: CSR - Object: resource, csr, notBefore, notAfter
Parameters:
Name Type Description
csr string
days_valid number
Source:
Returns:
Type
Object

makeChallengeResponse(challenge) → {Object}

Make ACME-Request: Challenge-Response - Object: resource, keyAuthorization
Parameters:
Name Type Description
challenge Object
Source:
Returns:
Type
Object

makeDomainAuthorizationRequest(domain) → {Object}

Make ACME-Reques: Domain-Authorization Request - Object: resource, identifier
Parameters:
Name Type Description
domain string
Source:
Returns:
Type
Object

makeKeyAuthorization(challenge) → {string}

Make ACME-Object: Key-Authorization (encoded) - String: Challenge-Token . Encoded-Account-Key-Hash
Parameters:
Name Type Description
challenge Object
Source:
Returns:
Type
string

makeSafeFileName(name, withPath) → {string}

Helper: Make safe file name or path from string
Parameters:
Name Type Description
name string
withPath boolean optional, default false
Source:
Returns:
Type
string

newRegistration(payload, callback)

try to register (directory lookup must have occured prior to execution)
Parameters:
Name Type Description
payload Object
callback function first argument will be the answer object
Source:

pollUntilIssued(uri, callback, retry)

periodically (with exponential back-off) check status of CSR
Parameters:
Name Type Description
uri string
callback function first argument will be the answer object
retry number factor of delay
Source:

pollUntilValid(uri, callback, retry)

periodically (with exponential back-off) check status of challenge
Parameters:
Name Type Description
uri string
callback function first argument will be the answer object
retry number factor of delay
Source:

prepareChallenge(domain, challenge, callback)

Helper: Prepare challenge
Parameters:
Name Type Description
domain string
challenge Object
callback function
Source:

requestCertificate(domain, organization, country, callback)

Entry-Point: Request certificate
Parameters:
Name Type Description
domain string
organization string
country string
callback function
Source:

requestSigning(domain, callback)

send CSR
Parameters:
Name Type Description
domain string expected to be already sanitized
callback function first argument will be the answer object
Source:

selectChallenge(ans, challenge_type) → {Object}

Helper: Select challenge by type
Parameters:
Name Type Description
ans Object
challenge_type string
Source:
Returns:
Type
Object