mirror of
https://github.com/certd/certd.git
synced 2026-07-09 06:07:37 +08:00
feat: 支持dns-persist-01持久化验证方式申请证书,优化Acme账号的存储方式
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import assert from "assert";
|
||||
import { CertApplyPlugin } from "./apply.js";
|
||||
|
||||
describe("CertApplyPlugin dns-persist verify plan", () => {
|
||||
it("keeps dns-persist entries when building mixed domain verify plans", async () => {
|
||||
const plugin: any = new CertApplyPlugin();
|
||||
plugin.acme = {
|
||||
options: {
|
||||
domainParser: {
|
||||
async parse(domain: string) {
|
||||
return domain;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const plan = await plugin.createDomainsVerifyPlan(
|
||||
["*.handfree.work"],
|
||||
{
|
||||
"handfree.work": {
|
||||
domain: "handfree.work",
|
||||
type: "dns-persist",
|
||||
dnsPersistVerifyPlan: {
|
||||
"handfree.work": {
|
||||
domain: "handfree.work",
|
||||
status: "valid",
|
||||
hostRecord: "_validation-persist",
|
||||
recordValue: "letsencrypt.org; accounturi=https://acme.example/acct/1; policy=wildcard",
|
||||
accountUri: "https://acme.example/acct/1",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
accountKey: "private-key",
|
||||
accountUri: "https://acme.example/acct/1",
|
||||
caType: "letsencrypt_staging",
|
||||
email: "user@example.com",
|
||||
directoryUrl: "https://acme-staging-v02.api.letsencrypt.org/directory",
|
||||
}
|
||||
);
|
||||
|
||||
assert.equal(plan["handfree.work"].type, "dns-persist");
|
||||
assert.equal(plan["handfree.work"].dnsPersistVerifyPlan?.hostRecord, "_validation-persist");
|
||||
assert.equal(plan["handfree.work"].dnsPersistVerifyPlan?.recordValue, "letsencrypt.org; accounturi=https://acme.example/acct/1; policy=wildcard");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user