PeculiarVentures / PKI.js

PKI.js is a pure JavaScript library implementing the formats that are used in PKI applications (signing, encryption, certificate requests, OCSP and TSP requests/responses). It is built on WebCrypto (Web Cryptography API) and requires no plug-ins.
http://pkijs.org
Other
1.3k stars 204 forks source link

v3 upgrade notes / early feedback #353

Open gnarea opened 2 years ago

gnarea commented 2 years ago

I'm trying to upgrade to v3 (3.0.1-2) in one of our libs but I'm finding that many things are breaking and I'm finding that some upgrade notes would be really useful: For example, I was getting some weird transpilation errors because PKI.js v3 requires asn1js v3 but my library was still using asn1js v2. Is there anything else that would be good to know/do upfront, besides uninstalling @types/pkijs?

I have to pause this work for the next couple of weeks, but in the meantime I thought you might want to know that some types are missing (i.e., type any), at least compared to @types/pkijs:

I'm also getting about 50 type errors, but at least the handful I've checked so far seem to point to bugs in @types/pkijs: Optional attributes that @types/pkijs defined as required (like RecipientInfo.value, for example).

microshine commented 2 years ago

You are right. The new version of PKIjs uses the updated version of ASN1js. ASN1js was also migrated to TS.

@types/pkijs is old declaration and it may use wrong declarations. The new version creates definition file from TS source directly and it uses API from the v2. All tests use the same calls and test vectors. Most errors after v3 applying must be with type validation (eg optional fields, mixed types). Because the most popular type in JS version was any