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, 8 insertions, 1 deletions
diff --git a/shard/lib/keys.ex b/shard/lib/keys.ex
index de054e1..b6ff461 100644
--- a/shard/lib/keys.ex
+++ b/shard/lib/keys.ex
@@ -72,7 +72,7 @@ defmodule Shard.Keys do
List the public keys of all identities for which we have a secret key
"""
def list_identities() do
- for [{pk, _sk}] <- :dets.match(@key_db, :"$1"), do: pk
+ for [pk, _sk] <- :dets.match(@key_db, {:"$1", :"$2"}), do: pk
end
@doc"""
@@ -103,6 +103,13 @@ defmodule Shard.Keys do
end
end
+ def have_sk?(pk) do
+ case :dets.lookup @key_db, pk do
+ [{^pk, _sk}] -> true
+ _ -> false
+ end
+ end
+
@doc"""
Lookup the secret key for a pk and generate a detached signature for a message.