From a5074640af3e97165335f0e175aa89bc2d4d95af Mon Sep 17 00:00:00 2001 From: RangerMauve Date: Fri, 7 Sep 2018 12:49:42 -0400 Subject: Added functions for sign/verify to DEP 0002 Closes #39 --- proposals/0002-hypercore.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/proposals/0002-hypercore.md b/proposals/0002-hypercore.md index 5469cbb..dcf7cd9 100644 --- a/proposals/0002-hypercore.md +++ b/proposals/0002-hypercore.md @@ -283,6 +283,18 @@ function root_hash (roots) { return blake2b(buffers) } + +function sign (roots, secretKey) { + var hash = root_hash(roots) + + return ed25519.detached.sign(hash, secretKey) +} + +function verify (roots, signature, publicKey) { + var hash = root_hash(roots) + + return ed25519.detached.verify(signature, publicKey) +} ``` # Parameters -- cgit v1.2.3 From 2dd585a4860bffe915231c8a2a6218f040e38da8 Mon Sep 17 00:00:00 2001 From: RangerMauve Date: Sat, 8 Sep 2018 16:04:19 -0400 Subject: Change verify function signature --- proposals/0002-hypercore.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/proposals/0002-hypercore.md b/proposals/0002-hypercore.md index dcf7cd9..b5931ca 100644 --- a/proposals/0002-hypercore.md +++ b/proposals/0002-hypercore.md @@ -290,9 +290,7 @@ function sign (roots, secretKey) { return ed25519.detached.sign(hash, secretKey) } -function verify (roots, signature, publicKey) { - var hash = root_hash(roots) - +function verify (hash, signature, publicKey) { return ed25519.detached.verify(signature, publicKey) } ``` -- cgit v1.2.3 From 105b2fe074e0b703777adfaf5e9c7918f6071079 Mon Sep 17 00:00:00 2001 From: RangerMauve Date: Sat, 8 Sep 2018 16:06:02 -0400 Subject: Update 0002-hypercore.md --- proposals/0002-hypercore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/0002-hypercore.md b/proposals/0002-hypercore.md index b5931ca..e5b562c 100644 --- a/proposals/0002-hypercore.md +++ b/proposals/0002-hypercore.md @@ -291,7 +291,7 @@ function sign (roots, secretKey) { } function verify (hash, signature, publicKey) { - return ed25519.detached.verify(signature, publicKey) + return ed25519.detached.verify(hash, signature, publicKey) } ``` -- cgit v1.2.3