26 lines
934 B
C
26 lines
934 B
C
#ifndef DEPLOYD_AUTH_H_
|
|
#define DEPLOYD_AUTH_H_
|
|
|
|
#include "conf.h"
|
|
|
|
#include "def.h"
|
|
#include "blake2s.h"
|
|
|
|
#define DP_AUTH_SECRET_SIZE 24
|
|
#define DP_AUTH_KEY_SIZE 32
|
|
#define DP_AUTH_TOKEN_SIZE 16
|
|
|
|
bool dp_auth_gen_token(uint8_t out[DP_AUTH_TOKEN_SIZE],
|
|
uint64_t timestamp,
|
|
const uint8_t secret_key[DP_AUTH_SECRET_SIZE]);
|
|
bool dp_auth_gen_secret(uint8_t secret[DP_AUTH_SECRET_SIZE],
|
|
uint8_t key[DP_AUTH_KEY_SIZE],
|
|
uint64_t *timestamp);
|
|
bool dp_auth_verify_token(const uint8_t secret[DP_AUTH_SECRET_SIZE],
|
|
uint64_t timestamp,
|
|
const uint8_t given_token[DP_AUTH_SECRET_SIZE]);
|
|
bool dp_auth_verify_key(const uint8_t key[DP_AUTH_SECRET_SIZE],
|
|
uint64_t timestamp,
|
|
const uint8_t given_token[DP_AUTH_SECRET_SIZE]);
|
|
|
|
#endif /* DEPLOYD_AUTH_H_ */
|