Documentation
¶
Index ¶
Constants ¶
View Source
const ( // PayloadSize defines how many bytes there are in payload PayloadSize = UnixTimestampSize + TokenAudienceSize // PayloadBase64Size is size of Payload in Base64 format(with padding) PayloadBase64Size = (PayloadSize + 2) / 3 * 4 )
View Source
const ( // SignatureSize is size of token signature SignatureSize = sha256.Size // SignatureBase64Size is size of Signature in Base64 format(with padding) SignatureBase64Size = (SignatureSize + 2) / 3 * 4 )
View Source
const ( // SignedSize is size of signed token SignedSize = SignatureSize + PayloadSize // SignedBase64Size is size of Signed token in Base64 format(with padding) SignedBase64Size = (SignedSize + 2) / 3 * 4 )
View Source
const ( // AuthorizationCodeDuration defines expire duration for Authorization Code AuthorizationCodeDuration = time.Minute * 10 // AccessTokenDuration defines expire duration for Access Token AccessTokenDuration = time.Hour // TokenAudienceSize is fixed size of Audience in Token TokenAudienceSize = 36 // UnixTimestampSize says how many bytes there are required to store single unix timestamp UnixTimestampSize = 32 / 8 )
Variables ¶
This section is empty.
Functions ¶
func ExtractHeaderToken ¶
ExtractHeaderToken extracts Bearer authorization token
Types ¶
type Parsed ¶
type Parsed struct { // Audience Must have fixed size of TokenAudienceSize Audience []byte // ExpiresAt is unix timestamp ExpiresAt uint32 }
Parsed is parsed token
type Payload ¶
type Payload [PayloadSize]byte
Payload is payload of token
func NewPayloadFromBase64 ¶
NewPayloadFromBase64 parses base64 payload and returns Payload
type Signature ¶
type Signature [SignatureSize]byte
Signature is only signature of token
func NewSignatureFromBase64 ¶
NewSignatureFromBase64 parses base64 signature and returns Signature
type Signed ¶
type Signed [SignedSize]byte
Signed is signed token
func NewSignedFromBase64 ¶
NewSignedFromBase64 parses base64 and returns it in signed format
func NewSignedFromBase64WithVerify ¶
NewSignedFromBase64WithVerify parses base64 and returns it in signed format and also verifies if its valid
Click to show internal directories.
Click to hide internal directories.