{"modulePath":"github.com/Coding/drone","version":"v0.4.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package token\n\n## Constants\n\n```go\nconst (\n\tUserToken  = \"user\"\n\tSessToken  = \"sess\"\n\tHookToken  = \"hook\"\n\tCsrfToken  = \"csrf\"\n\tAgentToken = \"agent\"\n)\n```\n\n```go\nconst SignerAlgo = \"HS256\"\n```\nDefault algorithm used to sign JWT tokens.\n\n## Functions\n\n```go\nfunc CheckCsrf(r *http.Request, fn SecretFunc) error\n```\n\n## Types\n\n```go\ntype SecretFunc func(*Token) (string, error)\n```\n\n```go\ntype Token struct {\n\tKind string\n\tText string\n}\n```\n\n```go\nfunc New(kind, text string) *Token\n```\n\n```go\nfunc Parse(raw string, fn SecretFunc) (*Token, error)\n```\n\n```go\nfunc ParseRequest(r *http.Request, fn SecretFunc) (*Token, error)\n```\n\n```go\nfunc (t *Token) Sign(secret string) (string, error)\n```\nSign signs the token using the given secret hash and returns the string value.\n\n```go\nfunc (t *Token) SignExpires(secret string, exp int64) (string, error)\n```\nSign signs the token using the given secret hash with an expiration date.\n\n","path":"github.com/Coding/drone/shared/token","name":"token","synopsis":"","isRedistributable":true}
