Skip to content

Create an ES6 Class from lets-encrypt-acme-client.js #3

Description

@FirstTimeEZ

Currently you can only have one daemon, which doesn't really make much sense if you have a more complicated setup

lets-encrypt-acme-client.js should be turned into an ES6 Class so there can be multiple instances of it.

/**
 * Create an `LetsEncrypt! Daemon` to Manage a `SSL Certificate`
 * 
 * @see startLetsEncryptDaemon - The actual daemon that will run periodcally after being started to create/renew certificates
 * @see checkChallengesMixin - You must check the `HTTP-01` challenges for each daemon you create
 * @remark `internal` methods could change at any time
 **/
export class LetsEncryptDaemon {
    constructor() {
        this.challengeLists = [];
        this.httpChallenges = [];
        this.checkAnswersFlag = false;
        this.localHost = false;
        this.checkedForLocalHost = false;
        this.acmeKeyChain = undefined;
        this.jsonWebKey = undefined;
        this.jsonWebKeyThumbPrint = undefined;
        this.acmeDirectory = null;
        this.acmeDirectoryURL = DIRECTORY_PRODUCTION;
        this.one = false;
        this.ariWindow = null;
        this.remaining = { days: null, hours: null, minutes: null };
    }

    async startLetsEncryptDaemon(fqdns, sslPath, certificateCallback, optGenerateAnyway = false, optStaging = false, dnsProvider = undefined) { }

    checkChallengesMixin(req, res) {  }

    async internalUpdateDirectory() {  }

    async internalCheckAnswered() {  }
    
    async internalGetAcmeKeyChain(sslPath) {   }

    async internalLetsEncryptDaemon(fqdns, sslPath, certificateCallback, optStaging, dnsProvider) {    }

    async internalFetchSuggest(sslPath, acmeDirectory) {  }

    async internalUpdateSuggestFromText(certificateText, acmeDirectory) {  }

    internalCheckForLocalHostOnce(req) {  }

    internalCheckChallenges() { }

    internalDetermineRequirement(fqdns, certFilePath, optStaging) {  }

    internalExpireDateFromCertificate(__certPath) {  }
}

I have already started doing this, it should be finished soon tm.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions