diff options
author | Alex Auvolat <alex@adnab.me> | 2018-09-26 15:59:22 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-09-26 15:59:22 +0200 |
commit | 1a13285971ef728109011a93e676e26248b30242 (patch) | |
tree | f03467bc07ff84961f8c3eb88497adaf36b5f009 /shard/lib/keys.ex | |
parent | 7d0009d83c9b5c747d4adb535817924762429f30 (diff) | |
download | shard-1a13285971ef728109011a93e676e26248b30242.tar.gz shard-1a13285971ef728109011a93e676e26248b30242.zip |
Fixes
Diffstat (limited to 'shard/lib/keys.ex')
-rw-r--r-- | shard/lib/keys.ex | 9 |
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. |