Liking cljdoc? Tell your friends :D

clj-branca.core


+version+clj

The supported Branca token version.

The supported Branca token version.
sourceraw docstring

decodeclj

(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:

keydescription
nowThe current time as Inst or seconds since the UNIX epoch. Default: system time.
ttlToken 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 Inst or 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. |
sourceraw docstring

decode*clj

(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]].
sourceraw docstring

encodeclj

(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:

keydescription
nowThe token timestamp as Inst or 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 Inst or seconds since the UNIX epoch. Default: system time. |
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close