mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-03 23:15:52 +00:00
40 lines
904 B
C++
40 lines
904 B
C++
#pragma once
|
|
#include <optional>
|
|
#include <string>
|
|
#include <functional>
|
|
#include "address.hpp"
|
|
#include "handler.hpp"
|
|
|
|
namespace llarp::service
|
|
{
|
|
/// authentication status
|
|
enum AuthResult
|
|
{
|
|
/// explicitly accepted
|
|
eAuthAccepted = 0,
|
|
/// explicitly rejected
|
|
eAuthRejected = 1,
|
|
/// attempt failed
|
|
eAuthFailed = 2,
|
|
/// attempt rate limited
|
|
eAuthRateLimit = 3,
|
|
/// need mo munny
|
|
eAuthPaymentRequired = 4
|
|
};
|
|
|
|
/// maybe get auth result from string
|
|
std::optional<AuthResult>
|
|
ParseAuthResult(std::string data);
|
|
|
|
struct IAuthPolicy
|
|
{
|
|
~IAuthPolicy() = default;
|
|
|
|
/// asynchronously determine if we accept new convotag from remote service, call hook with
|
|
/// result later
|
|
virtual void
|
|
AuthenticateAsync(
|
|
service::Address from, service::ConvoTag tag, std::function<void(AuthResult)> hook) = 0;
|
|
};
|
|
} // namespace llarp::service
|