-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ios): removed cocoapods and made all the ios libs as static
This change was needed because ios requires a dependency manager for any dependency. Using cocoapods for internal xcode projects would not work quite right when trying to use Apollo as a framework.
- Loading branch information
1 parent
f4303c7
commit e2a7517
Showing
29 changed files
with
407 additions
and
630 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
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
36 changes: 14 additions & 22 deletions
36
...mmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMEdPrivateKey.kt
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,29 +1,21 @@ | ||
package io.iohk.atala.prism.apollo.utils | ||
|
||
import swift.cryptoKit.Ed25519 | ||
|
||
public actual class KMMEdPrivateKey(val raw: ByteArray = ByteArray(0)) { | ||
// | ||
// @Throws(RuntimeException::class) | ||
// actual fun sign(message: ByteArray): ByteArray { | ||
// memScoped { | ||
// val errorRef = alloc<ObjCObjectVar<NSError?>>() | ||
// val result = Ed25519.signWithPrivateKey(raw.toNSData(), message.toNSData(), errorRef.ptr) | ||
// errorRef.value?.let { throw RuntimeException(it.localizedDescription()) } | ||
// return result?.toByteArray() ?: throw RuntimeException("Null result") | ||
// } | ||
// } | ||
// | ||
|
||
@Throws(RuntimeException::class) | ||
public fun publicKey(): KMMEdPublicKey { | ||
TODO("Not yet implemented") | ||
// memScoped { | ||
// val errorRef = alloc<ObjCObjectVar<NSError?>>() | ||
// val result = Ed25519.publicKeyWithPrivateKey(raw.toNSData(), errorRef.ptr) | ||
// errorRef.value?.let { throw RuntimeException(it.localizedDescription()) } | ||
// val publicRaw = result?.toByteArray() ?: throw RuntimeException("Null result") | ||
// return KMMEdPublicKey(publicRaw) | ||
// } | ||
} | ||
actual fun sign(message: ByteArray): ByteArray { | ||
TODO("Not yet implemented") | ||
val result = Ed25519.signWithPrivateKey(raw.toNSData(), message.toNSData()) | ||
result.failure()?.let { throw RuntimeException(it.localizedDescription()) } | ||
return result.success()?.toByteArray() ?: throw RuntimeException("Null result") | ||
} | ||
|
||
@Throws(RuntimeException::class) | ||
public fun publicKey(): KMMEdPublicKey { | ||
val result = Ed25519.publicKeyWithPrivateKey(raw.toNSData()) | ||
result.failure()?.let { throw RuntimeException(it.localizedDescription()) } | ||
val publicRaw = result.success()?.toByteArray() ?: throw RuntimeException("Null result") | ||
return KMMEdPublicKey(publicRaw) | ||
} | ||
} |
18 changes: 7 additions & 11 deletions
18
...ymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMEdPublicKey.kt
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,17 +1,13 @@ | ||
package io.iohk.atala.prism.apollo.utils | ||
|
||
import swift.cryptoKit.Ed25519 | ||
|
||
public actual class KMMEdPublicKey(val raw: ByteArray = ByteArray(0)) { | ||
// | ||
// @Throws(RuntimeException::class) | ||
// actual fun verify(message: ByteArray, sig: ByteArray): Boolean { | ||
// memScoped { | ||
// val errorRef = alloc<ObjCObjectVar<NSError?>>() | ||
// val result = Ed25519.verifyWithPublicKey(raw.toNSData(), sig.toNSData(), message.toNSData(), errorRef.ptr) | ||
// errorRef.value?.let { throw RuntimeException(it.localizedDescription()) } | ||
// return result?.boolValue ?: throw RuntimeException("Null result") | ||
// } | ||
// } | ||
|
||
@Throws(RuntimeException::class) | ||
actual fun verify(message: ByteArray, sig: ByteArray): Boolean { | ||
TODO("Not yet implemented") | ||
val result = Ed25519.verifyWithPublicKey(raw.toNSData(), sig.toNSData(), message.toNSData()) | ||
result.failure()?.let { throw RuntimeException(it.localizedDescription()) } | ||
return result.success()?.boolValue ?: throw RuntimeException("Null result") | ||
} | ||
} |
Oops, something went wrong.