forked from sergeych/crypto2
cosmetics on SigningKey
This commit is contained in:
parent
f429cfe418
commit
ce8cfe8e3d
2
.idea/.gitignore
generated
vendored
2
.idea/.gitignore
generated
vendored
@ -6,3 +6,5 @@
|
|||||||
# Datasource local storage ignored files
|
# Datasource local storage ignored files
|
||||||
/dataSources/
|
/dataSources/
|
||||||
/dataSources.local.xml
|
/dataSources.local.xml
|
||||||
|
/artifacts/crypto2_js_0_1_0_SNAPSHOT.xml
|
||||||
|
/artifacts/crypto2_jvm_0_1_0_SNAPSHOT.xml
|
||||||
|
@ -7,7 +7,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "net.sergeych"
|
group = "net.sergeych"
|
||||||
version = "1.0-SNAPSHOT"
|
version = "0.1.0-SNAPSHOT"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -11,7 +11,7 @@ import net.sergeych.crypto2.SigningKey.Secret
|
|||||||
* Keys could be compared to each other for equality and used
|
* Keys could be compared to each other for equality and used
|
||||||
* as a Map keys (not sure about js).
|
* as a Map keys (not sure about js).
|
||||||
*
|
*
|
||||||
* Use [Secret.pair] to create new keys.
|
* Use [pair] to create new keys.
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
sealed class SigningKey {
|
sealed class SigningKey {
|
||||||
@ -63,13 +63,14 @@ sealed class SigningKey {
|
|||||||
fun seal(message: UByteArray): Seal = Seal(this.publicKey, sign(message))
|
fun seal(message: UByteArray): Seal = Seal(this.publicKey, sign(message))
|
||||||
override fun toString(): String = "Sct:${super.toString()}"
|
override fun toString(): String = "Sct:${super.toString()}"
|
||||||
|
|
||||||
companion object {
|
}
|
||||||
data class Pair(val signing: Secret, val aPublic: Public)
|
|
||||||
|
|
||||||
fun pair(): Pair {
|
companion object {
|
||||||
val p = Signature.keypair()
|
data class Pair(val secretKey: Secret, val publicKey: Public)
|
||||||
return Pair(Secret(p.secretKey), Public(p.publicKey))
|
|
||||||
}
|
fun pair(): Pair {
|
||||||
|
val p = Signature.keypair()
|
||||||
|
return Pair(Secret(p.secretKey), Public(p.publicKey))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user