diff --git a/go.mod b/go.mod index 4e12713..4eaf165 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/ebfe/scard v0.0.0-20190212122703-c3d1b1916a95 // indirect github.com/ethereum/go-ethereum v1.10.9 // indirect github.com/go-stack/stack v1.8.1 // indirect - github.com/status-im/keycard-go v0.0.0-20211006082725-f53d31ab34e1 // indirect + github.com/status-im/keycard-go v0.0.0-20211007082058-557c4c58b3bc // indirect golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect - golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef // indirect + golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac // indirect golang.org/x/text v0.3.7 // indirect ) diff --git a/go.sum b/go.sum index dcf9ca4..197713a 100644 --- a/go.sum +++ b/go.sum @@ -352,6 +352,8 @@ github.com/status-im/keycard-go v0.0.0-20210831111044-2e0f5457d2c4 h1:Cg9HFqCcXg github.com/status-im/keycard-go v0.0.0-20210831111044-2e0f5457d2c4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/keycard-go v0.0.0-20211006082725-f53d31ab34e1 h1:BFrOi1Kv6tIxuo3JYKCV8wurUROhX43ENaxFF4QKSO4= github.com/status-im/keycard-go v0.0.0-20211006082725-f53d31ab34e1/go.mod h1:EyC0vqnPRbDQGq3j4Ej9lSP/nKE8DwwjTwfQ0Yan6SQ= +github.com/status-im/keycard-go v0.0.0-20211007082058-557c4c58b3bc h1:/pr1gLtRHYIl5UUiDAmkVOTydLouWJv9W3WXYfUdxxo= +github.com/status-im/keycard-go v0.0.0-20211007082058-557c4c58b3bc/go.mod h1:EyC0vqnPRbDQGq3j4Ej9lSP/nKE8DwwjTwfQ0Yan6SQ= github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -511,6 +513,8 @@ golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 h1:uCLL3g5wH2xjxVREVuAbP9JM5 golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef h1:fPxZ3Umkct3LZ8gK9nbk+DWDJ9fstZa2grBn+lWVKPs= golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/main.go b/main.go index 172f33d..25e426c 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "time" "unsafe" + keycard "github.com/status-im/keycard-go" "github.com/status-im/nim-keycard-go/go/keycard/signal" ) @@ -181,6 +182,11 @@ func VerifyPin(jsonParams *C.char) *C.char { } err := kctx.verifyPin(params.Pin) + + if wrongPing, ok := err.(*keycard.WrongPINError); ok { + return retValue("error", err.Error(), "remainingAttempts", wrongPing.RemainingAttempts) + } + if err != nil { return retValue("error", err.Error()) }