aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpukkamustard <pukkamustard@posteo.net>2020-12-08 11:03:52 +0100
committerpukkamustard <pukkamustard@posteo.net>2020-12-08 11:09:23 +0100
commit4da4ac1d0aeb6f9cdb52bcffd3319c9e22281c30 (patch)
tree648b4db54c70ad0e82e83a2b40acd0224a51abe0
parentfc3ac5a6645dfaeb532ea1de24054cc4740afad2 (diff)
ERIS.ReadCapability: fix behaviour of parse/1 when passed already parsed ReadCapability
-rw-r--r--lib/eris/read_capability.ex2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/eris/read_capability.ex b/lib/eris/read_capability.ex
index 19cc61a..abdd33f 100644
--- a/lib/eris/read_capability.ex
+++ b/lib/eris/read_capability.ex
@@ -39,6 +39,8 @@ defmodule ERIS.ReadCapability do
@doc """
Parse an ERIS read capability from a URN (string representaiton) or binary encoding.
"""
+ def parse(%__MODULE__{} = read_capability), do: {:ok, read_capability}
+
def parse(urn) when is_binary(urn) do
case urn do
"urn:erisx2:" <> base32_encoded ->