diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 2fab322..39a3f5a 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -21,6 +21,6 @@ jobs:
with:
platform: ${{ matrix.platform }}
action: test
- scheme: curvelib.swift
+ scheme: curvelib.swift-Package
code-coverage: true
upload-logs: always
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/curveSecp256k1.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/curveSecp256k1.xcscheme
new file mode 100644
index 0000000..dce03d7
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/curveSecp256k1.xcscheme
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/curvelib.swift-Package.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/curvelib.swift-Package.xcscheme
new file mode 100644
index 0000000..865b394
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/curvelib.swift-Package.xcscheme
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/encryption_aes_cbc_sha512.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/encryption_aes_cbc_sha512.xcscheme
new file mode 100644
index 0000000..8bdb642
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/encryption_aes_cbc_sha512.xcscheme
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Package.swift b/Package.swift
index 26a613b..5db3842 100644
--- a/Package.swift
+++ b/Package.swift
@@ -11,8 +11,12 @@ let package = Package(
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
- name: "curvelib.swift",
- targets: ["curvelib.swift"]),
+ name: "curveSecp256k1",
+ targets: ["curveSecp256k1"]),
+
+ .library(
+ name: "encryption_aes_cbc_sha512",
+ targets: ["encryption_aes_cbc_sha512"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
@@ -30,12 +34,18 @@ let package = Package(
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
- name: "curvelib.swift",
+ name: "curveSecp256k1",
dependencies: ["curvelib"],
- path: "Sources/curvelib"
+ path: "Sources/curvelib/secp256k1"
),
+ .target(
+ name: "encryption_aes_cbc_sha512",
+ dependencies: ["curvelib", "curveSecp256k1"],
+ path: "Sources/curvelib/encryption"
+ ),
+
.testTarget(
name: "curvelibTests",
- dependencies: ["curvelib.swift"]),
+ dependencies: ["curveSecp256k1", "encryption_aes_cbc_sha512"]),
]
)
diff --git a/Sources/curvelib/secp256k1/EncryptedMessage.swift b/Sources/curvelib/encryption/EncryptedMessage.swift
similarity index 99%
rename from Sources/curvelib/secp256k1/EncryptedMessage.swift
rename to Sources/curvelib/encryption/EncryptedMessage.swift
index 56db35f..f98065a 100644
--- a/Sources/curvelib/secp256k1/EncryptedMessage.swift
+++ b/Sources/curvelib/encryption/EncryptedMessage.swift
@@ -3,6 +3,7 @@ import Foundation
#if canImport(curvelib)
import curvelib
#endif
+import curveSecp256k1
public final class EncryptedMessage {
private(set) var pointer: OpaquePointer?
diff --git a/Sources/curvelib/secp256k1/Encryption.swift b/Sources/curvelib/encryption/Encryption.swift
similarity index 98%
rename from Sources/curvelib/secp256k1/Encryption.swift
rename to Sources/curvelib/encryption/Encryption.swift
index 24b0367..fbceb42 100644
--- a/Sources/curvelib/secp256k1/Encryption.swift
+++ b/Sources/curvelib/encryption/Encryption.swift
@@ -3,6 +3,7 @@ import Foundation
#if canImport(curvelib)
import curvelib
#endif
+import curveSecp256k1
public final class Encryption {
public static func encrypt(pk: PublicKey, plainText: String) throws -> EncryptedMessage {
diff --git a/Sources/curvelib/secp256k1/CurveError.swift b/Sources/curvelib/secp256k1/CurveError.swift
index 2adea06..145536c 100644
--- a/Sources/curvelib/secp256k1/CurveError.swift
+++ b/Sources/curvelib/secp256k1/CurveError.swift
@@ -1,7 +1,7 @@
import Foundation
public struct CurveError: Error, LocalizedError {
- enum ErrorType {
+ public enum ErrorType {
case null
case convert
case parse
@@ -17,7 +17,7 @@ public struct CurveError: Error, LocalizedError {
private(set) var type: ErrorType
- init(code: Int32) {
+ public init(code: Int32) {
switch code {
case 1: type = .null
case 2: type = .convert
diff --git a/Sources/curvelib/secp256k1/PublicKey.swift b/Sources/curvelib/secp256k1/PublicKey.swift
index 68c6da6..7ba0e2b 100644
--- a/Sources/curvelib/secp256k1/PublicKey.swift
+++ b/Sources/curvelib/secp256k1/PublicKey.swift
@@ -5,9 +5,9 @@ import Foundation
#endif
public final class PublicKey {
- private(set) var pointer: OpaquePointer?
+ private(set) public var pointer: OpaquePointer?
- internal init(ptr: OpaquePointer) {
+ public init(ptr: OpaquePointer) {
pointer = ptr
}
diff --git a/Sources/curvelib/secp256k1/SecretKey.swift b/Sources/curvelib/secp256k1/SecretKey.swift
index f3222d0..251e694 100644
--- a/Sources/curvelib/secp256k1/SecretKey.swift
+++ b/Sources/curvelib/secp256k1/SecretKey.swift
@@ -5,7 +5,7 @@ import Foundation
#endif
public final class SecretKey {
- private(set) var pointer: OpaquePointer?
+ private(set) public var pointer: OpaquePointer?
public init() {
pointer = curve_secp256k1_private_key_generate()
diff --git a/Tests/curvelibTests/curvelibErrorTests.swift b/Tests/curvelibTests/curvelibErrorTests.swift
index 4ded360..a65af8c 100644
--- a/Tests/curvelibTests/curvelibErrorTests.swift
+++ b/Tests/curvelibTests/curvelibErrorTests.swift
@@ -1,5 +1,5 @@
import XCTest
-@testable import curvelib_swift
+@testable import curveSecp256k1
final class curvelibErrorTests: XCTestCase {
func testCurveError() {
diff --git a/Tests/curvelibTests/curvelibTests.swift b/Tests/curvelibTests/curvelibTests.swift
index bf55b7d..5b91282 100644
--- a/Tests/curvelibTests/curvelibTests.swift
+++ b/Tests/curvelibTests/curvelibTests.swift
@@ -1,5 +1,6 @@
import XCTest
-import curvelib_swift
+@testable import curveSecp256k1
+@testable import encryption_aes_cbc_sha512
final class curvelibTests: XCTestCase {
func testSecretKey() throws {