first version

This commit is contained in:
2016-11-01 18:27:57 +01:00
commit 904cf09788
23 changed files with 2846 additions and 0 deletions

1
dist/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './smartacme.classes.smartacme';

6
dist/index.js vendored Normal file
View File

@ -0,0 +1,6 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require("./smartacme.classes.smartacme"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsbURBQTZDIn0=

195
dist/smartacme.classes.acmeclient.d.ts vendored Normal file
View File

@ -0,0 +1,195 @@
/**
* @class AcmeClient
* @constructor
* @description ACME protocol implementation from client perspective
* @param {string} directory_url - Address of directory
* @param {module:JWebClient~JWebClient} jWebClient - Reference to JSON-Web-Client
*/
export declare class AcmeClient {
clientProfilePubKey: any;
days_valid: number;
defaultRsaKeySize: number;
directory: any;
directoryUrl: string;
emailDefaultPrefix: string;
emailOverride: string;
jWebClient: any;
regLink: string;
tosLink: string;
webroot: string;
well_known_path: string;
withInteraction: boolean;
constructor(directoryUrlArg: any);
/**
* getDirectory
* @description retrieve directory entries (directory url must be set prior to execution)
* @param {function} callback - first argument will be the answer object
*/
getDirectory(callback: any): void;
/**
* newRegistration
* @description try to register (directory lookup must have occured prior to execution)
* @param {Object} payload
* @param {function} callback - first argument will be the answer object
*/
newRegistration(payload: any, callback: any): void;
/**
* getRegistration
* @description get information about registration
* @param {string} uri - will be exposed when trying to register
* @param {Object} payload - update information
* @param {function} callback - first argument will be the answer object
*/
getRegistration(uri: any, payload: any, callback: any): void;
/**
* authorizeDomain
* @description authorize domain using challenge-response-method
* @param {string} domain
* @param {function} callback - first argument will be the answer object
*/
authorizeDomain(domain: any, callback: any): void;
/**
* acceptChallenge
* @description tell server which challenge will be accepted
* @param {Object} challenge
* @param {function} callback - first argument will be the answer object
*/
acceptChallenge(challenge: any, callback: any): void;
/**
* pollUntilValid
* @description periodically (with exponential back-off) check status of challenge
* @param {string} uri
* @param {function} callback - first argument will be the answer object
* @param {number} retry - factor of delay
*/
pollUntilValid(uri: any, callback: any, retry?: number): void;
/**
* pollUntilIssued
* @description periodically (with exponential back-off) check status of CSR
* @param {string} uri
* @param {function} callback - first argument will be the answer object
* @param {number} retry - factor of delay
*/
pollUntilIssued(uri: any, callback: any, retry?: number): void;
/**
* requestSigning
* @description send CSR
* @param {string} domain - expected to be already sanitized
* @param {function} callback - first argument will be the answer object
*/
requestSigning(domain: any, callback: any): void;
/**
* getProfile
* @description retrieve profile of user (will make directory lookup and registration check)
* @param {function} callback - first argument will be the answer object
*/
getProfile(callback: any): void;
/**
* createAccount
* @description create new account (assumes directory lookup has already occured)
* @param {string} email
* @param {function} callback - first argument will be the registration URI
*/
createAccount(email: any, callback: any): void;
/**
* agreeTos
* @description agree with terms of service (update agreement status in profile)
* @param {string} tosLink
* @param {function} callback - first argument will be the answer object
*/
agreeTos(tosLink: any, callback: any): void;
/**
* Entry-Point: Request certificate
* @param {string} domain
* @param {string} organization
* @param {string} country
* @param {function} callback
*/
requestCertificate(domain: any, organization: any, country: any, callback: any): void;
/**
* External: Create key pair
* @param {number} bit - key strength, expected to be already sanitized
* @param {string} c - country code, expected to be already sanitized
* @param {string} o - organization, expected to be already sanitized
* @param {string} cn - common name (domain name), expected to be already sanitized
* @param {string} e - email address, expected to be already sanitized
* @param {function} callback
*/
createKeyPair(bit: any, c: any, o: any, cn: any, e: any, callback: any): void;
/**
* Helper: Empty callback
*/
emptyCallback(): void;
/**
* Helper: Make safe file name or path from string
* @param {string} name
* @param {boolean} withPath - optional, default false
* @return {string}
*/
makeSafeFileName(name: any, withPath?: boolean): any;
/**
* Helper: Prepare challenge
* @param {string} domain
* @param {Object} challenge
* @param {function} callback
*/
prepareChallenge(domain: any, challenge: any, callback: any): void;
/**
* Helper: Extract TOS Link, e.g. from "<http://...>;rel="terms-of-service"
* @param {string} linkStr
* @return {string}
*/
getTosLink(linkStr: any): string;
/**
* Helper: Select challenge by type
* @param {Object} ans
* @param {string} challenge_type
* @return {Object}
*/
selectChallenge(ans: any, challengeType: string): any;
/**
* Helper: Extract first found email from profile (without mailto prefix)
* @param {Object} profile
* @return {string}
*/
extractEmail(profile: any): string;
/**
* Make ACME-Request: Domain-Authorization Request - Object: resource, identifier
* @param {string} domain
* @return {{resource: string, identifier: Object}}
*/
makeDomainAuthorizationRequest(domain: any): {
'resource': string;
'identifier': {
'type': string;
'value': any;
};
};
/**
* Make ACME-Object: Key-Authorization (encoded) - String: Challenge-Token . Encoded-Account-Key-Hash
* @param {Object} challenge
* @return {string}
*/
makeKeyAuthorization(challenge: any): string;
/**
* Make ACME-Request: Challenge-Response - Object: resource, keyAuthorization
* @param {Object} challenge
* @return {{resource: string, keyAuthorization: string}}
*/
makeChallengeResponse(challenge: any): {
'resource': string;
'keyAuthorization': string;
};
/**
* Make ACME-Request: CSR - Object: resource, csr, notBefore, notAfter
* @param {string} csr
* @param {number} days_valid
* @return {{resource: string, csr: string, notBefore: string, notAfter: string}}
*/
makeCertRequest(csr: any, DAYS_VALID: number): {
'resource': string;
'csr': string;
'notBefore': string;
'notAfter': string;
};
}

903
dist/smartacme.classes.acmeclient.js vendored Normal file

File diff suppressed because one or more lines are too long

61
dist/smartacme.classes.jwebclient.d.ts vendored Normal file
View File

@ -0,0 +1,61 @@
/**
* @class JWebClient
* @constructor
* @description Implementation of HTTPS-based JSON-Web-Client
*/
export declare class JWebClient {
key_pair: any;
last_nonce: string;
verbose: boolean;
constructor();
/**
* createJWT
* @description create JSON-Web-Token signed object
* @param {string|undefined} nonce
* @param {Object|string|number|boolean} payload
* @param {string} alg
* @param {Object|string} key
* @param {Object} jwk
* @return {string}
*/
createJWT(nonce: any, payload: any, alg: any, key: any, jwk: any): string;
/**
* request
* @description make GET or POST request over HTTPS and use JOSE as payload type
* @param {string} query
* @param {string} payload
* @param {function} callback
* @param {function} errorCallback
*/
request(query: any, payload: any, callback: any, errorCallback: any): void;
/**
* get
* @description make GET request
* @param {string} uri
* @param {function} callback
* @param {function} errorCallback
*/
get(uri: any, callback: any, errorCallback: any): void;
/**
* post
* @description make POST request
* @param {string} uri
* @param {Object|string|number|boolean} payload
* @param {function} callback
* @param {function} errorCallback
*/
post(uri: any, payload: any, callback: any, errorCallback: any): void;
/**
* evaluateStatus
* @description check if status is expected and log errors
* @param {string} uri
* @param {Object|string|number|boolean} payload
* @param {Object|string} ans
* @param {Object} res
*/
evaluateStatus(uri: any, payload: any, ans: any, res: any): void;
/**
* Helper: Empty callback
*/
emptyCallback(): void;
}

283
dist/smartacme.classes.jwebclient.js vendored Normal file

File diff suppressed because one or more lines are too long

5
dist/smartacme.classes.smartacme.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import * as acmeclient from './smartacme.classes.acmeclient';
export declare class SmartAcme {
acmeClient: acmeclient.AcmeClient;
constructor(directoryUrlArg?: string);
}

9
dist/smartacme.classes.smartacme.js vendored Normal file
View File

@ -0,0 +1,9 @@
"use strict";
const acmeclient = require("./smartacme.classes.acmeclient");
class SmartAcme {
constructor(directoryUrlArg = 'https://acme-staging.api.letsencrypt.org/directory') {
this.acmeClient = new acmeclient.AcmeClient(directoryUrlArg);
}
}
exports.SmartAcme = SmartAcme;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhY21lLmNsYXNzZXMuc21hcnRhY21lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRhY21lLmNsYXNzZXMuc21hcnRhY21lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSw2REFBNEQ7QUFFNUQ7SUFFSSxZQUFZLGtCQUEwQixvREFBb0Q7UUFDdEYsSUFBSSxDQUFDLFVBQVUsR0FBRyxJQUFJLFVBQVUsQ0FBQyxVQUFVLENBQUMsZUFBZSxDQUFDLENBQUE7SUFDaEUsQ0FBQztDQUNKO0FBTEQsOEJBS0MifQ==

3
dist/smartacme.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import 'typings-global';
import * as path from 'path';
export { path };

5
dist/smartacme.plugins.js vendored Normal file
View File

@ -0,0 +1,5 @@
"use strict";
require("typings-global");
const path = require("path");
exports.path = path;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhY21lLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGFjbWUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLDZCQUE0QjtBQUd4QixvQkFBSSJ9