2021-08-24 15:27:45 -07:00
|
|
|
//
|
|
|
|
// KeyStoring.swift
|
|
|
|
// secant
|
|
|
|
//
|
|
|
|
// Created by Francisco Gindre on 8/6/21.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
protocol KeyStoring {
|
|
|
|
func importBirthday(_ height: BlockHeight) throws
|
|
|
|
func exportBirthday() throws -> BlockHeight
|
|
|
|
func importPhrase(bip39 phrase: String) throws
|
|
|
|
func exportPhrase() throws -> String
|
2021-09-03 13:10:13 -07:00
|
|
|
func areKeysPresent() throws -> Bool
|
2021-08-24 15:27:45 -07:00
|
|
|
/**
|
2021-09-14 04:15:29 -07:00
|
|
|
Use carefully: Deletes the seed phrase from the keychain
|
|
|
|
*/
|
2021-08-24 15:27:45 -07:00
|
|
|
func nukePhrase()
|
|
|
|
|
|
|
|
/**
|
2021-09-14 04:15:29 -07:00
|
|
|
Use carefully: deletes the wallet birthday from the keychain
|
|
|
|
*/
|
2021-08-24 15:27:45 -07:00
|
|
|
func nukeBirthday()
|
|
|
|
|
|
|
|
/**
|
|
|
|
There's no fate but what we make for ourselves - Sarah Connor
|
|
|
|
*/
|
|
|
|
func nukeWallet()
|
2021-09-14 04:15:29 -07:00
|
|
|
|
|
|
|
var keysPresent: Bool { get }
|
2021-08-24 15:27:45 -07:00
|
|
|
}
|
|
|
|
|
2021-09-14 04:15:29 -07:00
|
|
|
enum KeyStoringError: Error {
|
2021-08-24 15:27:45 -07:00
|
|
|
case alreadyImported
|
|
|
|
case uninitializedWallet
|
2021-09-21 13:38:36 -07:00
|
|
|
case storageError(Error)
|
2021-08-24 15:27:45 -07:00
|
|
|
}
|