Closed ivard closed 3 years ago
To help understanding the state machine, I made a quick and ugly state machine diagram of the new situation:
(Edit: I added the pairingRejected
transition, which I was forgotten)
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:
any app (old/new) + an old irma server that doesn't support pairing.
Outcome: Frontend requests pairing, but the IRMA server does not give either a frontendAuth
or a pairingHint
. Frontend and apps skip pairing altogether.
an old app + new irma server. Outcome: IRMA server does not output the pairing state during the session because protocol negotiation. Pairing is skipped.
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:
One little bug I found during testing in an application that re-uses the web-form of irma web for multiple sessions:
- The text field listener is still registered to the completed session and it tries to transition from the success state once a code meant for the second session is entered.
I'll fix this bug.
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.The
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.// Old if (this._stateMachine.isValidTransition('fail')) this._stateMachine.transition('fail'); // New this._stateMachine.selectTransition( ({validTransitions}) => validTransitions.includes('fail') ? { transition: 'fail' } : false );
// Old if (!this._stateMachine.isEndState()) this._stateMachine.transition('abort'); // New this._stateMachine.selectTransition( ({inEndState}) => inEndState ? false : { transition: 'abort' } );