Differences From
Artifact [58f0eab21d]:
3 3 -- are tracked by storing an encrypted cookie which contains an authid,
4 4 -- a login epoch time, and a truncated hmac code authenticating both, all
5 5 -- encoded using Shorthand. we need functions to generate and parse these
6 6
7 7 local m = {
8 8 maxlen = lib.math.shorthand.maxlen*3 + 2;
9 9 maxage = 2 * 60 * 60; -- 2 hours
10 + cookiename = 'auth';
10 11 }
11 12
12 13 terra m.cookie_gen(secret: lib.mem.ptr(int8), authid: uint64, time: uint64, out: &int8): intptr
13 14 var ptr = out
14 15 ptr = ptr + lib.math.shorthand.gen(authid, ptr)
15 16 @ptr = @'.' ptr = ptr + 1
16 17 ptr = ptr + lib.math.shorthand.gen(time, ptr)