use chrono::prelude::*;
use thiserror::Error;
#[derive(Error, Debug)]
#[cfg_attr(feature = "use_serde", derive(serde::Serialize, serde::Deserialize))]
pub enum LKCError {
#[error("Empty data error")]
ErrEmptyData,
#[error("Bad value")]
ErrBadValue,
#[error("Not found")]
ErrNotFound,
#[error("Not initialized")]
ErrNoInit,
#[error("Type mismatch")]
ErrTypeMismatch,
#[error("Out of range")]
ErrOutOfRange,
#[doc(hidden)]
#[error("Function unimplemented")]
ErrUnimplemented,
#[error("Program exception: {0}")]
ErrProgramException(String),
#[error("Unsupported field")]
ErrUnsupportedField,
#[error("Unsupported hash type")]
ErrUnsupportedHashType,
#[error("Missing field {0}")]
ErrMissingField(String),
#[error("Bad value for field: {0}")]
ErrBadFieldValue(String),
#[error("Invalid keycard")]
ErrInvalidKeycard,
#[error("Invalid key")]
ErrInvalidKey,
#[error("Hash mismatch")]
ErrHashMismatch,
#[error("Verification failure")]
ErrVerificationFailure,
#[error("Out-of-order signature")]
ErrOutOfOrderSignature,
#[error(transparent)]
IOError(#[from] std::io::Error),
#[error(transparent)]
EzNaclError(#[from] eznacl::EzNaclError),
}
pub fn get_timestamp() -> String {
let utc: DateTime<Utc> = Utc::now();
let formatted = utc.format("%Y%m%dT%H%M%SZ");
String::from(formatted.to_string())
}