mirror of
https://github.com/certd/certd.git
synced 2026-05-16 21:27:34 +08:00
chore: 1
This commit is contained in:
+12
-12
@@ -102,7 +102,9 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
|
|||||||
if (!this.orderId) {
|
if (!this.orderId) {
|
||||||
throw new Error("请先输入证书实例 ID");
|
throw new Error("请先输入证书实例 ID");
|
||||||
}
|
}
|
||||||
const certDetail = await this.getCertDetailV2(client, this.orderId);
|
const certificateId = await this.getOrderDetailV2(client, this.orderId);
|
||||||
|
this.logger.info(`获取到证书 ID:${certificateId}`);
|
||||||
|
const certDetail = await this.getCertDetail(client, certificateId);
|
||||||
this.logger.info(`获取到证书:${certDetail.getAllDomains()}, 过期时间:${dayjs(certDetail.expires).format("YYYY-MM-DD HH:mm:ss")}`);
|
this.logger.info(`获取到证书:${certDetail.getAllDomains()}, 过期时间:${dayjs(certDetail.expires).format("YYYY-MM-DD HH:mm:ss")}`);
|
||||||
return certDetail;
|
return certDetail;
|
||||||
}
|
}
|
||||||
@@ -133,9 +135,9 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCertDetailV2(client: any, instanceId: string) {
|
async getOrderDetailV2(client: any, instanceId: string) {
|
||||||
const res = await client.doRequest({
|
const instanceDetail = await client.doRequest({
|
||||||
action: "GetUserCertificateDetail",
|
action: "GetInstanceDetail",
|
||||||
version: "2020-04-07",
|
version: "2020-04-07",
|
||||||
protocol: "HTTPS",
|
protocol: "HTTPS",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -144,19 +146,17 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
|
|||||||
pathname: `/`,
|
pathname: `/`,
|
||||||
data: {
|
data: {
|
||||||
query: {
|
query: {
|
||||||
CertId: instanceId,
|
InstanceId: instanceId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const crt = res.Cert;
|
const certificateId = instanceDetail.CertificateId;
|
||||||
const key = res.Key;
|
if (!certificateId) {
|
||||||
|
throw new Error(`未找到证书 ID,实例详情:${JSON.stringify(instanceDetail)}`);
|
||||||
|
}
|
||||||
|
|
||||||
return new CertReader({
|
return certificateId;
|
||||||
crt,
|
|
||||||
key,
|
|
||||||
csr: "",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCertificateState(client: any, orderId: any): Promise<{ CertId: string; Type: string; Domain: string }> {
|
async getCertificateState(client: any, orderId: any): Promise<{ CertId: string; Type: string; Domain: string }> {
|
||||||
|
|||||||
Reference in New Issue
Block a user