-
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.
feature: add publicKey to PrivateKeys (#96)
- Loading branch information
1 parent
21c33e4
commit 5acd175
Showing
5 changed files
with
34 additions
and
3 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
11 changes: 10 additions & 1 deletion
11
...encryption/src/androidMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519PrivateKey.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,3 +1,12 @@ | ||
package io.iohk.atala.prism.apollo.utils | ||
|
||
actual class KMMX25519PrivateKey(val raw: ByteArray) | ||
import org.bouncycastle.crypto.params.X25519PrivateKeyParameters | ||
|
||
actual class KMMX25519PrivateKey(val raw: ByteArray) { | ||
|
||
fun publicKey(): KMMX25519PublicKey { | ||
val private = X25519PrivateKeyParameters(raw, 0) | ||
val public = private.generatePublicKey() | ||
return KMMX25519PublicKey(public.encoded) | ||
} | ||
} |
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
11 changes: 10 additions & 1 deletion
11
...ric-encryption/src/jvmMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519PrivateKey.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,3 +1,12 @@ | ||
package io.iohk.atala.prism.apollo.utils | ||
|
||
actual class KMMX25519PrivateKey(val raw: ByteArray) | ||
import org.bouncycastle.crypto.params.X25519PrivateKeyParameters | ||
|
||
actual class KMMX25519PrivateKey(val raw: ByteArray) { | ||
|
||
fun publicKey(): KMMX25519PublicKey { | ||
val private = X25519PrivateKeyParameters(raw, 0) | ||
val public = private.generatePublicKey() | ||
return KMMX25519PublicKey(public.encoded) | ||
} | ||
} |