The supported Branca token version.
The supported Branca token version.
(decode key token)
(decode key token options)
Decode token
as a Branca token using encryption key key
.
Returns the token payload as a byte array, or throws an ExceptionInfo with
:type
set to :clj-branca.core/invalid-token
in exception data.
The following options are available:
key | description |
---|---|
now | The current time as seconds since the UNIX epoch. Default: system time. |
ttl | Token time-to-live in seconds. If set, throws if the token has expired. Default: nil. |
Decode `token` as a Branca token using encryption key `key`. Returns the token payload as a byte array, or throws an ExceptionInfo with `:type` set to `:clj-branca.core/invalid-token` in exception data. The following options are available: | key | description | | --- | ------------| | now | The current time as seconds since the UNIX epoch. Default: system time. | | ttl | Token time-to-live in seconds. If set, throws if the token has expired. Default: nil. |
(decode* key token)
(decode* key token options)
Decode token
as a Branca token using encryption key key
.
Returns a map representing the token. If you just want the payload, use
decode
. If there's a problem, throws an ExceptionInfo with :type
set to
:clj-branca.core/invalid-token
in exception data.
Takes the same options as decode
.
Decode `token` as a Branca token using encryption key `key`. Returns a map representing the token. If you just want the payload, use [[decode]]. If there's a problem, throws an ExceptionInfo with `:type` set to `:clj-branca.core/invalid-token` in exception data. Takes the same options as [[decode]].
(encode key payload)
(encode key payload options)
Encode payload
as a Branca token using the encryption key key
.
key
should be a 32-byte byte array. payload
should be a byte array, a
string, or something that can be converted into a byte array using the
byte-streams library.
Returns the token as a string, or throws an ExceptionInfo with :type
set to
:clj-branca.core/encode-failure
in exception data.
The following options are available:
key | description |
---|---|
now | The token timestamp as seconds since the UNIX epoch. Default: system time. |
Encode `payload` as a Branca token using the encryption key `key`. `key` should be a 32-byte byte array. `payload` should be a byte array, a string, or something that can be converted into a byte array using the [byte-streams] library. [byte-streams]: https://github.com/aleph-io/byte-streams Returns the token as a string, or throws an ExceptionInfo with `:type` set to `:clj-branca.core/encode-failure` in exception data. The following options are available: | key | description | | --- | ------------| | now | The token timestamp as seconds since the UNIX epoch. Default: system time. |
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close