diff options
Diffstat (limited to 'shard/lib/keys.ex')
-rw-r--r-- | shard/lib/keys.ex | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/shard/lib/keys.ex b/shard/lib/keys.ex index e0180b7..412baa2 100644 --- a/shard/lib/keys.ex +++ b/shard/lib/keys.ex @@ -16,7 +16,9 @@ defmodule Shard.Keys do :dets.start {:ok, @key_db} = :dets.open_file(@key_db, [type: :set]) for [pk, _] <- :dets.match(@key_db, {:'$1', :'$2'}) do - Shard.Manager.find_or_start %SApp.Identity.Manifest{pk: pk} + m = %SApp.Identity.Manifest{pk: pk} + Shard.Manager.find_or_start m + GenServer.cast(Shard.Manager, {:pin, SData.term_hash(m)}) end nil end @@ -53,7 +55,9 @@ defmodule Shard.Keys do {pk, sk} = gen_keypair(Application.get_env(:shard, :identity_suffix)) Logger.info "New identity: #{pk|>Base.encode16}" :dets.insert @key_db, {pk, sk} - Shard.Manager.find_or_start %SApp.Identity.Manifest{pk: pk} + m = %SApp.Identity.Manifest{pk: pk} + Shard.Manager.find_or_start m + GenServer.cast(Shard.Manager, {:pin, SData.term_hash(m)}) pk end |