Skip to content

Commit

Permalink
fix: avoid invalid transaction errors
Browse files Browse the repository at this point in the history
The transaction must be ended before the connection is terminated
otherwise the card can get into a bad state.
  • Loading branch information
smlx committed Apr 11, 2023
1 parent 851fa59 commit a48e1a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions piv/piv.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ type YubiKey struct {

// Close releases the connection to the smart card.
func (yk *YubiKey) Close() error {
err1 := yk.h.Close()
err2 := yk.ctx.Close()
err1 := yk.ctx.Close()
err2 := yk.h.Close()
if err1 == nil {
return err2
}
Expand Down

0 comments on commit a48e1a1

Please sign in to comment.