#pragma once

#include <Arduino.h>
#include <stdint.h>
#include <stddef.h>

struct ShineSecretGenerationStatus {
  bool running;
  bool done;
  bool error;
  uint32_t doneBlocks;
  uint32_t totalBlocks;
  uint32_t elapsedSec;
  char message[96];
  char secretBase58[64];
};

bool shineSecretInitSd(String &error);
bool shineSecretStart(const char *normalizedLogin, const char *password, String &error);
bool shineSecretStep(uint32_t blocksPerTick = 4);
void shineSecretAbort();
ShineSecretGenerationStatus shineSecretStatus();
const uint8_t *shineSecretBytes();
const char *shineSecretBase58();
void shineSecretBase58Encode(const uint8_t *data, size_t len, char *out, size_t outSz);
bool shineSecretBase58Decode(const char *input, uint8_t *out, size_t *outLen, size_t maxOutLen, String &error);
