1 # ezhttp/src/auth: Authorization header values, pure. Kept apart from client.bend 2 # (which reaches the wire effect) so the proof gate can import it. 3 import Base 4 import ./http.bend as Http 5 import ./b64.bend as B64 6 7 # Authorization: Bearer … (RFC 6750) 8 def auth.bearer(token: String) -> Http.Header: 9 Http.H{"Authorization", "Bearer " ++ token} 10 11 # Authorization: Basic … (RFC 7617, credentials are RFC 4648 Base64) 12 def auth.basic(user: String, password: String) -> Http.Header: 13 Http.H{"Authorization", "Basic " ++ B64.b64.encode(user ++ ":" ++ password)}