Liking cljdoc? Tell your friends :D

ring-discord-auth.core


authentic?clj

(authentic? signature body timestamp public-key charset-name)

Checks whether a signature from a Discord interaction is authentic.

Takes a signature (byte array or hex string), public key (byte array, hex string or verifier), body (byte array or string), timestamp (byte array or string). It combines timestamp and body and uses that as the message.

Returns true if the message is authentic, false if not.

Checks whether a signature from a Discord interaction is authentic.

Takes a signature (byte array or hex string), public key (byte array, hex string or verifier), body (byte array or string), timestamp (byte array or string).
It combines timestamp and body and uses that as the message.

Returns `true` if the message is authentic, `false` if not.
sourceraw docstring

encodeclj

(encode str charset-name)

Encodes the given string to a byte array using the given charset/encoding.

Returns nil if the charset is not available or if it doesn't support encoding.

Encodes the given string to a byte array using the given charset/encoding.

Returns `nil` if the charset is not available or if it doesn't support encoding.
sourceraw docstring

examplescljmacro

(examples f equals & example-calls)

Macro to generate illustrative tests for a function based on input-output pairs.

f is the function to test. equals is the function used to compare the expected and actual result. Each example call is a sequence where the first n - 1 items are the inputs and the last item is the expected output.

Macro to generate illustrative tests for a function based on input-output pairs.

`f` is the function to test.
`equals` is the function used to compare the expected and actual result.
Each example call is a sequence where the first n - 1 items are the inputs and the last item is the expected output.
sourceraw docstring

hex->bytesclj

(hex->bytes hex-str)

Converts the given string representing a hexadecimal number to a byte array.

Each byte in the resulting array comes from 2 digits in the string. If the string cannot be converted, returns nil

Converts the given string representing a hexadecimal number to a byte array.

Each byte in the resulting array comes from 2 digits in the string.
If the string cannot be converted, returns `nil`
sourceraw docstring

if-let-allcljmacro

(if-let-all bindings then)
(if-let-all bindings then else)

Utility-macro - like if-let, but with multiple bindings that are all tested.

Utility-macro - like `if-let`, but with multiple bindings that are all tested.
sourceraw docstring

new-verifierclj

(new-verifier public-key)

Return new instance of Ed25519Signer initialized by public key.

Return new instance of `Ed25519Signer` initialized by public key.
sourceraw docstring

public-key->signer-verifierclj

(public-key->signer-verifier public-key)

Takes a public key as hex string, byte array, Ed25519PublicKeyParameters or Ed25519Signer.

Returns an instance of Ed25519Signer.

Takes a public key as hex string, byte array, Ed25519PublicKeyParameters or Ed25519Signer.

Returns an instance of `Ed25519Signer`.
sourceraw docstring

read-all-bytesclj

(read-all-bytes input)

Reads all bytes from either an InputStream or a ByteBuffer.

If an InputStream is provided, it will be consumed, but not closed. Returns its result as a new byte array.

Reads all bytes from either an `InputStream` or a `ByteBuffer`.

If an `InputStream` is provided, it will be consumed, but not closed.
Returns its result as a *new* byte array.
sourceraw docstring

verifyclj

(verify signer msg-bytes signature)

Verify signature for a message byte array.

Takes a signature, a message and a public key Ed25519Signer verifier obtained by new-verifier and checks the authenticity.

Returns true if the signature is valid and false if not.

Verify signature for a message byte array.

Takes a signature, a message and a public key `Ed25519Signer` verifier obtained by [[new-verifier]] and checks the authenticity.

Returns `true` if the signature is valid and `false` if not.
sourceraw docstring

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

× close