handle pairing error when no available slots

This commit is contained in:
Andrea Franz 2019-03-27 13:05:07 +01:00
parent 00dc453676
commit 6b2868bd77
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D

View File

@ -12,6 +12,8 @@ import (
"github.com/status-im/keycard-go/types"
)
var ErrNoAvailablePairingSlots = errors.New("no available pairing slots")
type CommandSet struct {
c types.Channel
sc *SecureChannel
@ -93,6 +95,10 @@ func (cs *CommandSet) Pair(pairingPass string) error {
cmd := NewCommandPairFirstStep(challenge)
resp, err := cs.c.Send(cmd)
if resp.Sw == SwNoAvailablePairingSlots {
return ErrNoAvailablePairingSlots
}
if err = cs.checkOK(resp, err); err != nil {
return err
}