Add function to query whether server participates in a room
Move from integer timestamps to datetimes
This commit is contained in:
parent
5d75244bc0
commit
02edff90e7
7 changed files with 65 additions and 20 deletions
|
@ -5,8 +5,6 @@ defmodule MatrixServerWeb.Federation.KeyController do
|
|||
|
||||
alias MatrixServer.KeyServer
|
||||
|
||||
@key_valid_time_ms 1000 * 60 * 24 * 30
|
||||
|
||||
def get_signing_keys(conn, _params) do
|
||||
keys =
|
||||
KeyServer.get_own_signing_keys()
|
||||
|
@ -14,11 +12,15 @@ defmodule MatrixServerWeb.Federation.KeyController do
|
|||
{key_id, %{"key" => key}}
|
||||
end)
|
||||
|
||||
# TODO: Consider using TimeX.
|
||||
# Valid for one month.
|
||||
valid_until = DateTime.utc_now() |> DateTime.add(60 * 60 * 24 * 30, :second)
|
||||
|
||||
data = %{
|
||||
server_name: MatrixServer.server_name(),
|
||||
verify_keys: keys,
|
||||
old_verify_keys: %{},
|
||||
valid_until_ts: System.os_time(:millisecond) + @key_valid_time_ms
|
||||
valid_until_ts: valid_until
|
||||
}
|
||||
|
||||
case KeyServer.sign_object(data) do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue