Merge pull request #147 from Christewart/dummy_sign

Adding dummy sign method inside of Sign
This commit is contained in:
Chris Stewart 2018-04-18 09:11:56 -04:00 committed by GitHub
commit 6e0c705699

View file

@ -4,7 +4,7 @@ import scala.concurrent.{ Await, ExecutionContext, Future }
import scala.concurrent.duration.DurationInt
/**
* This is meant to be an abstraction for a [[org.bitcoins.core.crypto.ECPrivateKey]],f sometimes we will not
* This is meant to be an abstraction for a [[org.bitcoins.core.crypto.ECPrivateKey]], sometimes we will not
* have direct access to a private key in memory -- for instance if that key is on a hardware device -- so we need to create an
* abstraction of the signing process. Fundamentally a private key takes in a Seq[Byte] and returns a [[ECDigitalSignature]]
* That is what this abstraction is meant to represent. If you have a [[ECPrivateKey]] in your application, you can get it's
@ -35,4 +35,16 @@ object Sign {
def apply(signFunction: Seq[Byte] => Future[ECDigitalSignature], pubKey: ECPublicKey): Sign = {
SignImpl(signFunction, pubKey)
}
/**
* This dummySign function is useful for the case where we do not have the
* signFunction available on the same jvm as the place where we are creating the
* sign. I can't think of a good way to serialize the signFunction, so it needs to be
* optional for now. Maybe we rethink the idea of the signFunction in the future.
* the public key is still useful here though because it can be used to match against
* a specific private key on another server
*/
def dummySign(publicKey: ECPublicKey): Sign = {
SignImpl({ _: Seq[Byte] => Future.successful(EmptyDigitalSignature) }, publicKey)
}
}