acme-client: Remove types as they are now provided by the package (#41146)

This commit is contained in:
Nicholas Morsman
2019-12-23 10:14:13 -06:00
committed by Andrew Branch
parent e31707d756
commit 6bd34e594d
9 changed files with 6 additions and 246 deletions
+6
View File
@@ -12,6 +12,12 @@
"sourceRepoURL": "https://www.ably.io/",
"asOfVersion": "1.0.0"
},
{
"libraryName": "acme-client",
"typingsPackageName": "acme-client",
"sourceRepoURL": "https://github.com/publishlab/node-acme-client",
"asOfVersion": "3.3.0"
},
{
"libraryName": "actions-on-google",
"typingsPackageName": "actions-on-google",
-43
View File
@@ -1,43 +0,0 @@
import * as acme from 'acme-client';
async function wrap() {
const accountKey = await acme.forge.createPrivateKey();
const client = new acme.Client({
directoryUrl: acme.directory.letsencrypt.staging,
accountKey
});
await client.createAccount({
termsOfServiceAgreed: true,
contact: ['mailto:test@example.com']
});
const order = await client.createOrder({
identifiers: [
{ type: 'dns', value: 'example.com' },
{ type: 'dns', value: '*.example.com' }
]
});
const authz = (await client.getAuthorizations(order))[0];
const challenge = authz.challenges[0];
await client.getChallengeKeyAuthorization(challenge);
await client.verifyChallenge(authz, challenge);
await client.completeChallenge(challenge);
await client.waitForValidStatus(challenge);
const [, csr] = await acme.forge.createCsr({
commonName: '*.example.com',
altNames: ['example.com']
});
await client.finalizeOrder(order, csr);
await client.getCertificate(order);
const autoOpts: acme.AutoOptions = {
csr: '<PEM encoded CSR>',
email: 'test@example.com',
termsOfServiceAgreed: true,
challengeCreateFn: async (authz, challenge, keyAuthorization) => {},
challengeRemoveFn: async (authz, challenge, keyAuthorization) => {}
};
await client.auto(autoOpts);
}
-5
View File
@@ -1,5 +0,0 @@
import { AxiosInstance } from "axios";
declare const instance: AxiosInstance;
export default instance;
-137
View File
@@ -1,137 +0,0 @@
import * as forge from "./crypto/forge";
export type AccountKey = forge.PrivateKey;
export type Certificate = string | Buffer;
export type CertificateChain = string;
export type ChallengeKey = string;
export interface Options {
directoryUrl?: string;
accountUrl?: string | null;
accountKey?: AccountKey;
backoffAttempts?: number;
backoffMin?: number;
backoffMax?: number;
}
export interface AccountRequest {
contact?: string[];
}
export interface CreateAccountRequest extends AccountRequest {
termsOfServiceAgreed?: boolean;
externalAccountBinding?: object;
onlyReturnExisting?: boolean;
}
// At this time there are no parameters that are restricted to updates.
// tslint:disable-next-line:no-empty-interface
export interface UpdateAccountRequest extends AccountRequest {
}
export interface Account {
status?: string;
contact?: string[];
termsOfServiceAgreed?: boolean;
externalAccountBinding?: object;
orders?: string[];
}
export interface Identifier {
type: string;
value: string;
}
export interface CreateOrderRequest {
identifiers: Identifier[];
notBefore?: string;
notAfter?: string;
}
export interface HasStatus {
status?: string;
}
export interface Order extends HasStatus {
status: "pending" | "ready" | "processing" | "valid" | "invalid";
expires?: string;
identifiers: Identifier[];
notBefore?: string;
notAfter?: string;
authorizations: string[];
finalize: string;
certificate?: string;
}
export interface Challenge extends HasStatus {
type: string;
url: string;
status: string;
validated?: string;
error?: object;
}
export interface Http01Challenge extends Challenge {
type: "http-01";
token: string;
}
export interface Dns01Challenge extends Challenge {
type: "dns-01";
token: string;
}
export interface Authorization extends HasStatus {
status: "pending" | "valid" | "invalid" | "deactivated" | "expired" | "revoked";
identifier: Identifier;
expires?: string;
challenges: Challenge[];
wildcard?: boolean;
url: string;
}
export enum RevocationReason {
Unspecified = 0,
KeyCompromise = 1,
CACompromise = 2,
AffiliationChanged = 3,
Supersedeed = 4,
CessationOfOperation = 5,
CertificateHold = 6,
RemoveFromCRL = 8,
PrivilegeWithdrawn = 9,
AACompromise = 10,
}
export interface RevokeRequest {
reason?: RevocationReason;
}
export interface AutoOptions {
csr?: forge.Csr | string;
email?: string;
termsOfServiceAgreed?: boolean;
challengePriority?: string[];
challengeCreateFn?: (authz: Authorization, challenge: Challenge, keyAuthorization: ChallengeKey) => Promise<any>;
challengeRemoveFn?: (authz: Authorization, challenge: Challenge, keyAuthorization: ChallengeKey) => Promise<any>;
}
export default class AcmeClient {
constructor(opts: Options);
getTermsOfServiceUrl(): Promise<string>;
getAccountUrl(): string;
createAccount(data: CreateAccountRequest): Promise<Account>;
updateAccount(data: UpdateAccountRequest): Promise<Account>;
updateAccountKey(newAccountKey: AccountKey, data: any): Promise<any>;
createOrder(data: CreateOrderRequest): Promise<Order>;
finalizeOrder(order: Order, csr: forge.Csr | string): Promise<any>;
getAuthorizations(order: Order): Promise<Authorization[]>;
deactivateAuthorization(authz: Authorization): Promise<any>;
getChallengeKeyAuthorization(challenge: Challenge): Promise<ChallengeKey>;
verifyChallenge(authz: Authorization, challenge: Challenge): Promise<any>;
completeChallenge(challenge: Challenge): Promise<any>;
waitForValidStatus<T extends HasStatus>(item: T): Promise<T>;
getCertificate(order: Order): Promise<CertificateChain>;
revokeCertificate(cert: Certificate, data: RevokeRequest): Promise<any>;
auto(opts: AutoOptions): Promise<CertificateChain>;
}
-10
View File
@@ -1,10 +0,0 @@
export type PrivateKey = Buffer;
export type Csr = Buffer;
export interface CsrOptions {
keySize?: number;
commonName?: string;
altNames?: string[];
}
export function createCsr(data: CsrOptions, key?: PrivateKey): Promise<[PrivateKey, Csr]>;
export function createPrivateKey(size?: number): Promise<PrivateKey>;
-20
View File
@@ -1,20 +0,0 @@
// Type definitions for acme-client 3.0
// Project: https://github.com/publishlab/node-acme-client
// Definitions by: Tim Düsterhus <https://github.com/TimWolla>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
export * from "./client";
export { default as Client } from "./client";
export { default as axios } from "./axios";
import * as forge from "./crypto/forge";
export { forge };
export const directory: {
letsencrypt: {
staging: string,
production: string,
}
};
-6
View File
@@ -1,6 +0,0 @@
{
"private": true,
"dependencies": {
"axios": "*"
}
}
-24
View File
@@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"target": "es6"
},
"files": [
"index.d.ts",
"acme-client-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }