core, node: Rename Stirng.toPublicKey to parsePublicKeyBase58

This commit is contained in:
Andras Slemmer 2016-08-04 12:14:25 +01:00
parent 35c4fcadcf
commit 4fb8a38122
2 changed files with 2 additions and 2 deletions

View File

@ -148,7 +148,7 @@ fun PrivateKey.signWithECDSA(bitsToSign: ByteArray, publicKey: PublicKey): Digit
val ed25519Curve = EdDSANamedCurveTable.getByName(EdDSANamedCurveTable.CURVE_ED25519_SHA512)
fun String.toPublicKey() = EdDSAPublicKey(EdDSAPublicKeySpec(Base58.decode(this), ed25519Curve))
fun parsePublicKeyBase58(base58String: String) = EdDSAPublicKey(EdDSAPublicKeySpec(Base58.decode(base58String), ed25519Curve))
fun PublicKey.toBase58String() = Base58.encode((this as EdDSAPublicKey).abyte)
fun KeyPair.signWithECDSA(bitsToSign: ByteArray) = private.signWithECDSA(bitsToSign, public)

View File

@ -144,7 +144,7 @@ object JsonSupport {
object PublicKeyDeserializer : JsonDeserializer<EdDSAPublicKey>() {
override fun deserialize(parser: JsonParser, context: DeserializationContext): EdDSAPublicKey {
return try {
parser.text.toPublicKey()
parsePublicKeyBase58(parser.text)
} catch (e: Exception) {
throw JsonParseException(parser, "Invalid public key ${parser.text}: ${e.message}")
}