mirror of
https://github.com/certd/certd.git
synced 2026-07-12 00:07:35 +08:00
21 lines
632 B
TypeScript
21 lines
632 B
TypeScript
|
|
import assert from "assert";
|
||
|
|
import { EabAccess } from "./eab-access.js";
|
||
|
|
|
||
|
|
describe("EabAccess", () => {
|
||
|
|
it("generates an account key payload for the current kid", async () => {
|
||
|
|
const access = new EabAccess();
|
||
|
|
access.kid = "kid-1";
|
||
|
|
|
||
|
|
const payload = JSON.parse(await access.onGenerateAccountKey());
|
||
|
|
|
||
|
|
assert.equal(payload.kid, "kid-1");
|
||
|
|
assert.match(payload.privateKey, /BEGIN (RSA )?PRIVATE KEY/);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("requires kid before generating the account key payload", async () => {
|
||
|
|
const access = new EabAccess();
|
||
|
|
|
||
|
|
await assert.rejects(() => access.onGenerateAccountKey(), /请先填写KID/);
|
||
|
|
});
|
||
|
|
});
|