2021-04-13 17:01:20 -04:00
|
|
|
/*
|
2022-01-31 13:07:22 -05:00
|
|
|
* Copyright (c) 2021, Tim Flynn <trflynn89@serenityos.org>
|
2021-04-13 17:01:20 -04:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-04-13 17:01:20 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/String.h>
|
|
|
|
|
#include <LibCore/DateTime.h>
|
2022-10-15 13:54:54 +02:00
|
|
|
#include <LibIPC/Forward.h>
|
2021-04-13 17:01:20 -04:00
|
|
|
|
|
|
|
|
namespace Web::Cookie {
|
|
|
|
|
|
2022-10-21 13:00:04 +02:00
|
|
|
enum class SameSite {
|
|
|
|
|
Default,
|
|
|
|
|
None,
|
|
|
|
|
Strict,
|
|
|
|
|
Lax
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-13 17:30:41 -04:00
|
|
|
enum class Source {
|
|
|
|
|
NonHttp,
|
|
|
|
|
Http,
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-13 17:01:20 -04:00
|
|
|
struct Cookie {
|
|
|
|
|
String name;
|
|
|
|
|
String value;
|
2022-10-21 13:00:04 +02:00
|
|
|
SameSite same_site;
|
2021-04-13 17:01:20 -04:00
|
|
|
Core::DateTime creation_time {};
|
|
|
|
|
Core::DateTime last_access_time {};
|
|
|
|
|
Core::DateTime expiry_time {};
|
|
|
|
|
String domain {};
|
|
|
|
|
String path {};
|
|
|
|
|
bool secure { false };
|
|
|
|
|
bool http_only { false };
|
|
|
|
|
bool host_only { false };
|
|
|
|
|
bool persistent { false };
|
|
|
|
|
};
|
|
|
|
|
|
2022-10-21 13:00:04 +02:00
|
|
|
StringView same_site_to_string(SameSite same_site_mode);
|
|
|
|
|
|
2021-04-13 17:01:20 -04:00
|
|
|
}
|
2022-10-15 13:54:54 +02:00
|
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
|
|
|
|
|
|
bool encode(Encoder&, Web::Cookie::Cookie const&);
|
|
|
|
|
ErrorOr<void> decode(Decoder&, Web::Cookie::Cookie&);
|
|
|
|
|
|
|
|
|
|
}
|