File tree 2 files changed +7
-7
lines changed
2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export default function App() {
25
25
new AusweisAuthFlow ( {
26
26
debug : true ,
27
27
// Can set to true to allow simulator cards
28
- allowSimulatorCard : false ,
28
+ allowSimulatorCard : true ,
29
29
onEnterPin : ( { attemptsRemaining } ) => {
30
30
// Mock incorrect pin entry
31
31
return attemptsRemaining === 1 ? '123456' : '123123'
Original file line number Diff line number Diff line change @@ -246,16 +246,15 @@ export class AusweisAuthFlow {
246
246
if ( message . msg === 'READER' ) {
247
247
// If card is empty object the card is unknown, we see that as no card attached for this flow
248
248
const isSimulator = message . name === 'Simulator'
249
+
250
+ // Return early if simulator not allowed. As we don't want to emit events related to that
251
+ if ( isSimulator && ! this . options . allowSimulatorCard ) return
252
+
249
253
const isCardAttached =
250
254
message . attached &&
251
255
( isSimulator || ( message . card !== null && message . card !== undefined && Object . keys ( message . card ) . length > 0 ) )
252
256
253
257
if ( isSimulator ) this . isSimulatorCardAttached = isCardAttached
254
- console . log ( {
255
- isCardAttached,
256
- isSimulator,
257
- isSimulatorCardAttached : this . isSimulatorCardAttached ,
258
- } )
259
258
260
259
this . options . onCardAttachedChanged ?.( {
261
260
isCardAttached,
@@ -270,11 +269,12 @@ export class AusweisAuthFlow {
270
269
}
271
270
272
271
if ( message . msg === 'INSERT_CARD' ) {
273
- if ( this . options . allowSimulatorCard && this . isSimulatorCardAttached ) {
272
+ if ( this . options . allowSimulatorCard ) {
274
273
this . sendCommand ( {
275
274
cmd : 'SET_CARD' ,
276
275
name : 'Simulator' ,
277
276
} )
277
+ this . isSimulatorCardAttached = true
278
278
return
279
279
}
280
280
this . options . onAttachCard ?.( )
You can’t perform that action at this time.
0 commit comments