writeCookies

This commit is contained in:
Tobe O 2019-08-16 09:02:59 -04:00
parent 0d38f9e567
commit 9c83923324

View file

@ -9,6 +9,8 @@ class CookieSigner {
CookieSigner(List<int> keyBytes, {Hash hash})
: hmac = Hmac(hash ?? sha256, keyBytes);
CookieSigner.fromHmac(this.hmac);
factory CookieSigner.fromStringKey(String key, {Hash hash}) {
if (key.length != 32) {
throw ArgumentError.value(key, 'key', 'must have a length of 32');
@ -16,5 +18,14 @@ class CookieSigner {
return CookieSigner(utf8.encode(key), hash: hash);
}
CookieSigner.fromHmac(this.hmac);
Iterable<Cookie> readCookies(RequestContext req) {}
void writeCookies(ResponseContext res, Iterable<Cookie> cookies) {
for (var cookie in cookies) {
signCookie(cookie);
res.cookies.add(cookie);
}
}
void signCookie(Cookie cookie) {}
}