Comments (2)
The check for if the type is known or not in the two sections of the code is done for robustness and future proofing.
Each function knows what it is able to process or not independently of the other. This means that if additional Ctrl states were added to u2f.DecodeAuthenticatorRequest
it wouldn't break the assumptions of ctapkey.handleAuthenticate
.
If this were written in a language like rust we could enforce this safety at the language layer by using a proper enum and an enforced check that we handle all values of that enum. But we don't have that in Go so we write a bit of extra code to gain that safety.
In terms of when we send a response, U2F is a polling protocol that has short timeouts and retries baked into it. The browser isn't expecting a response until the authenticator has something interesting to report.
But also, we are under no obligation to respond to requests we don't understand or that break the state machine. If something is broken a log message in the authenticator application will be able to provide more useful information to the user than a generic error back to the browser or the relying party.
from ctapkey.
Thanks for the clarifications! this made sense to me: "we are under no obligation to respond to requests we don't understand or that break the state machine. " Closing this.
from ctapkey.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ctapkey.