From 9fd2e16b68e1a83e2605e8a9cbd9b6d04a4da2f6 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 4 Oct 2026 12:46:34 +0100 Subject: Take an app's requests only with a token its tokens file grants (017, 3b) An app given a tokens file (tokens=FILE in --apps, --tokens FILE for the one app of a host) answers a request only when it bears a token (Authorization: Bearer) whose SHA-256 the file lists with a grant: read for its views, queries and documents, write for all, input=NAME for those inputs alone; 401 unauthorized (WWW-Authenticate: Bearer) without one, 403 forbidden past its grant. A delivery sealed by a key --sender names needs none. The digests are compared in constant time; a connection keeps its last token's digest, so the same token is hashed once. SHA-256 is the host's own (serve/sha256.c), no OpenSSL loaded. A reading puts a changed tokens file in place with the app running on; a file that is not one stops the app. pure-serve --make-token GRANT makes a token and its line. load takes PURE_LOAD_TOKEN. --- serve/sha256.h | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 serve/sha256.h (limited to 'serve/sha256.h') diff --git a/serve/sha256.h b/serve/sha256.h new file mode 100644 index 0000000..e525683 --- /dev/null +++ b/serve/sha256.h @@ -0,0 +1,8 @@ +#ifndef PURE_SHA256_H +#define PURE_SHA256_H +#include + +/* SHA-256 (FIPS 180-4) of size bytes: an app's tokens are kept as these + * (docs/design/017's 3b), with no OpenSSL loaded to check them. */ +void pure_sha256(const void *data, size_t size, unsigned char out[32]); +#endif -- cgit v1.2.3