Differences From
Artifact [78b2aad470]:
2 2 -- sessions are implemented so as to avoid any local data storage. they
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 - maxage = 2 * 60 * 60; -- 2 hours
9 + maxage = 16 * 60 * 60; -- 16 hours
10 10 cookiename = 'auth';
11 11 }
12 12
13 13 terra m.cookie_gen(secret: lib.mem.ptr(int8), authid: uint64, time: uint64, out: &int8): intptr
14 14 var ptr = out
15 15 ptr = ptr + lib.math.shorthand.gen(authid, ptr)
16 16 @ptr = @'.' ptr = ptr + 1