Relocated the logic for authorizing clients into a separate package that the tokens server now depends on. Moving this helped me separate concerns. I removed a few top-level variables and tried to write more pure versions of the authorization functions to avoid leaking Monzo-specific details.
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			381 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			381 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
| {
 | |
|   depot ? import <depot> {},
 | |
|   briefcase ? import <briefcase> {},
 | |
|   ...
 | |
| }:
 | |
| 
 | |
| let
 | |
|   auth = depot.buildGo.package {
 | |
|     name = "auth";
 | |
|     srcs = [
 | |
|       ./auth.go
 | |
|     ];
 | |
|     deps = with briefcase.gopkgs; [
 | |
|       utils
 | |
|     ];
 | |
|   };
 | |
| in depot.buildGo.program {
 | |
|   name = "token-server";
 | |
|   srcs = [
 | |
|     ./tokens.go
 | |
|   ];
 | |
|   deps = with briefcase.gopkgs; [
 | |
|     kv
 | |
|     utils
 | |
|     auth
 | |
|   ];
 | |
| }
 |