Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardsn committed Dec 1, 2023
1 parent 6a5e169 commit b65b1ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vc/vc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,11 @@ func TestCreateJWTVerifiableCredential(t *testing.T) {
func TestVerifiableCredential_ValidAt(t *testing.T) {
lll := time.Date(1999, 0, 0, 0, 0, 0, 0, time.UTC)
hhh := time.Date(2001, 0, 0, 0, 0, 0, 0, time.UTC)
skew := time.Hour * 24 * 365 * 3 // 3 years, time difference is 2 years

// no validity period is always true; includes missing IssuanceDate(.IsZero() == true)
assert.True(t, VerifiableCredential{}.ValidAt(time.Now(), 0))
assert.True(t, VerifiableCredential{}.ValidAt(time.Now(), skew))

// valid on bounds
assert.True(t, VerifiableCredential{IssuanceDate: &lll, ValidFrom: &lll}.ValidAt(lll, 0))
Expand All @@ -490,7 +492,6 @@ func TestVerifiableCredential_ValidAt(t *testing.T) {
assert.False(t, VerifiableCredential{ExpirationDate: &lll, ValidUntil: &hhh}.ValidAt(hhh, 0))

// invalid made valid
skew := time.Hour * 24 * 365 * 3 // 3 years, time difference is 2 years
assert.True(t, VerifiableCredential{IssuanceDate: &hhh, ValidFrom: &lll}.ValidAt(lll, skew))
assert.True(t, VerifiableCredential{IssuanceDate: &lll, ValidFrom: &hhh}.ValidAt(lll, skew))
assert.True(t, VerifiableCredential{ExpirationDate: &hhh, ValidUntil: &lll}.ValidAt(hhh, skew))
Expand Down

0 comments on commit b65b1ab

Please sign in to comment.