Skip to content

Commit 7e48375

Browse files
committed
strict
1 parent de11b43 commit 7e48375

File tree

5 files changed

+177
-184
lines changed

5 files changed

+177
-184
lines changed

src/mods/ccadb/ccadb.macro.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Nullable } from "@hazae41/option"
1010
export namespace CCADB {
1111

1212
export interface Trusted {
13-
readonly publicKeyHex: string
13+
readonly certHex: string
1414
readonly notAfter?: string
1515
}
1616

@@ -40,16 +40,15 @@ export namespace CCADB {
4040
const x509 = X509.readAndResolveFromBytesOrThrow(X509.Certificate, pem)
4141

4242
const issuer = x509.tbsCertificate.issuer.toX501OrThrow()
43-
const publicKey = X509.writeToBytesOrThrow(x509.tbsCertificate.subjectPublicKeyInfo)
44-
const publicKeyHex = Buffer.from(publicKey).toString("hex")
43+
const certHex = Buffer.from(pem).toString("hex")
4544

4645
if (trusteds[issuer])
4746
console.warn(`Duplicate issuer: ${issuer}`)
4847

4948
if (notAfter)
50-
trusteds[issuer] = { notAfter, publicKeyHex }
49+
trusteds[issuer] = { notAfter, certHex }
5150
else
52-
trusteds[issuer] = { publicKeyHex }
51+
trusteds[issuer] = { certHex }
5352
} catch (e: unknown) {
5453
console.warn(e)
5554
}

0 commit comments

Comments
 (0)