Node app flow (#53)

* User commands are removed from NodeApp

* node scenario comment

* compile error fixed

* WIP: NodeApp refactoring, with deps

* WIP: NodeGrpc factored out from NodeComposer

* WIP: test join

* WIP: implicit SignatureChecker; simple FluenceNode runner

* WIP: almost all tests compile

* tests compile

* RocksDbStore.Factory

* license header added

* thread safe version of GrpcServer.shutdown

* formatting

* some tests are ignored

* fix tests

* delete key path from temp

* trying to reduce boilerplate with Effect

* ignore tests
This commit is contained in:
Dmitry Kurinskiy 2018-02-20 09:28:00 +03:00 committed by Constantine Solovev
parent 4c74269144
commit 668fd8117c

View File

@ -36,6 +36,11 @@ class SignAlgo(name: String, algo: KeyGenerator with SignatureFunctions) {
def generateKeyPair[F[_] : Monad](seed: Option[ByteVector] = None): EitherT[F, CryptoErr, KeyPair] =
algo.generateKeyPair(seed.map(_.toArray))
/**
* Signer is specific for each keypair
* @param kp Keypair, used to sign
* @return
*/
def signer(kp: KeyPair): Signer = new Signer {
override def sign[F[_] : Monad](plain: ByteVector): EitherT[F, CryptoErr, Signature] = algo.sign(kp, plain)
override def publicKey: KeyPair.Public = kp.publicKey
@ -43,7 +48,10 @@ class SignAlgo(name: String, algo: KeyGenerator with SignatureFunctions) {
override def toString: String = s"Signer($name, ${kp.publicKey})"
}
def checker: SignatureChecker = new SignatureChecker {
/**
* Checker is single for each algo, and does not contain any state
*/
implicit val checker: SignatureChecker = new SignatureChecker {
override def check[F[_] : Monad](signature: Signature, plain: ByteVector): EitherT[F, CryptoErr, Unit] = algo.verify(signature, plain)
override def toString: String = s"SignatureChecker($name)"