From 5df2499c4aa32c8ab2aaf9dd8faddf5d367c5584 Mon Sep 17 00:00:00 2001 From: Daniel Arantes Loverde Date: Tue, 7 Oct 2025 20:34:33 -0300 Subject: [PATCH] Added more options --- Sources/LCEssentials/Classes/LCECrypto.swift | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Sources/LCEssentials/Classes/LCECrypto.swift b/Sources/LCEssentials/Classes/LCECrypto.swift index 54f0b80..315f091 100644 --- a/Sources/LCEssentials/Classes/LCECrypto.swift +++ b/Sources/LCEssentials/Classes/LCECrypto.swift @@ -23,29 +23,37 @@ import Foundation import LCECryptoKit -public final class LCECrypto { +public final class LCECryptoKitManager { private let hashKey: String - init(privateKey: String){ + public init() { + self.hashKey = "" + } + + public init(privateKey: String){ self.hashKey = privateKey } - func encodeTP(email: String, password: String) -> String? { + public static func generateKey() -> String { + LCECryptoKit.generateRandomAESKeyString() + } + + public func encodeTP(email: String, password: String) -> String? { return LCECryptoKit.encodeSeed(email: email, password: password) } - func decodeOTP(_ otpHash: String) -> String? { + public func decodeOTP(_ otpHash: String) -> String? { return LCECryptoKit.decodeSeed(otpKey: otpHash) } // MARK: Need hashKey to decode - func encodeOTPWithKey(email: String, password: String) -> String? { + public func encodeOTPWithKey(email: String, password: String) -> String? { return LCECryptoKit.encodeSeed(email: email, password: password, hashKey: self.hashKey) } - func decodeOTPWithKey(_ otpHash: String) -> Bool { + public func decodeOTPWithKey(_ otpHash: String) -> Bool { LCECryptoKit.decodeSeed(otpKey: otpHash, hashKey: self.hashKey) } }