fidm / x509

Pure JavaScript X509 certificate tools for Node.js
https://fidm.github.io/x509/
MIT License
82 stars 15 forks source link

Type for `fromPEM` argument could be `Buffer | string` #5

Open brianmhunt opened 5 years ago

brianmhunt commented 5 years ago

Just a cosmetic typing note:

at https://github.com/fidm/x509/blob/master/src/x509.ts#L296 the data argument is converted via toString in https://github.com/fidm/asn1/blob/master/src/pem.ts#L44, so it seems like it could safely receive a string, and a more general parameter type could be Buffer | string i.e.

  static fromPEM (data: Buffer | string): Certificate {
    return Certificate.fromPEMs(data)[0]
  }