Amarula.Protocol.Auth.DeviceIdentity (amarula v0.1.0)
View SourceThe pairing device-identity crypto: verify the primary's signed device identity,
counter-sign it with our key, and derive the companion's signal identity. Pure
(takes auth creds + the received identity, returns values) — extracted from
Connection so the connection process keeps only socket/state concerns.
Ported from Baileys' pair-success handling (src/Socket/socket.ts).
Summary
Functions
Encode an ADVSignedDeviceIdentity for the wire. Drops the account signature
key unless include_signature_key? (or it's already empty).
The companion signal identity %{identifier, identifierKey} for lid.
Verify the received identity_hmac (an ADVSignedDeviceIdentityHMAC) against
our auth_creds, then return the account with our device signature added.
{:ok, signed_account} or {:error, reason}.
Functions
Encode an ADVSignedDeviceIdentity for the wire. Drops the account signature
key unless include_signature_key? (or it's already empty).
The companion signal identity %{identifier, identifierKey} for lid.
Verify the received identity_hmac (an ADVSignedDeviceIdentityHMAC) against
our auth_creds, then return the account with our device signature added.
{:ok, signed_account} or {:error, reason}.