JavaScript

A collection of 5 articles

How to Verify JoyID WebAuthn Signature

JoyID is a multichain, cross-platform, passwordless and mnemonic-free wallet solution based on FIDO WebAuthn protocol and Nervos CKB. This post shows how to verify the signature from the method signChallenge of the @joyid/ckb package. The method reference page has a demo. I use the demo to obtain an example response then verify the response using the OpenSSL command line and the Python library PyCryptodome. The JoyID follows the WebAuthn specification and employs secp256r1 for signing. Although the guide references section 6.3.3 of the WebAuthn specification, titled “The authenticatorGetAssertion Operation”, I discovered that the example in this repository provided me much more helps.

Updated  •  5 min read

A trick to use just jasmine gem to test Javascript in Rails

Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a DOM. And it has a clean, obvious syntax so that you can easily write tests. It is very easy to integrate Jasmine into Rails, since the team provides the jasmine gem. The jasmine gem also supports assets pipeline, just prepend assets/ to file path. For example, app/assets/javascripts/application.js.coffee can be referred as assets/application.js in jasmine.yml src_files. However, spec_files does not support assets pipeline, so the files in spec/javascripts cannot be written in CoffeeScript. But if spec/javascripts is appended to assets pipeline paths, the spec files can be added to src_files in jasmine.yml. This post explains how to apply such trick, and how to integrate jasmine gem with guard-jasmine and travis. I also created a demo repository, see its commits for integration steps.

Updated  •  3 min read