writeCookies
This commit is contained in:
parent
0d38f9e567
commit
9c83923324
1 changed files with 12 additions and 1 deletions
|
@ -9,6 +9,8 @@ class CookieSigner {
|
||||||
CookieSigner(List<int> keyBytes, {Hash hash})
|
CookieSigner(List<int> keyBytes, {Hash hash})
|
||||||
: hmac = Hmac(hash ?? sha256, keyBytes);
|
: hmac = Hmac(hash ?? sha256, keyBytes);
|
||||||
|
|
||||||
|
CookieSigner.fromHmac(this.hmac);
|
||||||
|
|
||||||
factory CookieSigner.fromStringKey(String key, {Hash hash}) {
|
factory CookieSigner.fromStringKey(String key, {Hash hash}) {
|
||||||
if (key.length != 32) {
|
if (key.length != 32) {
|
||||||
throw ArgumentError.value(key, 'key', 'must have a length of 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);
|
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) {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue