bump protocol

This commit is contained in:
finn 2022-02-16 14:52:03 -05:00
parent 219f1df6e5
commit 946b27917d
5 changed files with 1656 additions and 1108 deletions

View file

@ -29,7 +29,6 @@ import (
"gitlab.com/signald/signald-go/cmd/signaldctl/common" "gitlab.com/signald/signald-go/cmd/signaldctl/common"
"gitlab.com/signald/signald-go/cmd/signaldctl/config" "gitlab.com/signald/signald-go/cmd/signaldctl/config"
v0 "gitlab.com/signald/signald-go/signald/client-protocol/v0"
"gitlab.com/signald/signald-go/signald/client-protocol/v1" "gitlab.com/signald/signald-go/signald/client-protocol/v1"
) )
@ -67,7 +66,7 @@ var (
req := v1.SendRequest{ req := v1.SendRequest{
Username: account, Username: account,
MessageBody: strings.Join(args[1:], " "), MessageBody: strings.Join(args[1:], " "),
Attachments: []*v0.JsonAttachment{}, Attachments: []*v1.JsonAttachment{},
RecipientAddress: toAddress, RecipientAddress: toAddress,
RecipientGroupID: toGroup, RecipientGroupID: toGroup,
} }
@ -78,7 +77,7 @@ var (
log.Fatal("error resolving attachment", err) log.Fatal("error resolving attachment", err)
} }
log.Println(path) log.Println(path)
req.Attachments = append(req.Attachments, &v0.JsonAttachment{Filename: path}) req.Attachments = append(req.Attachments, &v1.JsonAttachment{Filename: path})
} }
resp, err := req.Submit(common.Signald) resp, err := req.Submit(common.Signald)

File diff suppressed because it is too large Load diff

View file

@ -32,6 +32,20 @@ func mkerr(response client_protocol.BasicResponse) error {
return err return err
} }
return result return result
case "AttachmentTooLargeError":
result := AttachmentTooLargeError{}
err := json.Unmarshal(response.Error, &result)
if err != nil {
return err
}
return result
case "AuthorizationFailedError":
result := AuthorizationFailedError{}
err := json.Unmarshal(response.Error, &result)
if err != nil {
return err
}
return result
case "CaptchaRequiredError": case "CaptchaRequiredError":
result := CaptchaRequiredError{} result := CaptchaRequiredError{}
err := json.Unmarshal(response.Error, &result) err := json.Unmarshal(response.Error, &result)
@ -207,6 +221,13 @@ func mkerr(response client_protocol.BasicResponse) error {
return err return err
} }
return result return result
case "ScanTimeoutError":
result := ScanTimeoutError{}
err := json.Unmarshal(response.Error, &result)
if err != nil {
return err
}
return result
case "ServerNotFoundError": case "ServerNotFoundError":
result := ServerNotFoundError{} result := ServerNotFoundError{}
err := json.Unmarshal(response.Error, &result) err := json.Unmarshal(response.Error, &result)
@ -228,6 +249,13 @@ func mkerr(response client_protocol.BasicResponse) error {
return err return err
} }
return result return result
case "UnregisteredUserError":
result := UnregisteredUserError{}
err := json.Unmarshal(response.Error, &result)
if err != nil {
return err
}
return result
case "UntrustedIdentityError": case "UntrustedIdentityError":
result := UntrustedIdentityError{} result := UntrustedIdentityError{}
err := json.Unmarshal(response.Error, &result) err := json.Unmarshal(response.Error, &result)
@ -272,6 +300,24 @@ func (e AccountLockedError) Error() string {
return e.Message return e.Message
} }
type AttachmentTooLargeError struct {
Filename string `json:"filename,omitempty" yaml:"filename,omitempty"`
Message string `json:"message,omitempty" yaml:"message,omitempty"`
}
func (e AttachmentTooLargeError) Error() string {
return e.Message
}
// AuthorizationFailedError: indicates the server rejected our credentials. Typically means the linked device was removed by the primary device, or that the account was re-registered
type AuthorizationFailedError struct {
Message string `json:"message,omitempty" yaml:"message,omitempty"`
}
func (e AuthorizationFailedError) Error() string {
return e.Message
}
type CaptchaRequiredError struct { type CaptchaRequiredError struct {
Message string `json:"message,omitempty" yaml:"message,omitempty"` Message string `json:"message,omitempty" yaml:"message,omitempty"`
More string `json:"more,omitempty" yaml:"more,omitempty"` More string `json:"more,omitempty" yaml:"more,omitempty"`
@ -282,7 +328,8 @@ func (e CaptchaRequiredError) Error() string {
} }
type DuplicateMessageError struct { type DuplicateMessageError struct {
Message string `json:"message,omitempty" yaml:"message,omitempty"` Message string `json:"message,omitempty" yaml:"message,omitempty"`
Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
} }
func (e DuplicateMessageError) Error() string { func (e DuplicateMessageError) Error() string {
@ -470,6 +517,7 @@ type ProtocolInvalidMessageError struct {
Message string `json:"message,omitempty" yaml:"message,omitempty"` Message string `json:"message,omitempty" yaml:"message,omitempty"`
Sender string `json:"sender,omitempty" yaml:"sender,omitempty"` Sender string `json:"sender,omitempty" yaml:"sender,omitempty"`
SenderDevice int32 `json:"sender_device,omitempty" yaml:"sender_device,omitempty"` SenderDevice int32 `json:"sender_device,omitempty" yaml:"sender_device,omitempty"`
Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
} }
func (e ProtocolInvalidMessageError) Error() string { func (e ProtocolInvalidMessageError) Error() string {
@ -484,6 +532,14 @@ func (e RateLimitError) Error() string {
return e.Message return e.Message
} }
type ScanTimeoutError struct {
Message string `json:"message,omitempty" yaml:"message,omitempty"`
}
func (e ScanTimeoutError) Error() string {
return e.Message
}
type ServerNotFoundError struct { type ServerNotFoundError struct {
Message string `json:"message,omitempty" yaml:"message,omitempty"` Message string `json:"message,omitempty" yaml:"message,omitempty"`
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
@ -509,6 +565,15 @@ func (e UnknownIdentityKeyError) Error() string {
return e.Message return e.Message
} }
type UnregisteredUserError struct {
E164Number string `json:"e164_number,omitempty" yaml:"e164_number,omitempty"`
Message string `json:"message,omitempty" yaml:"message,omitempty"`
}
func (e UnregisteredUserError) Error() string {
return e.Message
}
type UntrustedIdentityError struct { type UntrustedIdentityError struct {
Identifier string `json:"identifier,omitempty" yaml:"identifier,omitempty"` Identifier string `json:"identifier,omitempty" yaml:"identifier,omitempty"`
IdentityKey **IdentityKey `json:"identity_key,omitempty" yaml:"identity_key,omitempty"` IdentityKey **IdentityKey `json:"identity_key,omitempty" yaml:"identity_key,omitempty"`

View file

@ -217,7 +217,7 @@ func (r *RemoveServerRequest) Submit(conn *signald.Signald) (err error) {
} }
// Submit: After a linking URI has been requested, finish_link must be called with the session_id provided with the URI. it will return information about the new account once the linking process is completed by the other device. // Submit: After a linking URI has been requested, finish_link must be called with the session_id provided with the URI. it will return information about the new account once the linking process is completed by the other device and the new account is setup. Note that the account setup process can sometimes take some time, if rapid userfeedback is required after scanning, use wait_for_scan first, then finish setup with finish_link.
func (r *FinishLinkRequest) Submit(conn *signald.Signald) (response Account, err error) { func (r *FinishLinkRequest) Submit(conn *signald.Signald) (response Account, err error) {
r.Version = "v1" r.Version = "v1"
r.Type = "finish_link" r.Type = "finish_link"
@ -316,7 +316,7 @@ func (r *GetAllIdentities) Submit(conn *signald.Signald) (response AllIdentityKe
} }
// Submit: Query the server for the latest state of a known group. If no account in signald is a member of the group (anymore), an error with error_type: 'UnknownGroupError' is returned. // Submit: Query the server for the latest state of a known group. If the account is not a member of the group, an UnknownGroupError is returned.
func (r *GetGroupRequest) Submit(conn *signald.Signald) (response JsonGroupV2Info, err error) { func (r *GetGroupRequest) Submit(conn *signald.Signald) (response JsonGroupV2Info, err error) {
r.Version = "v1" r.Version = "v1"
r.Type = "get_group" r.Type = "get_group"
@ -546,6 +546,39 @@ func (r *GroupLinkInfoRequest) Submit(conn *signald.Signald) (response JsonGroup
} }
// Submit: Determine whether an account identifier is registered on the Signal service.
func (r *IsIdentifierRegisteredRequest) Submit(conn *signald.Signald) (response BooleanMessage, err error) {
r.Version = "v1"
r.Type = "is_identifier_registered"
if r.ID == "" {
r.ID = signald.GenerateID()
}
err = conn.RawRequest(r)
if err != nil {
log.Println("signald-go: error submitting request to signald")
return
}
responseChannel := conn.GetResponseListener(r.ID)
defer conn.CloseResponseListener(r.ID)
rawResponse := <-responseChannel
if rawResponse.Error != nil {
err = mkerr(rawResponse)
return
}
err = json.Unmarshal(rawResponse.Data, &response)
if err != nil {
rawResponseJson, _ := rawResponse.Data.MarshalJSON()
log.Println("signald-go: error unmarshalling response from signald of type", rawResponse.Type, string(rawResponseJson))
return
}
return response, nil
}
// Submit: Join a group using the a signal.group URL. Note that you must have a profile name set to join groups. // Submit: Join a group using the a signal.group URL. Note that you must have a profile name set to join groups.
func (r *JoinGroupRequest) Submit(conn *signald.Signald) (response JsonGroupJoinInfo, err error) { func (r *JoinGroupRequest) Submit(conn *signald.Signald) (response JsonGroupJoinInfo, err error) {
r.Version = "v1" r.Version = "v1"
@ -1048,7 +1081,7 @@ func (r *SendPaymentRequest) Submit(conn *signald.Signald) (response SendRespons
} }
// Submit: set this device's name. This will show up on the mobile device on the same account under // Submit: set this device's name. This will show up on the mobile device on the same account under settings -> linked devices
func (r *SetDeviceNameRequest) Submit(conn *signald.Signald) (err error) { func (r *SetDeviceNameRequest) Submit(conn *signald.Signald) (err error) {
r.Version = "v1" r.Version = "v1"
r.Type = "set_device_name" r.Type = "set_device_name"
@ -1391,3 +1424,29 @@ func (r *VersionRequest) Submit(conn *signald.Signald) (response JsonVersionMess
return response, nil return response, nil
} }
// Submit: An optional part of the linking process. Intended to be called after displaying the QR code, will return quickly after the user scans the QR code. finish_link must be called after wait_for_scan returns a non-error
func (r *WaitForScanRequest) Submit(conn *signald.Signald) (err error) {
r.Version = "v1"
r.Type = "wait_for_scan"
if r.ID == "" {
r.ID = signald.GenerateID()
}
err = conn.RawRequest(r)
if err != nil {
log.Println("signald-go: error submitting request to signald")
return
}
responseChannel := conn.GetResponseListener(r.ID)
defer conn.CloseResponseListener(r.ID)
rawResponse := <-responseChannel
if rawResponse.Error != nil {
err = mkerr(rawResponse)
return
}
return err
}

View file

@ -62,6 +62,11 @@ type ApproveMembershipRequest struct {
Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` // list of requesting members to approve Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` // list of requesting members to approve
} }
// BooleanMessage: A message containing a single boolean, usually as a response
type BooleanMessage struct {
Value bool `json:"value,omitempty" yaml:"value,omitempty"`
}
type BusyMessage struct { type BusyMessage struct {
ID int64 `json:"id,omitempty" yaml:"id,omitempty"` ID int64 `json:"id,omitempty" yaml:"id,omitempty"`
} }
@ -77,9 +82,12 @@ type CallMessage struct {
} }
type Capabilities struct { type Capabilities struct {
Gv1Migration bool `json:"gv1-migration,omitempty" yaml:"gv1-migration,omitempty"` AnnouncementGroup bool `json:"announcement_group,omitempty" yaml:"announcement_group,omitempty"`
Gv2 bool `json:"gv2,omitempty" yaml:"gv2,omitempty"` ChangeNumber bool `json:"change_number,omitempty" yaml:"change_number,omitempty"`
Storage bool `json:"storage,omitempty" yaml:"storage,omitempty"` Gv1Migration bool `json:"gv1-migration,omitempty" yaml:"gv1-migration,omitempty"`
Gv2 bool `json:"gv2,omitempty" yaml:"gv2,omitempty"`
SenderKey bool `json:"sender_key,omitempty" yaml:"sender_key,omitempty"`
Storage bool `json:"storage,omitempty" yaml:"storage,omitempty"`
} }
// ClientMessageWrapper: Wraps all incoming messages sent to the client after a v1 subscribe request is issued // ClientMessageWrapper: Wraps all incoming messages sent to the client after a v1 subscribe request is issued
@ -115,7 +123,7 @@ type DeviceInfo struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"`
} }
// FinishLinkRequest: After a linking URI has been requested, finish_link must be called with the session_id provided with the URI. it will return information about the new account once the linking process is completed by the other device. // FinishLinkRequest: After a linking URI has been requested, finish_link must be called with the session_id provided with the URI. it will return information about the new account once the linking process is completed by the other device and the new account is setup. Note that the account setup process can sometimes take some time, if rapid userfeedback is required after scanning, use wait_for_scan first, then finish setup with finish_link.
type FinishLinkRequest struct { type FinishLinkRequest struct {
Request Request
DeviceName string `json:"device_name,omitempty" yaml:"device_name,omitempty"` DeviceName string `json:"device_name,omitempty" yaml:"device_name,omitempty"`
@ -134,7 +142,7 @@ type GetAllIdentities struct {
Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with
} }
// GetGroupRequest: Query the server for the latest state of a known group. If no account in signald is a member of the group (anymore), an error with error_type: 'UnknownGroupError' is returned. // GetGroupRequest: Query the server for the latest state of a known group. If the account is not a member of the group, an UnknownGroupError is returned.
type GetGroupRequest struct { type GetGroupRequest struct {
Request Request
Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with
@ -243,6 +251,13 @@ type IncomingMessage struct {
UnidentifiedSender bool `json:"unidentified_sender,omitempty" yaml:"unidentified_sender,omitempty"` UnidentifiedSender bool `json:"unidentified_sender,omitempty" yaml:"unidentified_sender,omitempty"`
} }
// IsIdentifierRegisteredRequest: Determine whether an account identifier is registered on the Signal service.
type IsIdentifierRegisteredRequest struct {
Request
Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to use to use
Identifier string `json:"identifier,omitempty" yaml:"identifier,omitempty"` // The UUID of an identifier to check if it is registered on Signal. This UUID is either a Phone Number Identity (PNI) or an Account Identity (ACI).
}
// JoinGroupRequest: Join a group using the a signal.group URL. Note that you must have a profile name set to join groups. // JoinGroupRequest: Join a group using the a signal.group URL. Note that you must have a profile name set to join groups.
type JoinGroupRequest struct { type JoinGroupRequest struct {
Request Request
@ -256,7 +271,7 @@ type JsonAddress struct {
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` // A UUID, the unique identifier for a particular Signal account. UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` // A UUID, the unique identifier for a particular Signal account.
} }
// JsonAttachment: represents a file attached to a message. When seding, only `filename` is required. // JsonAttachment: represents a file attached to a message. When sending, only `filename` is required.
type JsonAttachment struct { type JsonAttachment struct {
Blurhash string `json:"blurhash,omitempty" yaml:"blurhash,omitempty"` Blurhash string `json:"blurhash,omitempty" yaml:"blurhash,omitempty"`
Caption string `json:"caption,omitempty" yaml:"caption,omitempty"` Caption string `json:"caption,omitempty" yaml:"caption,omitempty"`
@ -279,24 +294,24 @@ type JsonBlockedListMessage struct {
} }
type JsonDataMessage struct { type JsonDataMessage struct {
Attachments []*JsonAttachment `json:"attachments,omitempty" yaml:"attachments,omitempty"` // files attached to the incoming message Attachments []*JsonAttachment `json:"attachments,omitempty" yaml:"attachments,omitempty"` // files attached to the incoming message
Body string `json:"body,omitempty" yaml:"body,omitempty"` // the text body of the incoming message. Body string `json:"body,omitempty" yaml:"body,omitempty"` // the text body of the incoming message.
Contacts []*v0.SharedContact `json:"contacts,omitempty" yaml:"contacts,omitempty"` // if the incoming message has a shared contact, the contact's information will be here Contacts []*SharedContact `json:"contacts,omitempty" yaml:"contacts,omitempty"` // if the incoming message has a shared contact, the contact's information will be here
EndSession bool `json:"endSession,omitempty" yaml:"endSession,omitempty"` EndSession bool `json:"endSession,omitempty" yaml:"endSession,omitempty"`
ExpiresInSeconds int32 `json:"expiresInSeconds,omitempty" yaml:"expiresInSeconds,omitempty"` // the expiry timer on the incoming message. Clients should delete records of the message within this number of seconds ExpiresInSeconds int32 `json:"expiresInSeconds,omitempty" yaml:"expiresInSeconds,omitempty"` // the expiry timer on the incoming message. Clients should delete records of the message within this number of seconds
Group *JsonGroupInfo `json:"group,omitempty" yaml:"group,omitempty"` // if the incoming message was sent to a v1 group, information about that group will be here Group *JsonGroupInfo `json:"group,omitempty" yaml:"group,omitempty"` // if the incoming message was sent to a v1 group, information about that group will be here
GroupV2 *JsonGroupV2Info `json:"groupV2,omitempty" yaml:"groupV2,omitempty"` // if the incoming message was sent to a v2 group, basic identifying information about that group will be here. If group information changes, JsonGroupV2Info.revision is incremented. If the group revision is higher than previously seen, a client can retrieve the group information by calling get_group. GroupV2 *JsonGroupV2Info `json:"groupV2,omitempty" yaml:"groupV2,omitempty"` // if the incoming message was sent to a v2 group, basic identifying information about that group will be here. If group information changes, JsonGroupV2Info.revision is incremented. If the group revision is higher than previously seen, a client can retrieve the group information by calling get_group.
GroupCallUpdate string `json:"group_call_update,omitempty" yaml:"group_call_update,omitempty"` // the eraId string from a group call message update GroupCallUpdate string `json:"group_call_update,omitempty" yaml:"group_call_update,omitempty"` // the eraId string from a group call message update
Mentions []*JsonMention `json:"mentions,omitempty" yaml:"mentions,omitempty"` // list of mentions in the message Mentions []*JsonMention `json:"mentions,omitempty" yaml:"mentions,omitempty"` // list of mentions in the message
Payment *Payment `json:"payment,omitempty" yaml:"payment,omitempty"` // details about the MobileCoin payment attached to the message, if present Payment *Payment `json:"payment,omitempty" yaml:"payment,omitempty"` // details about the MobileCoin payment attached to the message, if present
Previews []*JsonPreview `json:"previews,omitempty" yaml:"previews,omitempty"` // if the incoming message has a link preview, information about that preview will be here Previews []*JsonPreview `json:"previews,omitempty" yaml:"previews,omitempty"` // if the incoming message has a link preview, information about that preview will be here
ProfileKeyUpdate bool `json:"profileKeyUpdate,omitempty" yaml:"profileKeyUpdate,omitempty"` ProfileKeyUpdate bool `json:"profileKeyUpdate,omitempty" yaml:"profileKeyUpdate,omitempty"`
Quote *JsonQuote `json:"quote,omitempty" yaml:"quote,omitempty"` // if the incoming message is a quote or reply to another message, this will contain information about that message Quote *JsonQuote `json:"quote,omitempty" yaml:"quote,omitempty"` // if the incoming message is a quote or reply to another message, this will contain information about that message
Reaction *JsonReaction `json:"reaction,omitempty" yaml:"reaction,omitempty"` // if the message adds or removes a reaction to another message, this will indicate what change is being made Reaction *JsonReaction `json:"reaction,omitempty" yaml:"reaction,omitempty"` // if the message adds or removes a reaction to another message, this will indicate what change is being made
RemoteDelete *RemoteDelete `json:"remoteDelete,omitempty" yaml:"remoteDelete,omitempty"` // if the inbound message is deleting a previously sent message, indicates which message should be deleted RemoteDelete *RemoteDelete `json:"remoteDelete,omitempty" yaml:"remoteDelete,omitempty"` // if the inbound message is deleting a previously sent message, indicates which message should be deleted
Sticker *v0.JsonSticker `json:"sticker,omitempty" yaml:"sticker,omitempty"` // if the incoming message is a sticker, information about the sicker will be here Sticker *v0.JsonSticker `json:"sticker,omitempty" yaml:"sticker,omitempty"` // if the incoming message is a sticker, information about the sicker will be here
Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` // the timestamp that the message was sent at, according to the sender's device. This is used to uniquely identify this message for things like reactions and quotes. Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` // the timestamp that the message was sent at, according to the sender's device. This is used to uniquely identify this message for things like reactions and quotes.
ViewOnce bool `json:"viewOnce,omitempty" yaml:"viewOnce,omitempty"` // indicates the message is a view once message. View once messages typically include no body and a single image attachment. Official Signal clients will prevent the user from saving the image, and once the user has viewed the image once they will destroy the image. ViewOnce bool `json:"viewOnce,omitempty" yaml:"viewOnce,omitempty"` // indicates the message is a view once message. View once messages typically include no body and a single image attachment. Official Signal clients will prevent the user from saving the image, and once the user has viewed the image once they will destroy the image.
} }
// JsonGroupInfo: information about a legacy group // JsonGroupInfo: information about a legacy group
@ -330,6 +345,7 @@ type JsonGroupV2Info struct {
Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"`
PendingMemberDetail []*GroupMember `json:"pendingMemberDetail,omitempty" yaml:"pendingMemberDetail,omitempty"` // detailed pending member list PendingMemberDetail []*GroupMember `json:"pendingMemberDetail,omitempty" yaml:"pendingMemberDetail,omitempty"` // detailed pending member list
PendingMembers []*JsonAddress `json:"pendingMembers,omitempty" yaml:"pendingMembers,omitempty"` PendingMembers []*JsonAddress `json:"pendingMembers,omitempty" yaml:"pendingMembers,omitempty"`
Removed bool `json:"removed,omitempty" yaml:"removed,omitempty"` // will be set to true for incoming messages to indicate the user has been removed from the group
RequestingMembers []*JsonAddress `json:"requestingMembers,omitempty" yaml:"requestingMembers,omitempty"` RequestingMembers []*JsonAddress `json:"requestingMembers,omitempty" yaml:"requestingMembers,omitempty"`
Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"`
Timer int32 `json:"timer,omitempty" yaml:"timer,omitempty"` Timer int32 `json:"timer,omitempty" yaml:"timer,omitempty"`
@ -522,6 +538,7 @@ type Profile struct {
MobilecoinAddress string `json:"mobilecoin_address,omitempty" yaml:"mobilecoin_address,omitempty"` // *base64-encoded* mobilecoin address. Note that this is not the traditional MobileCoin address encoding. Clients are responsible for converting between MobileCoin's custom base58 on the user-facing side and base64 encoding on the signald side. If unset, null or an empty string, will empty the profile payment address MobilecoinAddress string `json:"mobilecoin_address,omitempty" yaml:"mobilecoin_address,omitempty"` // *base64-encoded* mobilecoin address. Note that this is not the traditional MobileCoin address encoding. Clients are responsible for converting between MobileCoin's custom base58 on the user-facing side and base64 encoding on the signald side. If unset, null or an empty string, will empty the profile payment address
Name string `json:"name,omitempty" yaml:"name,omitempty"` // The user's name from local contact names if available, or if not in contact list their Signal profile name Name string `json:"name,omitempty" yaml:"name,omitempty"` // The user's name from local contact names if available, or if not in contact list their Signal profile name
ProfileName string `json:"profile_name,omitempty" yaml:"profile_name,omitempty"` // The user's Signal profile name ProfileName string `json:"profile_name,omitempty" yaml:"profile_name,omitempty"` // The user's Signal profile name
VisibleBadgeIds []string `json:"visible_badge_ids,omitempty" yaml:"visible_badge_ids,omitempty"` // currently unclear how these work, as they are not available in the production Signal apps
} }
type ProfileList struct { type ProfileList struct {
@ -612,6 +629,7 @@ type RequestSyncRequest struct {
Configuration bool `json:"configuration,omitempty" yaml:"configuration,omitempty"` // request configuration sync (default true) Configuration bool `json:"configuration,omitempty" yaml:"configuration,omitempty"` // request configuration sync (default true)
Contacts bool `json:"contacts,omitempty" yaml:"contacts,omitempty"` // request contact sync (default true) Contacts bool `json:"contacts,omitempty" yaml:"contacts,omitempty"` // request contact sync (default true)
Groups bool `json:"groups,omitempty" yaml:"groups,omitempty"` // request group sync (default true) Groups bool `json:"groups,omitempty" yaml:"groups,omitempty"` // request group sync (default true)
Keys bool `json:"keys,omitempty" yaml:"keys,omitempty"` // request storage service keys
} }
// ResetSessionRequest: reset a session with a particular user // ResetSessionRequest: reset a session with a particular user
@ -640,16 +658,16 @@ type SendPaymentRequest struct {
type SendRequest struct { type SendRequest struct {
Request Request
Attachments []*v0.JsonAttachment `json:"attachments,omitempty" yaml:"attachments,omitempty"` Attachments []*JsonAttachment `json:"attachments,omitempty" yaml:"attachments,omitempty"`
Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` // Optionally set to a sub-set of group members. Ignored if recipientGroupId isn't specified Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` // Optionally set to a sub-set of group members. Ignored if recipientGroupId isn't specified
Mentions []*JsonMention `json:"mentions,omitempty" yaml:"mentions,omitempty"` Mentions []*JsonMention `json:"mentions,omitempty" yaml:"mentions,omitempty"`
MessageBody string `json:"messageBody,omitempty" yaml:"messageBody,omitempty"` MessageBody string `json:"messageBody,omitempty" yaml:"messageBody,omitempty"`
Previews []*JsonPreview `json:"previews,omitempty" yaml:"previews,omitempty"` Previews []*JsonPreview `json:"previews,omitempty" yaml:"previews,omitempty"`
Quote *JsonQuote `json:"quote,omitempty" yaml:"quote,omitempty"` Quote *JsonQuote `json:"quote,omitempty" yaml:"quote,omitempty"`
RecipientAddress *JsonAddress `json:"recipientAddress,omitempty" yaml:"recipientAddress,omitempty"` RecipientAddress *JsonAddress `json:"recipientAddress,omitempty" yaml:"recipientAddress,omitempty"`
RecipientGroupID string `json:"recipientGroupId,omitempty" yaml:"recipientGroupId,omitempty"` RecipientGroupID string `json:"recipientGroupId,omitempty" yaml:"recipientGroupId,omitempty"`
Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"` Username string `json:"username,omitempty" yaml:"username,omitempty"`
} }
type SendResponse struct { type SendResponse struct {
@ -692,7 +710,7 @@ type ServerList struct {
Servers []*Server `json:"servers,omitempty" yaml:"servers,omitempty"` Servers []*Server `json:"servers,omitempty" yaml:"servers,omitempty"`
} }
// SetDeviceNameRequest: set this device's name. This will show up on the mobile device on the same account under // SetDeviceNameRequest: set this device's name. This will show up on the mobile device on the same account under settings -> linked devices
type SetDeviceNameRequest struct { type SetDeviceNameRequest struct {
Request Request
Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to set the device name of Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to set the device name of
@ -710,12 +728,60 @@ type SetExpirationRequest struct {
type SetProfile struct { type SetProfile struct {
Request Request
About string `json:"about,omitempty" yaml:"about,omitempty"` // an optional about string. If unset, null or an empty string will unset profile about field About string `json:"about,omitempty" yaml:"about,omitempty"` // Change the 'about' profile field
Account string `json:"account,omitempty" yaml:"account,omitempty"` // The phone number of the account to use Account string `json:"account,omitempty" yaml:"account,omitempty"` // The phone number of the account to use
AvatarFile string `json:"avatarFile,omitempty" yaml:"avatarFile,omitempty"` // Path to new profile avatar file. If unset or null, unset the profile avatar AvatarFile string `json:"avatarFile,omitempty" yaml:"avatarFile,omitempty"` // Path to new profile avatar file. If unset or null, unset the profile avatar
Emoji string `json:"emoji,omitempty" yaml:"emoji,omitempty"` // an optional single emoji character. If unset, null or an empty string will unset profile emoji Emoji string `json:"emoji,omitempty" yaml:"emoji,omitempty"` // Change the profile emoji
MobilecoinAddress string `json:"mobilecoin_address,omitempty" yaml:"mobilecoin_address,omitempty"` // an optional *base64-encoded* MobileCoin address to set in the profile. Note that this is not the traditional MobileCoin address encoding, which is custom. Clients are responsible for converting between MobileCoin's custom base58 on the user-facing side and base64 encoding on the signald side. If unset, null or an empty string, will empty the profile payment address MobilecoinAddress string `json:"mobilecoin_address,omitempty" yaml:"mobilecoin_address,omitempty"` // Change the profile payment address. Payment address must be a *base64-encoded* MobileCoin address. Note that this is not the traditional MobileCoin address encoding, which is custom. Clients are responsible for converting between MobileCoin's custom base58 on the user-facing side and base64 encoding on the signald side.
Name string `json:"name,omitempty" yaml:"name,omitempty"` // New profile name. Set to empty string for no profile name Name string `json:"name,omitempty" yaml:"name,omitempty"` // Change the profile name
VisibleBadgeIds []string `json:"visible_badge_ids,omitempty" yaml:"visible_badge_ids,omitempty"` // configure visible badge IDs
}
type SharedContact struct {
Address []*SharedContactAddress `json:"address,omitempty" yaml:"address,omitempty"` // the physical addresses of the shared contact
Avatar *SharedContactAvatar `json:"avatar,omitempty" yaml:"avatar,omitempty"` // the profile picture/avatar of the shared contact
Email []*SharedContactEmail `json:"email,omitempty" yaml:"email,omitempty"` // the email addresses of the shared contact
Name *SharedContactName `json:"name,omitempty" yaml:"name,omitempty"` // the name of the shared contact
Organization string `json:"organization,omitempty" yaml:"organization,omitempty"` // the organization (e.g. workplace) of the shared contact
Phone []*SharedContactPhone `json:"phone,omitempty" yaml:"phone,omitempty"` // the phone numbers of the shared contact
}
type SharedContactAddress struct {
City string `json:"city,omitempty" yaml:"city,omitempty"`
Country string `json:"country,omitempty" yaml:"country,omitempty"`
Label string `json:"label,omitempty" yaml:"label,omitempty"`
Neighborhood string `json:"neighborhood,omitempty" yaml:"neighborhood,omitempty"`
Pobox string `json:"pobox,omitempty" yaml:"pobox,omitempty"`
Postcode string `json:"postcode,omitempty" yaml:"postcode,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
Street string `json:"street,omitempty" yaml:"street,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"` // the type of address (options: HOME, WORK, CUSTOM)
}
type SharedContactAvatar struct {
Attachment *JsonAttachment `json:"attachment,omitempty" yaml:"attachment,omitempty"`
IsProfile bool `json:"is_profile,omitempty" yaml:"is_profile,omitempty"`
}
type SharedContactEmail struct {
Label string `json:"label,omitempty" yaml:"label,omitempty"` // the type label when type is CUSTOM
Type string `json:"type,omitempty" yaml:"type,omitempty"` // the type of email (options: HOME, WORK, MOBILE, CUSTOM)
Value string `json:"value,omitempty" yaml:"value,omitempty"` // the email address
}
type SharedContactName struct {
Display string `json:"display,omitempty" yaml:"display,omitempty"` // the full name that should be displayed
Family string `json:"family,omitempty" yaml:"family,omitempty"` // family name (surname)
Given string `json:"given,omitempty" yaml:"given,omitempty"` // given name
Middle string `json:"middle,omitempty" yaml:"middle,omitempty"` // middle name
Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty"`
Suffix string `json:"suffix,omitempty" yaml:"suffix,omitempty"`
}
type SharedContactPhone struct {
Label string `json:"label,omitempty" yaml:"label,omitempty"` // the type label when type is CUSTOM
Type string `json:"type,omitempty" yaml:"type,omitempty"` // the type of phone (options: HOME, WORK, MOBILE, CUSTOM)
Value string `json:"value,omitempty" yaml:"value,omitempty"` // the phone number
} }
type SubmitChallengeRequest struct { type SubmitChallengeRequest struct {
@ -801,6 +867,12 @@ type VersionRequest struct {
Request Request
} }
// WaitForScanRequest: An optional part of the linking process. Intended to be called after displaying the QR code, will return quickly after the user scans the QR code. finish_link must be called after wait_for_scan returns a non-error
type WaitForScanRequest struct {
Request
SessionId string `json:"session_id,omitempty" yaml:"session_id,omitempty"`
}
// WebSocketConnectionState: indicates when the websocket connection state to the signal server has changed // WebSocketConnectionState: indicates when the websocket connection state to the signal server has changed
type WebSocketConnectionState struct { type WebSocketConnectionState struct {
Socket string `json:"socket,omitempty" yaml:"socket,omitempty"` // One of: UNIDENTIFIED, IDENTIFIED Socket string `json:"socket,omitempty" yaml:"socket,omitempty"` // One of: UNIDENTIFIED, IDENTIFIED