home / secrets / src / core / secret.h

secret.h



//
//  secret.h
//  secrets
//
//  Created by Anders on 08/07/2020.
//

#ifndef secret_h
#define secret_h

#include <stdint.h>
#include <stdbool.h>

#define KEY_SIZE 32
#define SALT_SIZE 16
#define NONCE_SIZE 24
#define MAC_SIZE 16

typedef struct {
    uint8_t salt[SALT_SIZE];
    uint8_t nonce[NONCE_SIZE];
    uint8_t mac[MAC_SIZE];
    uint8_t* cipher;
    uint16_t cipher_size;
} Secret;

Secret* secret_from_line_alloc(const char *line);
void secret_free(Secret* secret);
char* secret_to_line_alloc(const Secret *secret);

#endif /* secret_h */