PeculiarVentures / x509

@peculiar/x509 is an easy to use TypeScript/Javascript library based on @peculiar/asn1-schema that makes generating X.509 Certificates and Certificate Requests as well as validating certificate chains easy
https://peculiarventures.github.io/x509/
MIT License
78 stars 10 forks source link

Library does not work in Safari web browser (desktop and iOS) #4

Closed WorldThirteen closed 3 years ago

WorldThirteen commented 3 years ago

Safari (desktop and iOS) does not support a negative look behind in the regular expression (caniuse). While such a feature is used in the next regular expression: https://github.com/PeculiarVentures/x509/blob/master/src/name.ts#L162. UPD: one more https://github.com/PeculiarVentures/x509/blob/master/src/name.ts#L186.

Safari throws a runtime error: SyntaxError: Invalid regular expression: invalid group specifier name.

Steps to reproduce:

  1. Create HTML with <script src="https://unpkg.com/@peculiar/x509"></script>
  2. Open it in the Safari browser (Version 14.0.2 (16610.3.7.1.9).
  3. See an error in the console, x509 object doesn't add to the global scope.
microshine commented 3 years ago

The problem is with Lookbehind expression

image

rmhrisk commented 3 years ago

http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript/comment-page-1

microshine commented 3 years ago

I published the new version 1.0.10

Try it