test: check device identity pem blocks

This commit is contained in:
Shakker
2026-05-11 16:16:20 +01:00
parent d23fb1e708
commit 1067abc665
+8 -2
View File
@@ -94,8 +94,14 @@ describe("device identity crypto helpers", () => {
).toBe(true);
expect(stored.version).toBe(1);
expect(stored.deviceId).toBe(SWIFT_RAW_DEVICE_ID);
expect(stored.publicKeyPem).toEqual(expect.stringContaining("BEGIN PUBLIC KEY"));
expect(stored.privateKeyPem).toEqual(expect.stringContaining("BEGIN PRIVATE KEY"));
expect(typeof stored.publicKeyPem).toBe("string");
expect(typeof stored.privateKeyPem).toBe("string");
const publicKeyPem = stored.publicKeyPem as string;
const privateKeyPem = stored.privateKeyPem as string;
expect(publicKeyPem.startsWith("-----BEGIN PUBLIC KEY-----\n")).toBe(true);
expect(publicKeyPem.endsWith("-----END PUBLIC KEY-----\n")).toBe(true);
expect(privateKeyPem.startsWith("-----BEGIN PRIVATE KEY-----\n")).toBe(true);
expect(privateKeyPem.endsWith("-----END PRIVATE KEY-----\n")).toBe(true);
expect(stored.createdAtMs).toBe(1_700_000_000_000);
expect(stored).not.toHaveProperty("publicKey");
expect(stored).not.toHaveProperty("privateKey");