Recover

org.sigilaris.core.crypto.Recover
See theRecover companion object
trait Recover[A]

Type class for recovering public keys from ECDSA signatures.

Provides a type-safe interface for recovering the public key that was used to create a signature. The recovery process first hashes the value using Hash, then uses the signature's recovery parameter to recover the public key.

Type parameters

A

the type of value that was signed

Attributes

See also

Sign for signature creation

Signature for the signature representation

CryptoOps.recover for the underlying recovery operation

Example
 import Recover.ops.*
 val keyPair   = CryptoOps.generate()
 val message   = Utf8("hello")
 val signature = keyPair.sign(message).toOption.get
 // Recover public key from signature
 val hash                                           = message.toHash
 val recovered: Either[SigilarisFailure, PublicKey] =
   hash.recover(signature)
 assert(recovered.contains(keyPair.publicKey))
Companion
object
Source
Recover.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def fromHash(hashValue: Value[A], signature: Signature): Either[SigilarisFailure, PublicKey]

Recovers the public key from a pre-computed hash and signature.

Recovers the public key from a pre-computed hash and signature.

Value parameters

hashValue

hash value of the signed data

signature

signature to recover from

Attributes

Returns

Right(PublicKey) on success, Left(failure) on error

Source
Recover.scala

Concrete methods

def apply(a: A, signature: Signature)(implicit hash: Hash[A]): Either[SigilarisFailure, PublicKey]

Recovers the public key from a value and its signature.

Recovers the public key from a value and its signature.

Value parameters

a

value that was signed

hash

implicit Hash instance for type A

signature

signature to recover from

Attributes

Returns

Right(PublicKey) on success, Left(failure) on error

Source
Recover.scala