aboutsummaryrefslogtreecommitdiff
path: root/shard/lib/keys.ex
diff options
context:
space:
mode:
Diffstat (limited to 'shard/lib/keys.ex')
-rw-r--r--shard/lib/keys.ex9
1 files changed, 6 insertions, 3 deletions
diff --git a/shard/lib/keys.ex b/shard/lib/keys.ex
index d021242..b810078 100644
--- a/shard/lib/keys.ex
+++ b/shard/lib/keys.ex
@@ -71,7 +71,7 @@ defmodule Shard.Keys do
def sign(pk, bin) do
case :dets.lookup @key_db, pk do
[{^pk, sk}] ->
- :enacl.sign(bin, sk)
+ {:ok, :enacl.sign(bin, sk)}
_ -> {:error, :not_found}
end
end
@@ -114,7 +114,7 @@ defmodule Shard.Keys do
def sign_detached(pk, bin) do
case :dets.lookup @key_db, pk do
[{^pk, sk}] ->
- :enacl.sign_detached(bin, sk)
+ {:ok, :enacl.sign_detached(bin, sk)}
_ -> {:error, :not_found}
end
end
@@ -126,7 +126,10 @@ defmodule Shard.Keys do
"""
def verify(pk, bin, sign) do
if valid_identity_pk? pk do
- :enacl.sign_verify_detached(sign, bin, pk)
+ case :enacl.sign_verify_detached(sign, bin, pk) do
+ {:ok, _} -> :ok
+ err -> err
+ end
else
{:error, :invalid_pk_suffix}
end