/**
 * \file pw_handle.h
**/
#ifndef PW_HANDLE_H
#define PW_HANDLE_H

#include <stdint.h>
#include <stdbool.h>

#define HANDLE_FLAG_THROTTLE_SECURE 1
#define HANDLE_VERSION_THROTTLE 2

typedef uint64_t secure_id_t;
typedef uint64_t salt_t;

/**
 * structure for easy serialization
 * and deserialization of password handles.
 */
static const uint8_t HANDLE_VERSION = 2;

typedef struct __attribute__ ((__packed__)) {
    /* fields included in signature */
    uint8_t version;
    secure_id_t user_id;
    uint64_t flags;
    /* fields not included in signature */
    salt_t salt;
    uint8_t signature[32];
    bool hw_backed;
} passw_handle_t;

#endif /* PW_HANDLE_H */
