From 6bd34e594d6a4fc06fe38149d692a1f93a6449db Mon Sep 17 00:00:00 2001 From: Nicholas Morsman Date: Mon, 23 Dec 2019 17:14:13 +0100 Subject: [PATCH] acme-client: Remove types as they are now provided by the package (#41146) --- notNeededPackages.json | 6 ++ types/acme-client/acme-client-tests.ts | 43 -------- types/acme-client/axios.d.ts | 5 - types/acme-client/client.d.ts | 137 ------------------------- types/acme-client/crypto/forge.d.ts | 10 -- types/acme-client/index.d.ts | 20 ---- types/acme-client/package.json | 6 -- types/acme-client/tsconfig.json | 24 ----- types/acme-client/tslint.json | 1 - 9 files changed, 6 insertions(+), 246 deletions(-) delete mode 100644 types/acme-client/acme-client-tests.ts delete mode 100644 types/acme-client/axios.d.ts delete mode 100644 types/acme-client/client.d.ts delete mode 100644 types/acme-client/crypto/forge.d.ts delete mode 100644 types/acme-client/index.d.ts delete mode 100644 types/acme-client/package.json delete mode 100644 types/acme-client/tsconfig.json delete mode 100644 types/acme-client/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 304d15513c..593ff21e2a 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -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", diff --git a/types/acme-client/acme-client-tests.ts b/types/acme-client/acme-client-tests.ts deleted file mode 100644 index 4ec5f18782..0000000000 --- a/types/acme-client/acme-client-tests.ts +++ /dev/null @@ -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: '', - email: 'test@example.com', - termsOfServiceAgreed: true, - challengeCreateFn: async (authz, challenge, keyAuthorization) => {}, - challengeRemoveFn: async (authz, challenge, keyAuthorization) => {} - }; - - await client.auto(autoOpts); -} diff --git a/types/acme-client/axios.d.ts b/types/acme-client/axios.d.ts deleted file mode 100644 index c95d07e274..0000000000 --- a/types/acme-client/axios.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { AxiosInstance } from "axios"; - -declare const instance: AxiosInstance; - -export default instance; diff --git a/types/acme-client/client.d.ts b/types/acme-client/client.d.ts deleted file mode 100644 index 0e0ad83c01..0000000000 --- a/types/acme-client/client.d.ts +++ /dev/null @@ -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; - challengeRemoveFn?: (authz: Authorization, challenge: Challenge, keyAuthorization: ChallengeKey) => Promise; -} - -export default class AcmeClient { - constructor(opts: Options); - getTermsOfServiceUrl(): Promise; - getAccountUrl(): string; - createAccount(data: CreateAccountRequest): Promise; - updateAccount(data: UpdateAccountRequest): Promise; - updateAccountKey(newAccountKey: AccountKey, data: any): Promise; - createOrder(data: CreateOrderRequest): Promise; - finalizeOrder(order: Order, csr: forge.Csr | string): Promise; - getAuthorizations(order: Order): Promise; - deactivateAuthorization(authz: Authorization): Promise; - getChallengeKeyAuthorization(challenge: Challenge): Promise; - verifyChallenge(authz: Authorization, challenge: Challenge): Promise; - completeChallenge(challenge: Challenge): Promise; - waitForValidStatus(item: T): Promise; - getCertificate(order: Order): Promise; - revokeCertificate(cert: Certificate, data: RevokeRequest): Promise; - auto(opts: AutoOptions): Promise; -} diff --git a/types/acme-client/crypto/forge.d.ts b/types/acme-client/crypto/forge.d.ts deleted file mode 100644 index 46796eb3fa..0000000000 --- a/types/acme-client/crypto/forge.d.ts +++ /dev/null @@ -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; diff --git a/types/acme-client/index.d.ts b/types/acme-client/index.d.ts deleted file mode 100644 index 499c3896ef..0000000000 --- a/types/acme-client/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Type definitions for acme-client 3.0 -// Project: https://github.com/publishlab/node-acme-client -// Definitions by: Tim Düsterhus -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -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, - } -}; diff --git a/types/acme-client/package.json b/types/acme-client/package.json deleted file mode 100644 index d83ed88850..0000000000 --- a/types/acme-client/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "axios": "*" - } -} diff --git a/types/acme-client/tsconfig.json b/types/acme-client/tsconfig.json deleted file mode 100644 index de848b6a30..0000000000 --- a/types/acme-client/tsconfig.json +++ /dev/null @@ -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" - ] -} diff --git a/types/acme-client/tslint.json b/types/acme-client/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/acme-client/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" }