Tags: spruceid/siwe
Tags
ABNF parser rewrite (#213) * A complete re-write of the ABNF parser. Removed dependencies on uri-js and valid-url. Added many new unit tests for validating both the message URI and the resource URIs. Added a script to re-generate the ABNF grammar object whenever the ABNF grammar needs to be changed. * Updated package/siwe-parser. package.json: 1)the dependency on apg-js is the newly published version 4.4.0, 2)the script "apg" will generate a typescript grammar object from the ABNF grammar siwe-abnf.txt. Added an optional "doTrace" parameter to the constructor of ParsedMessage. The default is "false". If set to "true" apg-js will trace the parse tree of parsed message and write it to output/siwe-parser-trace.html. Consequently the output directory has been added to ".gitignore" and ".npmignore". * Committed four files missed in the last commit. * Modified the ABNF grammar and parser to match the spec for (present/empty/missing) statement/resources. * Added new function "isUri()" to "packages/siwe-parser/lib/abnf.ts". Added "packages/siwe-parser/lib/t-isUri.test.ts" for unit testing of the "isUri" function. Added tests in the object block of the “SiweMessage” constructor for testing the EIP-55 address, the URI and the resources URIs. Added “packages/siwe/lib/objects.test.ts” for unit testing of the object block. * Modifed the ParsedMessage callbacks to validate the semantics as well as the syntax of date times. Removed the SiweMessage private function validateMessage(). Replaced it in the message object block of the constructor by parsing the stringified message object. In this way both the message and the message object get exactly the same validation. Fixed a bug for the case of an empty statement in the function toMessage(). * Updated validation of date-times in ParsedMessage. Fixed message object validation in SiweMessage. * Removed debugging (doTrace) code from t-chars.test.ts". * Fixed siwe/lib/utils.ts bug. Converted all unit tests to JSON file methodology. * Removed a development-only script from siwe package.json. * remove commented code * fix invalid opts check * fix tests, SiweErrorType has no values, is not object * Fix test * Fix typos * Lint files * Typos * Upgrade to ES2018 * Remove deprecated method * Bump version * Bump siwe-parser version --------- Co-authored-by: Lowell D. Thomas <ldt@sabnf.com> Co-authored-by: Gregorio <greg.magalhaes@gmail.com>
PreviousNext