
Offers an Ed25519 cryptography library for signing and verifying messages, featuring key pair generation, Base64 encoding/decoding, and integration with Tink cryptographic library.
Ed25519 crypto library based on https://github.com/tink-crypto/tink-java
kotlin {
sourceSets {
commonMain.dependencies {
...
implementation("io.github.remmerw:borr:0.0.7")
}
...
}
}
@Test
fun ed25519() {
val keys = Ed25519Sign.KeyPair.newKeyPair()
// sign a msg
val msg = "moin moin".encodeToByteArray()
val signer = Ed25519Sign(keys.getPrivateKey())
val signature = signer.sign(msg)
// encode
val privateKeyAsString = Base64.encode(keys.getPrivateKey())
assertNotNull(privateKeyAsString)
val publicKeyAsString = Base64.encode(keys.getPublicKey())
assertNotNull(publicKeyAsString)
// decode
val privateKey = Base64.decode(privateKeyAsString)
assertNotNull(privateKey)
val publicKey = Base64.decode(publicKeyAsString)
// verify with public key
val verifier = Ed25519Verify(publicKey)
verifier.verify(signature, msg) // throws exception in case is not verified
}
Ed25519 crypto library based on https://github.com/tink-crypto/tink-java
kotlin {
sourceSets {
commonMain.dependencies {
...
implementation("io.github.remmerw:borr:0.0.7")
}
...
}
}
@Test
fun ed25519() {
val keys = Ed25519Sign.KeyPair.newKeyPair()
// sign a msg
val msg = "moin moin".encodeToByteArray()
val signer = Ed25519Sign(keys.getPrivateKey())
val signature = signer.sign(msg)
// encode
val privateKeyAsString = Base64.encode(keys.getPrivateKey())
assertNotNull(privateKeyAsString)
val publicKeyAsString = Base64.encode(keys.getPublicKey())
assertNotNull(publicKeyAsString)
// decode
val privateKey = Base64.decode(privateKeyAsString)
assertNotNull(privateKey)
val publicKey = Base64.decode(publicKeyAsString)
// verify with public key
val verifier = Ed25519Verify(publicKey)
verifier.verify(signature, msg) // throws exception in case is not verified
}