-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from torusresearch/fix/encryption
fix: Remove CryptoSwift
- Loading branch information
Showing
16 changed files
with
239 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,59 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "AnyCodable", | ||
"repositoryURL": "https://github.com/Flight-School/AnyCodable", | ||
"state": { | ||
"branch": null, | ||
"revision": "862808b2070cd908cb04f9aafe7de83d35f81b05", | ||
"version": "0.6.7" | ||
} | ||
}, | ||
{ | ||
"package": "BigInt", | ||
"repositoryURL": "https://github.com/attaswift/BigInt", | ||
"state": { | ||
"branch": null, | ||
"revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6", | ||
"version": "5.3.0" | ||
} | ||
}, | ||
{ | ||
"package": "CryptoSwift", | ||
"repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift", | ||
"state": { | ||
"branch": null, | ||
"revision": "7892a123f7e8d0fe62f9f03728b17bbd4f94df5c", | ||
"version": "1.8.1" | ||
} | ||
}, | ||
{ | ||
"package": "curvelib.swift", | ||
"repositoryURL": "https://github.com/tkey/curvelib.swift", | ||
"state": { | ||
"branch": null, | ||
"revision": "7dad3bf1793de263f83406c08c18c9316abf082f", | ||
"version": "0.1.2" | ||
} | ||
}, | ||
{ | ||
"package": "FetchNodeDetails", | ||
"repositoryURL": "https://github.com/torusresearch/fetch-node-details-swift.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "d591af500f32ce3c88d04af9bb74d746585acfea", | ||
"version": "5.1.0" | ||
} | ||
}, | ||
{ | ||
"package": "jwt-kit", | ||
"repositoryURL": "https://github.com/vapor/jwt-kit", | ||
"state": { | ||
"branch": null, | ||
"revision": "e05513b5aec24f88012b6e3034115b6bc915356a", | ||
"version": "4.13.2" | ||
} | ||
}, | ||
{ | ||
"package": "swift-crypto", | ||
"repositoryURL": "https://github.com/apple/swift-crypto.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "f0525da24dc3c6cbb2b6b338b65042bc91cbc4bb", | ||
"version": "3.3.0" | ||
} | ||
"pins" : [ | ||
{ | ||
"identity" : "anycodable", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/Flight-School/AnyCodable", | ||
"state" : { | ||
"revision" : "862808b2070cd908cb04f9aafe7de83d35f81b05", | ||
"version" : "0.6.7" | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
}, | ||
{ | ||
"identity" : "bigint", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/attaswift/BigInt", | ||
"state" : { | ||
"revision" : "0ed110f7555c34ff468e72e1686e59721f2b0da6", | ||
"version" : "5.3.0" | ||
} | ||
}, | ||
{ | ||
"identity" : "curvelib.swift", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/tkey/curvelib.swift", | ||
"state" : { | ||
"revision" : "2df9f638fd121b445ce3b410cd79ac4d0cfa94ed", | ||
"version" : "1.0.0" | ||
} | ||
}, | ||
{ | ||
"identity" : "fetch-node-details-swift", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/torusresearch/fetch-node-details-swift", | ||
"state" : { | ||
"revision" : "bf2f0759da5c5c80765773b08c2756045edf608f", | ||
"version" : "5.2.0" | ||
} | ||
}, | ||
{ | ||
"identity" : "jwt-kit", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/vapor/jwt-kit", | ||
"state" : { | ||
"revision" : "c2595b9ad7f512d7f334830b4df1fed6e917946a", | ||
"version" : "4.13.4" | ||
} | ||
}, | ||
{ | ||
"identity" : "swift-crypto", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/apple/swift-crypto.git", | ||
"state" : { | ||
"revision" : "f0525da24dc3c6cbb2b6b338b65042bc91cbc4bb", | ||
"version" : "3.3.0" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import BigInt | ||
//import BigInt | ||
import CommonSources | ||
import BigInt | ||
import FetchNodeDetails | ||
import Foundation | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// | ||
// CryptoSwift | ||
// | ||
// Copyright (C) 2014-2022 Marcin Krzyżanowski <[email protected]> | ||
// This software is provided 'as-is', without any express or implied warranty. | ||
// | ||
// In no event will the authors be held liable for any damages arising from the use of this software. | ||
// | ||
// Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: | ||
// | ||
// - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. | ||
// - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. | ||
// - This notice may not be removed or altered from any source or binary distribution. | ||
// | ||
|
||
extension Array { | ||
@inlinable | ||
init(reserveCapacity: Int) { | ||
self = Array<Element>() | ||
self.reserveCapacity(reserveCapacity) | ||
} | ||
|
||
@inlinable | ||
var slice: ArraySlice<Element> { | ||
self[self.startIndex ..< self.endIndex] | ||
} | ||
|
||
@inlinable | ||
subscript (safe index: Index) -> Element? { | ||
return indices.contains(index) ? self[index] : nil | ||
} | ||
} | ||
|
||
extension Array where Element == UInt8 { | ||
public init(hex: String) { | ||
self.init(reserveCapacity: hex.unicodeScalars.lazy.underestimatedCount) | ||
var buffer: UInt8? | ||
var skip = hex.hasPrefix("0x") ? 2 : 0 | ||
for char in hex.unicodeScalars.lazy { | ||
guard skip == 0 else { | ||
skip -= 1 | ||
continue | ||
} | ||
guard char.value >= 48 && char.value <= 102 else { | ||
removeAll() | ||
return | ||
} | ||
let v: UInt8 | ||
let c: UInt8 = UInt8(char.value) | ||
switch c { | ||
case let c where c <= 57: | ||
v = c - 48 | ||
case let c where c >= 65 && c <= 70: | ||
v = c - 55 | ||
case let c where c >= 97: | ||
v = c - 87 | ||
default: | ||
removeAll() | ||
return | ||
} | ||
if let b = buffer { | ||
append(b << 4 | v) | ||
buffer = nil | ||
} else { | ||
buffer = v | ||
} | ||
} | ||
if let b = buffer { | ||
append(b) | ||
} | ||
} | ||
|
||
public func toHexString() -> String { | ||
`lazy`.reduce(into: "") { | ||
var s = String($1, radix: 16) | ||
if s.count == 1 { | ||
s = "0" + s | ||
} | ||
$0 += s | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.