initial commit

This commit is contained in:
ston1th 2016-09-06 19:57:41 +02:00
commit 09e12282d0
4 changed files with 396 additions and 0 deletions

25
jwt_test.go Normal file
View file

@ -0,0 +1,25 @@
package jwt
import (
"testing"
"time"
)
func TestValidate(t *testing.T) {
jwt, _ := New(0, true)
token := NewToken(HS256, map[string]interface{}{
"sub": "1234567890",
"name": "John Doe",
"admin": true,
"fizz": "buzz",
})
err := jwt.Sign(token)
t.Log(err, token)
nt, err := DecodeToken(token.Raw)
t.Log(nt, err)
time.Sleep(time.Second)
t.Log(jwt.Verify(nt))
jwt.Invalidate(nt)
t.Log(jwt.Verify(nt))
jwt.Stop()
}