diff options
Diffstat (limited to 'src/backend.lisp')
-rw-r--r-- | src/backend.lisp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/backend.lisp b/src/backend.lisp index 0230b24..381c96c 100644 --- a/src/backend.lisp +++ b/src/backend.lisp @@ -33,3 +33,24 @@ object.")) vector. An additional 32-byte octet-vector SECRET can be provided in order to protect the data from attacks against convergent encryption.")) + +;; Default methods + +(defmethod fetch-data (read-capability (backend decoding-backend) &key &allow-other-keys) + (declare (type read-capability read-capability)) + (with-slots (fetch-function) backend + (eris-decode read-capability fetch-function))) + +(defmethod store-data (input (backend encoding-backend) &key (secret null-secret) (hash-output nil) &allow-other-keys) + (declare (type octet-vector secret)) + (with-slots (output-function) backend + (eris-encode input ;; According to ERIS spec recommendation. + (if (> (etypecase input + (stream (file-length input)) + (vector (length input))) + (* 2 16384)) + 32kib + 1kib) + output-function + :hash-output hash-output + :secret secret))) |