Documentation ¶
Overview ¶
Package branca implements the branca token specification.
See https://github.com/tuupola/branca-spec for details.
Although the standard specifies that tokens are base62-encoded, this package also provides access to the underlying data bytes so that they can be efficiently included in other byte-oriented formats.
Index ¶
- func Base62(data []byte) string
- type Branca
- func (b *Branca) Decode(token string) ([]byte, time.Time, error)
- func (b *Branca) DecodeRaw(data []byte) ([]byte, time.Time, error)
- func (b *Branca) Encode(payload []byte) string
- func (b *Branca) EncodeToRaw(payload []byte) []byte
- func (b *Branca) EncodeToRawAtTime(payload []byte, nonce [24]byte, t time.Time) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Branca ¶
type Branca struct {
// contains filtered or unexported fields
}
Branca encodes and decodes Branca tokens.
func New ¶
New returns a new Codec that encodes and decodes Branca tokens with the given 256-bit key.
func (*Branca) Decode ¶
Decode decodes a Branca token. It returns the decrypted payload and the associated timestamp of the token.
func (*Branca) DecodeRaw ¶
DecodeRaw is like Decode except that it decodes a Branca token that is not base62 encoded.
func (*Branca) EncodeToRaw ¶
EncodeToRaw is like Encode except that it returns the underlying encoded token instead of returning it base62-encoded.
func (*Branca) EncodeToRawAtTime ¶
EncodeToRawAtTime is like EncodeToRaw except that the created token will use the given timestamp and nonce.
Note that the Base62 function can be used to convert the returned value to a valid Branca token.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
basex
Package basex provides fast base encoding / decoding of any given alphabet using bitcoin style leading zero compression.
|
Package basex provides fast base encoding / decoding of any given alphabet using bitcoin style leading zero compression. |
fastuuid
Package fastuuid provides fast UUID generation of 192 bit universally unique identifiers.
|
Package fastuuid provides fast UUID generation of 192 bit universally unique identifiers. |