Keep clients are applications such as arv-get
, arv-put
and arv-mount
which store and retrieve data from Keep. In doing so, these programs interact with both the API server (which stores file metadata in form of Collection objects) and individual Keep servers (which store the actual data blocks).
accessible
method on keep_servicesmanifest
which lists the blocks by MD5 hash and how to reassemble them into the original files.manifest_text
collection
object including manifest_text
from the APIs servermanifest_text
and returns it to the client.accessible
method on keep_servicesEach keep_service
resource has an assigned uuid. To determine priority assignments of blocks to servers, for each keep service compute the MD5 sum of the string concatenation of the block locator (hex-coded hash part only) and service uuid, then sort this list in descending order. Blocks are preferentially placed on servers with the highest weight.
The Keep server is accessed via a simple HTTP REST API.
GET /blocklocator+size+A@token
Fetch the data block. Response returns block contents. If permission checking is enabled, requires a valid token hint.
PUT /blocklocator
Body: the block contents. Responds the block locator consisting of MD5 sum of the data, block size, and signed token hint.
POST /
Body: the block contents. Responds the block locator consisting of MD5 sum of the data, block size, and signed token hint.
BNF notation for a valid Keep locator string (with hints). For example @d41d8cd98f00b204e9800998ecf8427e+0+Z+Ada39a3ee5e6b4b0d3255bfef95601890afd80709@53bed294@
locator ::= sized-digest hint* sized-digest ::= digest size-hint digest ::= <32 lowercase hexadecimal digits> size-hint ::= "+" [0-9]+ hint ::= "+" hint-type hint-content hint-type ::= [A-Z]+ hint-content ::= [A-Za-z0-9@_-]* sign-hint ::= "+A" <40 lowercase hexadecimal digits> "@" sign-timestamp sign-timestamp ::= <8 lowercase hexadecimal digits>
A token signature (sign-hint) provides proof-of-access for a data block. It is computed by taking a SHA1 HMAC of the blob signing token (a shared secret between the API server and keep servers), block digest, current API token, expiration timestamp, and blob signature TTL.
When communicating with the Keep store to fetch a block, or the API server to create or update a collection, the service computes the expected token signature for each block and compares it to the token signature that was presented by the client. Keep clients receive valid block signatures when uploading a block to a keep store (getting back a signed token as proof of knowledge) or, from the API server, getting the manifest text of a collection on which the user has read permission.
Security of a token signature is derived from the following characteristics:
/^([0-9a-f]{32})\+([0-9]+)(\+[A-Z][-A-Za-z0-9@_]*)*$/
d41d8cd98f00b204e9800998ecf8427e+0 |
d41d8cd98f00b204e9800998ecf8427e+0+Z |
d41d8cd98f00b204e9800998ecf8427e+0+Z+Ada39a3ee5e6b4b0d3255bfef95601890afd80709@53bed294 |
Why | |
d41d8cd98f00b204e9800998ecf8427e |
No size hint |
d41d8cd98f00b204e9800998ecf8427e+Z+0 |
Other hint before size hint |
d41d8cd98f00b204e9800998ecf8427e+0+0 |
Multiple size hints |
d41d8cd98f00b204e9800998ecf8427e+0+z |
Hint does not start with uppercase letter |
d41d8cd98f00b204e9800998ecf8427e+0+Zfoo*bar |
Hint contains invalid character * |
A manifest is utf-8 encoded text, consisting of zero or more newline-terminated streams.
manifest ::= stream* stream ::= stream-name (" " locator)+ (" " file-segment)+ "\n" stream-name ::= "." ("/" path-component)* path-component ::= <printable ASCII - (whitespace, "/")>+ file-segment ::= position ":" size ":" filename position ::= [0-9]+ size ::= [0-9]+ filename ::= path-component ("/" path-component)*
Notes:
"/"
.
"."
."/"
.":"
: position, size, filename."/"
characters, but must not start or end with "/"
, and must not contain "//"
."/"
) must not be "."
or ".."
.It is legal to have multiple file tokens in the manifest (possible across different streams) with the same combined path name stream name + "/" + filename
. This must be interpreted as a concatenation of file content, in the order that the file tokens appear in the manifest.
Spaces are represented by the escape sequence \040
. Spaces in stream names and filenames must be translated when reading and writing manifests. A manifest may not contain TAB characters, nor other ASCII whitespace characters or control codes other than the spaces or newlines used as delimiters specified above. A manifest always ends with a newline — except the empty (zero-length) string, which is a valid manifest.
A normalized manifest is a manifest that meets the following additional restrictions:
"/"
(the stream name represents the path prefix)A manifest with four files in two directories:
. 930625b054ce894ac40596c3f5a0d947+33 0:0:a 0:0:b 0:33:output.txt ./c d41d8cd98f00b204e9800998ecf8427e+0 0:0:d
The same manifest with permission signatures on each block:
. 930625b054ce894ac40596c3f5a0d947+33+A1f27a35dd9af37191d63ad8eb8985624451e7b79@5835c8bc 0:0:a 0:0:b 0:33:output.txt ./c d41d8cd98f00b204e9800998ecf8427e+0+A27117dcd30c013a6e85d6d74c9a50179a1446efa@5835c8bc 0:0:d
A manifest containing a file consisting of multiple blocks and a space in the file name:
. c449ed86671e4a34a8b8b9430850beba+67108864 09fcfea01c3a141b89dd0dcfa1b7768e+22534144 0:89643008:Docker\040image.tar
The content of this documentation is licensed under the
Creative
Commons Attribution-Share Alike 3.0 United States licence.
Code samples in this documentation are licensed under the
Apache License, Version 2.0.