Current section
Files
Jump to
Current section
Files
lib/ccs_sdk/kdc/kdc.ex
defmodule CcsSdk.Kdc do
alias CcsSdk.Client
@moduledoc """
SDK for KDC service
API documentation - https://wiki.ccsteam.ru/index.php?title=KDC_API
"""
@doc """
Save user pub keys
"""
@spec save(String.t, {String.t, String.t}) :: {atom, map} | {atom, atom}
def save(user_huid, {rts_pub_key, cts_pub_key}) do
params = %{"rts_pub_key" => rts_pub_key, "cts_pub_key" => cts_pub_key}
Client.post("kdc/keys/#{user_huid}", params)
end
@doc """
Get versions of user pub keys
"""
@spec get_pub_keys_versions([String.t]) :: {atom, map} | {atom, atom}
def get_pub_keys_versions(huids) do
case Client.get("kdc/keys/version", %{"user_huids" => Enum.join(huids, ",")}) do
{:ok, body} ->
{:ok, body |> Map.fetch!("result")}
res ->
res
end
end
end