chore: update usage tutorial
This commit is contained in:
parent
c48367ff09
commit
740bee0073
14
README.md
14
README.md
|
@ -35,7 +35,6 @@ import Config
|
|||
|
||||
if config_env() == :prod do
|
||||
config :floof, listen_opts: [ip: {192,168,0,1}]
|
||||
config :floof, pubkey_config: %{:keydb => ".keydb"}
|
||||
config :floof, spool_dir: ".spool"
|
||||
config :floof, sessions_file: ".sessions.dets"
|
||||
end
|
||||
|
@ -48,7 +47,6 @@ import Config
|
|||
|
||||
if config_env() == :prod do
|
||||
config :floof, listen_port: nil
|
||||
config :floof, pubkey_config: %{:keydb => ".keydb"}
|
||||
config :floof, spool_dir: ".spool"
|
||||
config :floof, sessions_file: ".sessions.dets"
|
||||
|
||||
|
@ -71,21 +69,11 @@ Log into a running floof process (e.g. using `_build/prod/rel/floof/bin/floof re
|
|||
# generate and save a keypair
|
||||
kp = :enacl.sign_keypair()
|
||||
:ok = File.write("test01.ed25519k", kp.secret)
|
||||
source = [
|
||||
{:RelativeDistinguishedName, {0, 9, 2342, 19200300, 100, 1, 25}, "de"},
|
||||
{:RelativeDistinguishedName, {0, 9, 2342, 19200300, 100, 1, 25}, "ytrizja"},
|
||||
{:RelativeDistinguishedName, {0, 9, 2342, 19200300, 100, 1, 9}, "myhost"}
|
||||
]
|
||||
{:ok, pkname} = :FloofProtocol.encode(:RDNSequence, source)
|
||||
# ".keydb" needs to be configured using `config/runtime.exs`
|
||||
:ok = File.write(".keydb/" <> Base.url_encode64(pkname), kp.public)
|
||||
|
||||
# copy the keydb entry to the other participating nodes
|
||||
|
||||
# send a message
|
||||
{:ok, secret} = File.read("test01.ed25519k")
|
||||
msg_topic = [{:RelativeDistinguishedName, {2, 5, 4, 41}, "test topic"}]
|
||||
msg_inner = Floof.Message.pack_inner(msg_topic, [], :info, <<0, 0>>)
|
||||
msg_outer = Floof.Message.build_outer(source, 255, [], secret, msg_inner)
|
||||
msg_outer = Floof.Message.build_outer(255, [], secret, msg_inner)
|
||||
Floof.Message.emit(msg_outer)
|
||||
```
|
||||
|
|
|
@ -4,9 +4,7 @@ defmodule FloofTest do
|
|||
|
||||
test "Simple usage" do
|
||||
# kp = :enacl.sign_keypair()
|
||||
# :ok = File.write("mock_keydb/test01.secret", kp.secret)
|
||||
# {:ok, pkname} = :FloofProtocol.encode(:RDNSequence, [{:RelativeDistinguishedName, {0, 9, 2342, 19200300, 100, 1, 25}, "test"}])
|
||||
# :ok = File.write("mock_keydb/" <> Base.url_encode64(pkname), kp.public)
|
||||
# :ok = File.write("test/test01.secret", kp.secret)
|
||||
|
||||
{:ok, secret_key} = File.read("test/test01.secret")
|
||||
msg_topic = [{:RelativeDistinguishedName, {2, 5, 4, 41}, "test topic"}]
|
||||
|
|
Loading…
Reference in a new issue