Liking cljdoc? Tell your friends :D

ring-discord-auth.ring

Core namespace containing functions to handle bytes, encodings and Discord authentication

Core namespace containing functions to handle bytes, encodings and Discord authentication
raw docstring

default-charsetclj

source

default-headersclj

source

signature-headerclj

source

timestamp-headerclj

source

wrap-authenticateclj

(wrap-authenticate handler public-key)

Ring middleware to authenticate incoming requests according to the Discord specification.

This means:

  • If request method is not POST, respond with status 405 (Method Not Allowed)
  • Get body from the request as well as signature-header and timestamp-header from the headers
  • If any of the above is not present, respond with status 400 (Bad Request)
  • Check the parameters for authenticity as defined by Discord
    • If authentic, delegate to the handler with a restored body
    • If not authentic, respond with status 401 (Unauthorized)

The public-key is the public key of the corresponding Discord app. It may be given as something that is accepted by core/public-key->signer-verifier. This middleware must be in the hierarchy before the body is processed.

This middleware supports both synchronous and asynchronous handlers.

Ring middleware to authenticate incoming requests according to the Discord specification.

This means:
- If request method is not POST, respond with status 405 (Method Not Allowed)
- Get body from the request as well as [[signature-header]] and [[timestamp-header]] from the headers
- If any of the above is not present, respond with status 400 (Bad Request)
- Check the parameters for authenticity as defined by Discord
  - If authentic, delegate to the `handler` with a restored body
  - If not authentic, respond with status 401 (Unauthorized)

The `public-key` is the public key of the corresponding Discord app. It may be given as something that is accepted by [[core/public-key->signer-verifier]].
This middleware must be in the hierarchy **before** the body is processed.

This middleware supports both synchronous and asynchronous handlers.
sourceraw docstring

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

× close