CCF
Loading...
Searching...
No Matches
actors.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
5#include <cstdint>
6#include <string>
7
8namespace ccf
9{
10 enum class ActorsType : uint64_t
11 {
12 members = 0,
13 users,
14 nodes,
16 // not to be used
18 };
19
20 inline bool is_valid_actor(const std::string& actor)
21 {
22 if (
23 actor != "gov" && actor != "app" && actor != "node" &&
24 actor != ".well-known/acme-challenge")
25 {
26 return false;
27 }
28 return true;
29 }
30
31 constexpr auto get_actor_prefix(ActorsType at)
32 {
33 switch (at)
34 {
36 {
37 return "gov";
38 }
40 {
41 return "app";
42 }
44 {
45 return "node";
46 }
48 {
49 return ".well-known/acme-challenge";
50 }
51 default:
52 {
53 return "";
54 }
55 }
56 }
57}
Definition app_interface.h:14
constexpr auto get_actor_prefix(ActorsType at)
Definition actors.h:31
bool is_valid_actor(const std::string &actor)
Definition actors.h:20
ActorsType
Definition actors.h:11