aboutsummaryrefslogtreecommitdiff
path: root/shard/lib/app/identity.ex
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-11-02 14:04:52 +0100
committerAlex Auvolat <alex@adnab.me>2018-11-02 14:04:52 +0100
commit94b1f6b0ae387b7fcb0714a4c6e213212097a100 (patch)
tree33fa5f6f626b075c389b4bb977d9fbb5e7e05c37 /shard/lib/app/identity.ex
parent3baa53f1da7f581619b066832b8303efbe9a46ba (diff)
downloadshard-94b1f6b0ae387b7fcb0714a4c6e213212097a100.tar.gz
shard-94b1f6b0ae387b7fcb0714a4c6e213212097a100.zip
Directory stuff
Diffstat (limited to 'shard/lib/app/identity.ex')
-rw-r--r--shard/lib/app/identity.ex14
1 files changed, 12 insertions, 2 deletions
diff --git a/shard/lib/app/identity.ex b/shard/lib/app/identity.ex
index 69bed93..59a4b90 100644
--- a/shard/lib/app/identity.ex
+++ b/shard/lib/app/identity.ex
@@ -27,6 +27,9 @@ defmodule SApp.Identity do
defimpl Shard.Manifest do
def module(_m), do: SApp.Identity
+ def is_valid?(m) do
+ byte_size(m.pk) == 32
+ end
end
end
@@ -79,9 +82,16 @@ defmodule SApp.Identity do
end
def handle_cast(:send_deps, state) do
- # TODO: collections
+ deps = if Shard.Keys.have_sk?(state.pk) do
+ [
+ %SApp.Directory.Manifest{owner: state.pk, public: true, name: "collection"},
+ %SApp.Directory.Manifest{owner: state.pk, public: false, name: "collection"}
+ ]
+ else
+ []
+ end
- GenServer.cast(Shard.Manager, {:dep_list, state.id, []})
+ GenServer.cast(Shard.Manager, {:dep_list, state.id, deps})
{:noreply, state}
end