Compare commits
1 Commits
main
...
feature/do
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27b6b45ee9 |
3195
LCEssentials_DOCUMENTATION.md
Normal file
3195
LCEssentials_DOCUMENTATION.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"originHash" : "57d4d1724511f49da67a759e590ddf12887d65ffb0702ad7a2ff8f6c830c9b78",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "lcecryptokitbinary",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://60c260c85d3a2fe840411b0ff98f521b5eca3c56@git.loverde.com.br/Loverde-Company-LTDA/LCECryptoKitBinary.git",
|
||||
"state" : {
|
||||
"revision" : "2c5c47cebef40a8adc5557d071a35be405c05e30",
|
||||
"version" : "1.0.2"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 3
|
||||
}
|
||||
@@ -1,33 +1,16 @@
|
||||
// swift-tools-version: 6.0
|
||||
import PackageDescription
|
||||
import Foundation
|
||||
|
||||
let isLocalDevelopment = FileManager.default.fileExists(atPath: "../LCECryptoKit/PrivateLib/LCECryptoKitBinary")
|
||||
|
||||
let package = Package(
|
||||
name: "LCEssentials",
|
||||
platforms: [
|
||||
.iOS(.v13),
|
||||
.macOS(.v10_15),
|
||||
.tvOS(.v13),
|
||||
.watchOS(.v6)
|
||||
],
|
||||
products: [
|
||||
.library(
|
||||
name: "LCEssentials",
|
||||
targets: ["LCEssentials"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(
|
||||
url: isLocalDevelopment ?
|
||||
"../LCECryptoKit/PrivateLib/LCECryptoKitBinary" :
|
||||
"https://60c260c85d3a2fe840411b0ff98f521b5eca3c56@git.loverde.com.br/Loverde-Company-LTDA/LCECryptoKitBinary.git",
|
||||
exact: "1.0.2"
|
||||
)
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "LCEssentials",
|
||||
dependencies: [.product(name: "LCECryptoKit", package: "lcecryptokitbinary")]),
|
||||
name: "LCEssentials"),
|
||||
|
||||
]
|
||||
)
|
||||
|
||||
35
README.md
35
README.md
@@ -17,47 +17,18 @@ Installation
|
||||
#### Swift Package Manager (SPM)
|
||||
``` swift
|
||||
dependencies: [
|
||||
.package(url: "https://git.loverde.com.br/Loverde-Company-LTDA/LCEssentials", .upToNextMajor(from: "1.0.0"))
|
||||
.package(url: "http://git.loverde.com.br:3000/git/LCEssentials.git", .upToNextMajor(from: "1.0.0"))
|
||||
]
|
||||
```
|
||||
|
||||
You can also add it via XCode SPM editor with URL:
|
||||
|
||||
``` swift
|
||||
https://git.loverde.com.br/Loverde-Company-LTDA/LCEssentials
|
||||
http://git.loverde.com.br:3000/git/LCEssentials.git
|
||||
```
|
||||
|
||||
## Usage example
|
||||
|
||||
* Background Trhead
|
||||
|
||||
```swift
|
||||
LCEssentials.backgroundThread(delay: 0.6, background: {
|
||||
//Do something im background
|
||||
}) {
|
||||
//When finish, update UI
|
||||
}
|
||||
```
|
||||
* NavigationController with Completion Handler
|
||||
|
||||
```swift
|
||||
self.navigationController?.popViewControllerWithHandler(completion: {
|
||||
//Do some stuff after pop
|
||||
})
|
||||
|
||||
//or more simple
|
||||
self.navigationController?.popViewControllerWithHandler {
|
||||
//Do some stuff after pop
|
||||
}
|
||||
```
|
||||
## Another components
|
||||
> LCESnackBarView - **great way to send feedback to user**
|
||||
|
||||
And then import `LCEssentials ` wherever you import UIKit or SwiftUI
|
||||
|
||||
``` swift
|
||||
import LCEssentials
|
||||
```
|
||||
[Read full documentation](LCEssentials_DOCUMENTATION.md)
|
||||
|
||||
Author:
|
||||
----
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2025 Loverde Co.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
import Foundation
|
||||
import LCECryptoKit
|
||||
|
||||
public final class LCECryptoKitManager {
|
||||
|
||||
private let hashKey: String
|
||||
|
||||
public init() {
|
||||
self.hashKey = ""
|
||||
}
|
||||
|
||||
public init(privateKey: String){
|
||||
self.hashKey = privateKey
|
||||
}
|
||||
|
||||
public static func generateKey() -> String {
|
||||
LCECryptoKit.generateRandomAESKeyString()
|
||||
}
|
||||
|
||||
public func encodeTP(email: String, password: String) -> String? {
|
||||
return LCECryptoKit.encodeSeed(email: email, password: password)
|
||||
}
|
||||
|
||||
public func decodeOTP(_ otpHash: String) -> String? {
|
||||
return LCECryptoKit.decodeSeed(otpKey: otpHash)
|
||||
}
|
||||
|
||||
// MARK: Need hashKey to decode
|
||||
|
||||
public func encodeOTPWithKey(email: String, password: String) -> String? {
|
||||
return LCECryptoKit.encodeSeed(email: email, password: password, hashKey: self.hashKey)
|
||||
}
|
||||
|
||||
public func decodeOTPWithKey(_ otpHash: String) -> Bool {
|
||||
LCECryptoKit.decodeSeed(otpKey: otpHash, hashKey: self.hashKey)
|
||||
}
|
||||
}
|
||||
@@ -129,26 +129,15 @@ public struct API {
|
||||
// Add the file
|
||||
let fileName = fileURL.lastPathComponent
|
||||
let mimeType = mimeTypeForPath(path: fileName)
|
||||
printInfo(title: "Body size before", msg: "\(body.count) bytes")
|
||||
|
||||
let fileData: Data
|
||||
do {
|
||||
fileData = try Data(contentsOf: fileURL)
|
||||
printInfo(title: "Body size after", msg: "\(body.count) bytes")
|
||||
} catch {
|
||||
printError(title: "Upload File", msg: error.localizedDescription)
|
||||
throw error
|
||||
}
|
||||
|
||||
do {
|
||||
let fileData = try Data(contentsOf: fileURL)
|
||||
body.append("--\(boundary)\r\n".data(using: .utf8)!)
|
||||
body.append("Content-Disposition: form-data; name=\"file\"; filename=\"\(fileName)\"\r\n".data(using: .utf8)!)
|
||||
body.append("Content-Type: \(mimeType)\r\n\r\n".data(using: .utf8)!)
|
||||
let fileDataCopy = Data(fileData)
|
||||
body.append(fileDataCopy)
|
||||
let dataUTF8 = "\r\n".data(using: .utf8)!
|
||||
body.append(dataUTF8)
|
||||
printInfo(title: "Body size after", msg: "\(body.count) bytes")
|
||||
body.append(fileData)
|
||||
body.append("\r\n".data(using: .utf8)!)
|
||||
} catch {
|
||||
printError(title: "Upload File", msg: error.localizedDescription)
|
||||
}
|
||||
|
||||
// Finalize the request body
|
||||
|
||||
Reference in New Issue
Block a user