Skip to content

Commit 441c732

Browse files
committed
Removed unused code
1 parent ac70441 commit 441c732

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

packages/auto-id/src/certificateManager.ts

-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { Crypto } from '@peculiar/webcrypto'
1313
import * as x509 from '@peculiar/x509'
1414
import { KeyObject, createPublicKey } from 'crypto'
1515
import { doPublicKeysMatch, pemToPublicKey } from './keyManagement'
16-
import { randomSerialNumber } from './utils'
1716

1817
const crypto = new Crypto()
1918
x509.cryptoProvider.set(crypto)
@@ -67,10 +66,6 @@ export class CertificateManager {
6766
return new x509.Name([[commonNameAttr]])
6867
}
6968

70-
// protected static toCommonName(subjectName: string): JsonName {
71-
// return [{ '2.5.4.3': [subjectName] }] // OID for commonName
72-
// }
73-
7469
static prettyPrintCertificate(cert: x509.X509Certificate): void {
7570
console.log('Certificate:')
7671
console.log('============')
@@ -241,7 +236,6 @@ export class CertificateManager {
241236
notAfter.setDate(notBefore.getDate() + validityPeriodDays)
242237

243238
let certificateBuilder = await x509.X509CertificateGenerator.create({
244-
serialNumber: randomSerialNumber().toString(),
245239
issuer: csr.subject,
246240
subject: csr.subject,
247241
notBefore,

packages/auto-id/src/utils.ts

-10
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ export function derEncodeSignatureAlgorithmOID(oid: string): Uint8Array {
2323
return new Uint8Array([...sequenceHeader, ...new Uint8Array(berArrayBuffer), ...nullParameter])
2424
}
2525

26-
export function randomSerialNumber(): bigint {
27-
// Generate 20 random bytes
28-
const bytes = randomBytes(20)
29-
// Convert bytes to a BigInt
30-
let serial = BigInt('0x' + bytes.toString('hex'))
31-
// Shift right by 1 to ensure the number is positive
32-
serial = serial >> BigInt(1)
33-
return serial
34-
}
35-
3626
export function addDaysToCurrentDate(days: number): Date {
3727
const currentDate = new Date() // This gives you the current date and time
3828
currentDate.setUTCDate(currentDate.getUTCDate() + days) // Adds the specified number of days

0 commit comments

Comments
 (0)