diff --git a/util/async.lisp b/util/async.lisp index b53ddbe..21c0550 100644 --- a/util/async.lisp +++ b/util/async.lisp @@ -13,9 +13,8 @@ ;;;; general definitions (eval-when (:compile-toplevel :load-toplevel :execute) - (progn - (when (not (boundp '+quit-message+)) - (defconstant +quit-message+ (gensym "QUIT"))))) + (when (not (boundp '+quit-message+)) + (defconstant +quit-message+ (gensym "QUIT")))) (defun init () (when (null lp:*kernel*) diff --git a/util/crypt.lisp b/util/crypt.lisp index 284ac30..09f6a19 100644 --- a/util/crypt.lisp +++ b/util/crypt.lisp @@ -11,8 +11,12 @@ (defun create-secret (&key (bytes 16) (scheme :uri)) (util:b64-encode (ironclad:random-data bytes) :scheme scheme)) -(defun digest (tx &key (scheme :original) (alg :sha256)) - (b64:encode-bytes (ironclad:digest-sequence alg (util:to-bytes tx)) :scheme scheme)) +(defun digest (tx &key (scheme :original) (alg :sha256) trim) + (let ((dig (b64:encode-bytes + (ironclad:digest-sequence alg (util:to-bytes tx)) :scheme scheme))) + (if trim + (str:trim-right dig :char-bag "=") + dig))) (defun sign (tx key) (let* ((binp (util:to-bytes tx))