opsick
include
opsick
user.h
Go to the documentation of this file.
1
/*
2
Copyright 2020 Raphael Beck
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
17
#ifndef OPSICK_USER_H
18
#define OPSICK_USER_H
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
30
#include <stdint.h>
31
#include <cecies/types.h>
32
36
struct
opsick_user_metadata
37
{
41
uint64_t
id
;
42
46
char
pw
[256];
47
51
char
totps
[48 + 1];
52
56
uint64_t
iat_utc
;
57
61
uint64_t
exp_utc
;
62
66
uint64_t
lastmod_utc
;
67
71
char
body_sha512
[128 + 1];
72
76
struct
cecies_curve25519_key
public_key_ed25519
;
77
81
char
encrypted_private_key_ed25519
[256];
82
86
struct
cecies_curve448_key
public_key_curve448
;
87
91
char
encrypted_private_key_curve448
[256];
92
};
93
99
static
inline
int
opsick_user_has_2fa_enabled
(
struct
opsick_user_metadata
* user_metadata)
100
{
101
if
(!user_metadata)
102
{
103
return
0;
104
}
105
106
for
(
int
i = 0; i <
sizeof
(user_metadata->
totps
); i++)
107
{
108
if
(user_metadata->
totps
[i] !=
'\0'
)
109
{
110
return
1;
111
}
112
}
113
114
return
0;
115
}
116
117
#ifdef __cplusplus
118
}
// extern "C"
119
#endif
120
121
#endif
// OPSICK_USER_H
opsick_user_metadata
Definition:
user.h:37
opsick_user_metadata::public_key_ed25519
struct cecies_curve25519_key public_key_ed25519
Definition:
user.h:76
opsick_user_metadata::iat_utc
uint64_t iat_utc
Definition:
user.h:56
opsick_user_metadata::lastmod_utc
uint64_t lastmod_utc
Definition:
user.h:66
opsick_user_metadata::totps
char totps[48+1]
Definition:
user.h:51
opsick_user_metadata::encrypted_private_key_ed25519
char encrypted_private_key_ed25519[256]
Definition:
user.h:81
opsick_user_metadata::pw
char pw[256]
Definition:
user.h:46
opsick_user_metadata::id
uint64_t id
Definition:
user.h:41
opsick_user_metadata::exp_utc
uint64_t exp_utc
Definition:
user.h:61
opsick_user_metadata::encrypted_private_key_curve448
char encrypted_private_key_curve448[256]
Definition:
user.h:91
opsick_user_metadata::body_sha512
char body_sha512[128+1]
Definition:
user.h:71
opsick_user_metadata::public_key_curve448
struct cecies_curve448_key public_key_curve448
Definition:
user.h:86
opsick_user_has_2fa_enabled
static int opsick_user_has_2fa_enabled(struct opsick_user_metadata *user_metadata)
Definition:
user.h:99
Generated by
1.9.2