diff options
Diffstat (limited to 'shard/lib/keys.ex')
-rw-r--r-- | shard/lib/keys.ex | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/shard/lib/keys.ex b/shard/lib/keys.ex index b6ff461..fe63148 100644 --- a/shard/lib/keys.ex +++ b/shard/lib/keys.ex @@ -16,16 +16,7 @@ defmodule Shard.Keys do def init() do :dets.start {:ok, @key_db} = :dets.open_file(@key_db, [type: :set]) - - case :dets.lookup(@key_db, :peer) do - [] -> - Logger.info "Generating peer keypair..." - {pk, sk} = gen_keypair(Application.get_env(:shard, :peer_id_suffix)) - :dets.insert @key_db, {:peer, pk, sk} - {pk, sk} - [{:peer, pk, sk}] -> - {pk, sk} - end + nil end defp gen_keypair(suffix, n \\ 0) do @@ -44,10 +35,6 @@ defmodule Shard.Keys do :binary.longest_common_suffix([pk, suffix]) == byte_size(suffix) end - def get_peer_keypair() do - Agent.get(__MODULE__, &(&1)) - end - def get_any_identity() do Agent.get(__MODULE__, fn _ -> case list_identities() do @@ -64,7 +51,7 @@ 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} - SApp.Identity.start_link(pk) + Shard.Manager.Manifest.start %SApp.Identity.Manifest{pk: pk} pk end |