cosmetics on SigningKey

This commit is contained in:
sergeych committed 2023-11-23 00:42:54 +03:00
1 parent f429cfe418
commit ce8cfe8e3d
3 files changed
+11 -8

No files matched your search

@@ -11,7 +11,7 @@ import net.sergeych.crypto2.SigningKey.Secret
* Keys could be compared to each other for equality and used
* as a Map keys (not sure about js).
*
* Use [Secret.pair] to create new keys.
* Use [pair] to create new keys.
*/
@Serializable
sealed class SigningKey {
@@ -63,13 +63,14 @@ sealed class SigningKey {
fun seal(message: UByteArray): Seal = Seal(this.publicKey, sign(message))
override fun toString(): String = "Sct:${super.toString()}"
companion object {
data class Pair(val signing: Secret, val aPublic: Public)
}
fun pair(): Pair {
val p = Signature.keypair()
return Pair(Secret(p.secretKey), Public(p.publicKey))
}
companion object {
data class Pair(val secretKey: Secret, val publicKey: Public)
fun pair(): Pair {
val p = Signature.keypair()
return Pair(Secret(p.secretKey), Public(p.publicKey))
}
}
}