Skip to content

Commit b9a898a

Browse files
authoredDec 7, 2022
Add CI and update tests and dependencies (#21)
iso8601 isn't fully set up for v2 so using the HEAD of the main branch. v2 is necessary for proper validation. Close #20
1 parent fc1b037 commit b9a898a

File tree

5 files changed

+60
-571
lines changed

5 files changed

+60
-571
lines changed
 

‎.github/workflows/ci.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: ci
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
submodules: recursive
12+
- run: go test

‎go.mod

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ module github.com/spruceid/siwe-go
33
go 1.17
44

55
require (
6-
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5
7-
github.com/ethereum/go-ethereum v1.10.18
8-
github.com/relvacode/iso8601 v1.1.0
9-
github.com/stretchr/testify v1.7.0
6+
github.com/dchest/uniuri v1.2.0
7+
github.com/ethereum/go-ethereum v1.10.26
8+
github.com/relvacode/iso8601 v1.1.1-0.20210511065120-b30b151cc433
9+
github.com/stretchr/testify v1.8.1
1010
)
1111

1212
require (
13-
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
13+
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
1414
github.com/davecgh/go-spew v1.1.1 // indirect
15-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
15+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
1616
github.com/pmezard/go-difflib v1.0.0 // indirect
17-
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
18-
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect
19-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
17+
golang.org/x/crypto v0.4.0 // indirect
18+
golang.org/x/sys v0.3.0 // indirect
19+
gopkg.in/yaml.v3 v3.0.1 // indirect
2020
)

‎go.sum

+23-560
Large diffs are not rendered by default.

‎siwe_test.go

+15-1
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,15 @@ func parsingPositive(t *testing.T, cases map[string]interface{}) {
317317
}
318318
}
319319

320+
func contains(s []string, str string) bool {
321+
for _, v := range s {
322+
if v == str {
323+
return true
324+
}
325+
}
326+
return false
327+
}
328+
320329
func verificationNegative(t *testing.T, cases map[string]interface{}) {
321330
for name, v := range cases {
322331
data := v.(map[string]interface{})
@@ -327,7 +336,12 @@ func verificationNegative(t *testing.T, cases map[string]interface{}) {
327336
data["nonce"].(string),
328337
data,
329338
)
330-
assert.Nil(t, err)
339+
if contains([]string{"invalid issuedAt", "invalid expirationTime", "invalid notBefore"}, name) {
340+
assert.Error(t, err, name)
341+
continue
342+
} else {
343+
assert.Nil(t, err, name)
344+
}
331345

332346
var domainBinding *string
333347
if val, ok := data["domainBinding"]; ok {

0 commit comments

Comments
 (0)
Please sign in to comment.