Polyjuice Util v0.2.1 Polyjuice.Util View Source
Link to this section Summary
Types
Represents a full event, including the event content, sender, event type, etc.
Represents the content
field of an event.
Functions
Escape a user ID localpart so that it only uses the allowable character set.
Make a verify key of the type given by the key ID.
Link to this section Types
Represents a full event, including the event content, sender, event type, etc.
Will have (at least) the following fields: "type"
, "content"
, "sender"
,
"event_id"
(if a room event), and "room_id"
(if a room event).
Represents the content
field of an event.
Its expected fields depend on the type of event. For example, a
m.room.message
event should have "msgtype"
and "body"
fields (though
implementations should be prepared to deal with malformed events).
Link to this section Functions
Escape a user ID localpart so that it only uses the allowable character set.
The method used is defined in https://matrix.org/docs/spec/appendices#mapping-from-other-character-sets
By default, it will escape upper-case letters. If you want upper-case
letters to simply be lower-cased, use the fold_case: true
option.
Examples:
iex> Polyjuice.Util.escape_localpart("abc\x01 !\",-./09:;<=>?@AZ[\\]^_`az{|}~á")
"abc=01=20=21=22=2c-./09=3a=3b=3c=3d=3e=3f=40_a_z=5b=5c=5d=5e__=60az=7b=7c=7d=7e=c3=a1"
iex> Polyjuice.Util.escape_localpart("abc\x01 !\",-./09:;<=>?@AZ[\\]^_`az{|}~á", fold_case: true)
"abc=01=20=21=22=2c-./09=3a=3b=3c=3d=3e=3f=40az=5b=5c=5d=5e_=60az=7b=7c=7d=7e=c3=a1"
make_verify_key(key, arg2)
View Sourcemake_verify_key(key :: String.t(), id :: String.t()) :: Polyjuice.Util.VerifyKey.t() | nil
Make a verify key of the type given by the key ID.
Examples:
iex> Polyjuice.Util.make_verify_key("a4qcdbuJoRwy1ykc7Xhj1wTQroEXHdr04AY2Ds6SPb0", "ed25519:1")
%Polyjuice.Util.Ed25519.VerifyKey{
key: <<107, 138, 156, 117, 187, 137, 161, 28, 50, 215, 41, 28, 237, 120, 99, 215,
4, 208, 174, 129, 23, 29, 218, 244, 224, 6, 54, 14, 206, 146, 61, 189>>,
id: "1"
}