@@ -39,6 +39,9 @@ func Setup(options Options, store PasswordStore) error {
39
39
ctx , cancel := context .WithCancel (context .Background ())
40
40
defer cancel ()
41
41
42
+ msg .Debug ("🔧" , fmt .Sprintf ("Yubikey: Device Serial: %s" , options .Device ))
43
+ msg .Debug ("🔧" , fmt .Sprintf ("Yubikey: OATH Account: %s" , options .Account ))
44
+
42
45
oathAccounts , err := ykmangoath .New (ctx , options .Device )
43
46
if err != nil {
44
47
return fmt .Errorf ("ykmangoat init: %w" , err )
@@ -135,6 +138,16 @@ func stateMachine(state State, op Operation) State {
135
138
}
136
139
}
137
140
msg .Debug ("🔓" , "Yubikey: OATH application not password protected" )
141
+
142
+ err := op .SetPassword ("" )
143
+ if err != nil {
144
+ msg .Warn ("⚠️" , fmt .Sprintf ("Yubikey: Could not configure empty password: %s" , err ))
145
+ return State {
146
+ Name : ERROR ,
147
+ Error : errors .New ("yubikey: could not configure empty password" ),
148
+ }
149
+ }
150
+
138
151
return State {
139
152
Name : CHECK_DEVICE_HAS_ACCOUNT ,
140
153
}
@@ -258,6 +271,7 @@ func stateMachine(state State, op Operation) State {
258
271
case CHECK_DEVICE_HAS_ACCOUNT :
259
272
has , err := op .HasAccount ()
260
273
if err != nil {
274
+ msg .Debug ("ℹ️" , fmt .Sprintf ("Yubikey: Failed to acquire account: %s" , err ))
261
275
return State {
262
276
Name : ERROR ,
263
277
Error : errors .New ("yubikey: could not read accounts" ),
@@ -270,6 +284,7 @@ func stateMachine(state State, op Operation) State {
270
284
Error : errors .New ("yubikey: account not found" ),
271
285
}
272
286
}
287
+ msg .Debug ("ℹ️" , "Yubikey: Account found" )
273
288
return State {
274
289
Name : DONE ,
275
290
}
0 commit comments