Kip
Sign-in gateway
Sign people in to Kip through your own gateway instead of the office password.
With KIP_GATEWAY_SECRET set, a gateway in front of Kip (your own sign-in system, for example) can sign people in by adding three headers to each request it forwards. The office password keeps working alongside it.
KIP_GATEWAY_SECRET=at-least-32-random-characters-shared-only-with-the-gatewayWithout the setting, these headers are ignored.
The headers
| Header | Value |
|---|---|
x-kip-gateway-user | The person's name, base64url-encoded. |
x-kip-gateway-ts | The time, in milliseconds since 1970. |
x-kip-gateway-sig | HMAC-SHA256 with the secret, over user.ts.METHOD.path |
user is the base64url name as sent, METHOD is the HTTP method in capitals, and path includes the query string. Requests more than 60 seconds old are refused. The exact encoding is gatewaySignature in packages/core; use it if your gateway runs on Node.js:
import { gatewaySignature } from "@quietrobot/kip-core";
const user = Buffer.from("Dana").toString("base64url");
const ts = String(Date.now());
headers["x-kip-gateway-user"] = user;
headers["x-kip-gateway-ts"] = ts;
headers["x-kip-gateway-sig"] = gatewaySignature(process.env.KIP_GATEWAY_SECRET!, user, ts, req.method, url.pathname + url.search);The person's name appears in the activity log as usual.
Keep it safe
- Put Kip where only the gateway can reach it if you can. If not, use HTTPS between them.
- Kip refuses form posts whose
Originnames another host. Behind a gateway, Kip sees the gateway's address, not the public one. The gateway must check that form posts come from its own site, then either pass the publicHostthrough unchanged or drop theOriginheader.