PageRenderTime 30ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/src/core/signature.lisp

http://github.com/skypher/cl-oauth
Lisp | 26 lines | 21 code | 5 blank | 0 comment | 0 complexity | 016005060a04cb54390c3ba4e4f29020 MD5 | raw file
Possible License(s): LGPL-3.0
  1. (in-package :oauth)
  2. (defun signature-base-string (&key (uri (request-uri))
  3. (request-method (request-method))
  4. (parameters (normalized-parameters)))
  5. (concatenate 'string (string-upcase (princ-to-string request-method))
  6. "&" (url-encode
  7. (normalize-uri uri))
  8. "&" (url-encode
  9. (alist->query-string parameters
  10. :url-encode t
  11. :include-leading-ampersand nil))))
  12. (declaim (notinline hmac-key)) ; we want to trace this when debugging.
  13. (defun hmac-key (consumer-secret &optional token-secret)
  14. "9.2"
  15. (concatenate 'string (url-encode consumer-secret) "&" (url-encode (or token-secret ""))))
  16. (defun encode-signature (octets url-encode-p)
  17. "9.2.1"
  18. (let ((base64 (cl-base64:usb8-array-to-base64-string octets)))
  19. (if url-encode-p
  20. (url-encode base64)
  21. base64)))