Giter Club home page Giter Club logo

Comments (2)

MasterKale avatar MasterKale commented on July 20, 2024

A poll on Mastodon didn't help me choose between "change only a couple of files by keeping getWebCrypto() asynchronous" and "change a bunch of files by making getWebCrypto() synchronous because it doesn't need async anymore":

image

So I prepard two PRs:

  • #533 makes getWebCrypto() synchronous because it no longer needs to await import('node:crypto'). This spiders out into the codebase because a lot of async methods that called await getWebCrypto() no longer need to be async, and refactoring all of these pleases deno lint. This includes making generateRegistrationOptions() and generateAuthenticationOptions() synchronous, which technically makes this a breaking change (though there's no repercussion for awaiting a synchronous function in JavaScript so it's not as breaking a change as going from synchronous to asynchronous.)
  • #535 keeps getWebCrypto() asynchronous despite not needing to await anything. The scope of work is limited to getWebCrypto.ts and its corresponding getWebCrypt.test.ts.

Honestly I'm leaning towards #535 for what feels like an odd justification: not making generateRegistrationOptions() and generateAuthenticationOptions() synchronous means all four of the "core library API" methods (those two along with verifyRegistrationResponse() and verifyAuthenticationResponse()) remain asynchronous. Put another way, keeping getWebCrypto() asynchronous means there's no need to remember which core library methods need to be awaited or not because they all need to be await'd!

I'm gonna sleep on this for a few days and see what I settle on.

from simplewebauthn.

MasterKale avatar MasterKale commented on July 20, 2024

This change is now available in the recently-published @simplewebauthn/[email protected] ✌️

from simplewebauthn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.