Note that you need to include the v in the version tag.
$ go get github.com/siaminz/[email protected]
package main
import (
"fmt"
"time"
vtoken "github.com/siaminz/go-vtoken"
)
func main() {
token, err := vtoken.New("[email protected]", time.Hour)
if err != nil {
panic(err)
}
fmt.Println(token)
id, err := vtoken.Verify(token)
if err != nil {
panic(err)
}
fmt.Println(id.GetIdentifier())
}
id.IsExpired()
Generate a token with custom length. this kind of tokens can't be verified.
package main
import (
"fmt"
"time"
vtoken "github.com/siaminz/go-vtoken"
)
func main() {
token := vtoken.GenerateSimpleToken(5)
fmt.Println(token)
}