JSON Web Signature (JWS) is a signing part of Json Web Token (JWT) specification and represents a content secured with digital signatures or Message Authentication Codes (MACs) using JavaScript Object Notation (JSON) as serialization format.
In difference to JWT, this is more lowlevel signing primitive and allows signining arbitrary binary data (instead of json formated claims):
(require '[buddy.sign.jws :as jws])
(require '[buddy.core.nonce :as nonce])
(require '[buddy.core.bytes :as bytes])
(def data (nonce/random-bytes 1024))
(def message (jws/sign data "secret"))
(bytes/equals? (jws/unsign message "secret") data)
;; => true
The supported algorightms are documented on the jwt document.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close