-
Notifications
You must be signed in to change notification settings - Fork 4
Feat: introduce pairing support for protecting against shoulder surfing #35
Conversation
208d0fa
to
f799cbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say this looks good. The new state machine makes sense to me. Your question regarding multiple plugins not just monitoring - but also changing - the state is a tough one. Let me know what you think about the idea I posted there. That way each callback (in this case only stateChange
) are then chained in the order of the use
calls. But this way any callback needs the next callback as an argument somehow (like middleware). Let me know if that's even feasible.
It's not approved yet because I want to test all plugins.
I see I left some notes double. I thought github would see that... Anyway, I deleted the double comments.. |
So, I tested the following cases:
Since the frontend determines if pairing should happen, the case where an old frontend talks with newer servers should not be that interesting. One little bug I found during testing in an application that re-uses the web-form of irma web for multiple sessions:
|
I'll fix this bug. |
Support for chained sessions
Changed printWidth of Linter to 120 to match with earlier conventions
Fix: minCheckingDelay is not performed when pairing is successful
Fixed stylelint error in irma-form.scss
Improved development instructions to run examples
Fixes #4
Release notes:
In this release, we introduce support for device pairing that can be enabled to prevent QR theft. When enabling this feature, an extra state is added between scanning a IRMA QR code and actually performing the session. In this state, a pairing code is visible in the IRMA app. The user should enter that pairing code in the frontend to continue.
For the following session types it is important that the right user scans the QR, since the session might contain sensitive information.
Furthermore, this release includes frontend support for chained sessions.
In order to use device pairing and chained sessions, your IRMA server should have version 0.8.0 or higher.
Global API changes
The changes below concern changes in behaviour of the exported methods of
irma-core
andirma-frontend
.Added
frontendRequest
within thesession
options ofirma-client
to deal withfrontendRequest
tokens received from the/session
endpoint of the IRMA server.frontendOptions
andpairing
configuration within thestate
options ofirma-client
to set the desired pairing behaviour and to configure the endpoints of the IRMA server API related to pairing.state
options ofirma-client
, the optionsurl
andlegacyUrl
have been added. With these options you can define a template how to build URLs to reach respectively the IRMA server's frontend endpoints and the IRMA server's legacy endpoints for status updates.Changed
close()
method, thestart()
method ofirma-core
now includes this value in the result on resolve. The exact format of this result can be found here. On Promise rejection, the error value remains unchanged.abort()
method returns a Promise now to indicate when aborting is being processed by the state machine. The plugins may take some extra time to close down, so the Promise fromstart()
and the Promise fromabort()
may not resolve at the same time.state
optionsserverSentEvents
andpolling
ofirma-client
, theurl
option has been replaced byendpoint
. The newurl
andlegacyUrl
options (see above) are used to actually build the URL.Changes in individual packages
The changes mentioned below are specific changes within individual packages. Changes in the API that concern the functioning of the
irma-frontend-packages
as a whole can be found in the global API changes section.TODO: Checken of local links (zoals in 'global API changes section') werken als de daadwerkelijke release wordt aangemaakt op GitHub.
irma-core
These changes are relevant for developers of custom plugins.
Added
EnterPairingCode
andPairing
in the state machine for the new pairing phase.PreparingQRCode
andPreparingIrmaButton
to enableirma-client
to correctly configure pairing at the IRMA server.PreparingResult
to be able to display a loading indicator when the session result is being fetched.selectTransition
in the state machine to select the transition you want the state machine to do.Changed
MediumContemplation
has been renamed toCheckingUserAgent
, because the responsibility for converting thesessionPtr
has been delegated toirma-client
/irma-dummy
. In the previous implementationirma-core
itself was responsible for the transitions in theMediumContemplation
state, which was not very clean.ShowingQRCode
andShowingQRCodeInstead
are now merged in one stateShowingQRCode
.close()
method of a custom plugin does not necessarily have to return a Promise anymore.transition
andfinalTransition
methods (see below) of the state machine return Promises now. This means they are not blocking anymore; you have to explicitly wait for completion. In this way, we can guarantee that the order of state changes is the same for all plugins.fail
anymore when the transition is invalid. As developer, you are now responsible yourself to select an alternative. This gives more control over the behaviour of the state machine.Deprecated
transition
andfinalTransition
methods of theirma-core
state machine are deprecated. Please useselectTransition
instead.Removed
appConnected
transition inirma-client
, so we removed thesucceed
transition from theShowingQRCode
andShowingIrmaButton
states now. This transition was only there to deal with this bug.fail
anymore, we removed the possibility to initiate afail
transition from theUninitialized
state. This transition became superfluous.getState
,isValidTransition
andisEndState
methods of the state machine are removed. Their return value is not reliable for the selection of a desired transition anymore. You can useselectTransition
instead. Below you can find some examples as a guide for refactoring your custom plugin.Fixed
stateChange
.irma-css
Added
EnterPairingCode
.Changed
irma-form
has rounded corners now.irma-client
Added
prepareQRCode
or theprepareButton
transition within theCheckingUserAgent
state. Checking the user agent was done byirma-core
first, but has been delegated to this plugin now.Changed
irma-core
state machine.Fixed
succeed
transition (nowprepareResult
transition) could already be initiated in theShowingQRCode
andShowingIrmaButton
state.irma-console
Added
EnterPairingCode
state)Changed
irma-core
state machine.Fixed
ShowingIrmaButton
. This state should not happen when usingirma-console
, since this can only occur on mobile.irma-web
Added
EnterPairingCode
state)Changed
irma-core
state machine.Aborted
state is mentioned in HTML comments (as already was the case for all other states).nl
), the lineEén moment alsjeblieft
has been replaced byEen moment alstublieft
andOpen IRMA app
is replaced byOpen IRMA-app
.irma-popup
On top of the changes mentioned below, the changes in
irma-web
also apply to this package.Fixed
close()
method ofirma-web
was not called when closing the pop-up.irma-dummy
Added
prepareQRCode
or theprepareButton
transition within theCheckingUserAgent
state. Checking the user agent was done byirma-core
first, but has been delegated to this plugin now.pairing
and themobile
flow.prepare
within thetiming
options to customize the time that preparing the session and the result should take.Changed
irma-core
state machine.