From 2e54681af0bc76ed22ce43f8126a029e600ece93 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 21 Feb 2022 07:34:55 +0300 Subject: Add a module for IndieAuth bearer token auth require_token() uses a token endpoint URI and an HTTP client to query the token endpoint and return a User object if the user was authorized, or rejecting with IndieAuthError if not. It is recommended to use recover() and catch the IndieAuthError at the application level to show a "not authorized" error message to the user. This function is more intended for API consumption, but is general enough to permit using in other scenarios. TODO: make a variant that returns Option instead of rejecting --- flake.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 18d9751..c1827cd 100644 --- a/flake.nix +++ b/flake.nix @@ -187,14 +187,17 @@ }; rust-bin = pkgs.rust-bin.stable.latest; packages = { - kittybox = { stdenv, lib, redis, naersk-lib }: + kittybox = { stdenv, lib, openssl, pkg-config, naersk-lib }: naersk-lib.buildPackage { pname = "kittybox"; version = "0.1.0"; src = ./.; - checkInputs = [ redis ]; + checkInputs = [ openssl.dev ]; + nativeBuildInputs = [ pkg-config ]; + nativeCheckInputs = [ pkg-config ]; + doCheck = stdenv.hostPlatform == stdenv.targetPlatform; meta = with lib.meta; { @@ -259,9 +262,10 @@ name = "rust-dev-shell"; nativeBuildInputs = with pkgs; [ pkg-config lld + # required for httpmock, not actually used + openssl.dev (rust-bin.default.override { extensions = [ "rust-src" ]; }) (rust-analyzer.override { rustPlatform = with rust-bin; { rustLibSrc = rust-src; }; }) - redis ]; }; }); -- cgit 1.4.1