signald-go/protocol.json

945 lines
23 KiB
JSON

{
"doc_version": "v1alpha1",
"version": {
"name": "signald",
"version": "0.10.0+git2020-12-06rcea5cb72.51",
"branch": "refactor-client-request-handling",
"commit": "cea5cb720355afdca460aa30257bdd1317494c7b"
},
"info": "This document describes objects that may be used when communicating with signald. If this document lacks something you need to generate a client, please open an issue (https://gitlab.com/thefinn93/signald/-/issues/new). This is an initial proposal for the format, and I expect to change it before finalizing it. If it workswell, I hope to slowly move things out of the legacy request types.",
"types": {
"v1": {
"JsonMessageEnvelope": {
"fields": {
"username": {
"type": "String"
},
"uuid": {
"type": "String"
},
"source": {
"type": "JsonAddress",
"version": "v1"
},
"sourceDevice": {
"type": "int"
},
"type": {
"type": "String"
},
"relay": {
"type": "String"
},
"timestamp": {
"type": "long"
},
"timestampISO": {
"type": "String"
},
"serverTimestamp": {
"type": "long"
},
"serverDeliveredTimestamp": {
"type": "long"
},
"hasLegacyMessage": {
"type": "boolean"
},
"hasContent": {
"type": "boolean"
},
"isUnidentifiedSender": {
"type": "boolean"
},
"dataMessage": {
"type": "JsonDataMessage",
"version": "v1"
},
"syncMessage": {
"type": "JsonSyncMessage",
"version": "v1"
},
"callMessage": {
"type": "JsonCallMessage",
"version": "v0"
},
"receipt": {
"type": "JsonReceiptMessage",
"version": "v0"
},
"typing": {
"type": "JsonTypingMessage",
"version": "v0"
}
}
},
"SendRequest": {
"fields": {
"username": {
"type": "String"
},
"recipientAddress": {
"type": "JsonAddress",
"version": "v1"
},
"recipientGroupId": {
"type": "String"
},
"messageBody": {
"type": "String"
},
"attachments": {
"list": true,
"type": "JsonAttachment",
"version": "v0"
},
"quote": {
"type": "JsonQuote",
"version": "v1"
},
"timestamp": {
"type": "Long"
},
"mentions": {
"list": true,
"type": "JsonMention",
"version": "v1"
}
}
},
"SendResponse": {
"fields": {
"results": {
"list": true,
"type": "JsonSendMessageResult",
"version": "v1"
},
"timestamp": {
"type": "long"
}
}
},
"ReactRequest": {
"fields": {
"username": {
"type": "String"
},
"recipientAddress": {
"type": "JsonAddress",
"version": "v1"
},
"recipientGroupId": {
"type": "String"
},
"reaction": {
"type": "JsonReaction",
"version": "v1"
},
"timestamp": {
"type": "long"
}
},
"doc": "react to a previous message"
},
"VersionRequest": {
"fields": {}
},
"JsonVersionMessage": {
"fields": {
"name": {
"type": "String"
},
"version": {
"type": "String"
},
"branch": {
"type": "String"
},
"commit": {
"type": "String"
}
}
},
"JsonAddress": {
"fields": {
"number": {
"type": "String",
"doc": "An e164 phone number, starting with +. Currently the only available user-facing Signal identifier."
},
"uuid": {
"type": "UUID",
"doc": "A UUID, the unique identifier for a particular Signal account."
},
"relay": {
"type": "String"
}
}
},
"JsonDataMessage": {
"fields": {
"timestamp": {
"type": "long",
"doc": "the (unix) 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."
},
"attachments": {
"list": true,
"type": "JsonAttachment",
"version": "v0",
"doc": "files attached to the incoming message"
},
"body": {
"type": "String",
"doc": "the text body of the incoming message."
},
"group": {
"type": "JsonGroupInfo",
"version": "v1",
"doc": "if the incoming message was sent to a v1 group, information about that group will be here"
},
"groupV2": {
"type": "JsonGroupV2Info",
"version": "v1",
"doc": "is the incoming message was sent to a v2 group, basic identifying information about that group will be here. For full information, use list_groups"
},
"endSession": {
"type": "boolean"
},
"expiresInSeconds": {
"type": "int",
"doc": "the expiry timer on the incoming message. Clients should delete records of the message within this number of seconds"
},
"profileKeyUpdate": {
"type": "boolean"
},
"quote": {
"type": "JsonQuote",
"version": "v1",
"doc": "if the incoming message is a quote or reply to another message, this will contain information about that message"
},
"contacts": {
"list": true,
"type": "SharedContact",
"version": "v0",
"doc": "if the incoming message has a shared contact, the contact's information will be here"
},
"previews": {
"list": true,
"type": "JsonPreview",
"version": "v0",
"doc": "if the incoming message has a link preview, information about that preview will be here"
},
"sticker": {
"type": "JsonSticker",
"version": "v0",
"doc": "if the incoming message is a sticker, information about the sicker will be here"
},
"viewOnce": {
"type": "boolean",
"doc": "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."
},
"reaction": {
"type": "JsonReaction",
"version": "v1",
"doc": "if the message adds or removes a reaction to another message, this will indicate what change is being made"
},
"remoteDelete": {
"type": "RemoteDelete",
"version": "v0",
"doc": "if the inbound message is deleting a previously sent message, indicates which message should be deleted"
}
}
},
"JsonSyncMessage": {
"fields": {
"sent": {
"type": "JsonSentTranscriptMessage",
"version": "v1"
},
"contacts": {
"type": "JsonAttachment",
"version": "v0"
},
"contactsComplete": {
"type": "boolean"
},
"groups": {
"type": "JsonAttachment",
"version": "v0"
},
"blockedList": {
"type": "JsonBlockedListMessage",
"version": "v1"
},
"request": {
"type": "String"
},
"readMessages": {
"list": true,
"type": "JsonReadMessage",
"version": "v1"
},
"viewOnceOpen": {
"type": "JsonViewOnceOpenMessage",
"version": "v1"
},
"verified": {
"type": "JsonVerifiedMessage",
"version": "v1"
},
"configuration": {
"type": "ConfigurationMessage",
"version": "v0"
},
"stickerPackOperations": {
"list": true,
"type": "JsonStickerPackOperationMessage",
"version": "v0"
},
"fetchType": {
"type": "String"
},
"messageRequestResponse": {
"type": "JsonMessageRequestResponseMessage",
"version": "v1"
}
}
},
"JsonQuote": {
"fields": {
"id": {
"type": "long"
},
"author": {
"type": "JsonAddress",
"version": "v1"
},
"text": {
"type": "String"
},
"attachments": {
"list": true,
"type": "JsonQuotedAttachment",
"version": "v0"
},
"mentions": {
"list": true,
"type": "Mention",
"version": "v0"
}
},
"doc": "A quote is a reply to a previous message. ID is the sent time of the message being replied to"
},
"JsonMention": {
"fields": {
"uuid": {
"type": "String"
},
"start": {
"type": "int"
},
"length": {
"type": "int"
}
}
},
"JsonSendMessageResult": {
"fields": {
"address": {
"type": "JsonAddress",
"version": "v1"
},
"success": {
"type": "Success",
"version": "v0"
},
"networkFailure": {
"type": "boolean"
},
"unregisteredFailure": {
"type": "boolean"
},
"identityFailure": {
"type": "String"
}
}
},
"JsonReaction": {
"fields": {
"emoji": {
"type": "String",
"doc": "the emoji to react with"
},
"remove": {
"type": "boolean",
"doc": "set to true to remove the reaction. requires emoji be set to previously reacted emoji"
},
"targetAuthor": {
"type": "JsonAddress",
"version": "v1",
"doc": "the author of the message being reacted to"
},
"targetSentTimestamp": {
"type": "long",
"doc": "the client timestamp of the message being reacted to"
}
}
},
"JsonGroupInfo": {
"fields": {
"groupId": {
"type": "String"
},
"members": {
"list": true,
"type": "JsonAddress",
"version": "v1"
},
"name": {
"type": "String"
},
"type": {
"type": "String"
},
"avatarId": {
"type": "long"
}
}
},
"JsonGroupV2Info": {
"fields": {
"id": {
"type": "String"
},
"masterKey": {
"type": "String"
},
"revision": {
"type": "int"
},
"title": {
"type": "String"
},
"timer": {
"type": "int"
},
"members": {
"list": true,
"type": "JsonAddress",
"version": "v1"
},
"pendingMembers": {
"list": true,
"type": "JsonAddress",
"version": "v1"
},
"requestingMembers": {
"list": true,
"type": "JsonAddress",
"version": "v1"
},
"inviteLinkPassword": {
"type": "String"
}
}
},
"JsonSentTranscriptMessage": {
"fields": {
"destination": {
"type": "JsonAddress",
"version": "v1"
},
"timestamp": {
"type": "long"
},
"expirationStartTimestamp": {
"type": "long"
},
"message": {
"type": "JsonDataMessage",
"version": "v1"
},
"unidentifiedStatus": {
"type": "Map"
},
"isRecipientUpdate": {
"type": "boolean"
}
}
},
"JsonBlockedListMessage": {
"fields": {
"addresses": {
"list": true,
"type": "JsonAddress",
"version": "v1"
},
"groupIds": {
"list": true,
"type": "String"
}
}
},
"JsonReadMessage": {
"fields": {
"sender": {
"type": "JsonAddress",
"version": "v1"
},
"timestamp": {
"type": "long"
}
}
},
"JsonViewOnceOpenMessage": {
"fields": {
"sender": {
"type": "JsonAddress",
"version": "v1"
},
"timestamp": {
"type": "long"
}
}
},
"JsonVerifiedMessage": {
"fields": {
"destination": {
"type": "JsonAddress",
"version": "v1"
},
"identityKey": {
"type": "String"
},
"verified": {
"type": "String"
},
"timestamp": {
"type": "long"
}
}
},
"JsonMessageRequestResponseMessage": {
"fields": {
"person": {
"type": "JsonAddress",
"version": "v1"
},
"groupId": {
"type": "String"
},
"type": {
"type": "String"
}
}
}
},
"v0": {
"JsonAccountList": {
"fields": {
"accounts": {
"list": true,
"type": "JsonAccount",
"version": "v0"
}
}
},
"JsonCallMessage": {
"fields": {
"offerMessage": {
"type": "OfferMessage",
"version": "v0"
},
"answerMessage": {
"type": "AnswerMessage",
"version": "v0"
},
"busyMessage": {
"type": "BusyMessage",
"version": "v0"
},
"hangupMessage": {
"type": "HangupMessage",
"version": "v0"
},
"iceUpdateMessages": {
"list": true,
"type": "IceUpdateMessage",
"version": "v0"
},
"destinationDeviceId": {
"type": "int"
},
"isMultiRing": {
"type": "boolean"
}
}
},
"JsonReceiptMessage": {
"fields": {
"type": {
"type": "String"
},
"timestamps": {
"list": true,
"type": "Long"
},
"when": {
"type": "long"
}
}
},
"JsonTypingMessage": {
"fields": {
"action": {
"type": "String"
},
"timestamp": {
"type": "long"
},
"groupId": {
"type": "String"
}
}
},
"JsonAccount": {
"fields": {
"deviceId": {
"type": "int"
},
"username": {
"type": "String"
},
"filename": {
"type": "String"
},
"uuid": {
"type": "String"
},
"registered": {
"type": "boolean"
},
"has_keys": {
"type": "boolean"
},
"subscribed": {
"type": "boolean"
}
}
},
"JsonAttachment": {
"fields": {
"contentType": {
"type": "String"
},
"id": {
"type": "String"
},
"size": {
"type": "int"
},
"storedFilename": {
"type": "String"
},
"filename": {
"type": "String"
},
"customFilename": {
"type": "String"
},
"caption": {
"type": "String"
},
"width": {
"type": "int"
},
"height": {
"type": "int"
},
"voiceNote": {
"type": "boolean"
},
"key": {
"type": "String"
},
"digest": {
"type": "String"
},
"blurhash": {
"type": "String"
}
}
},
"SharedContact": {
"fields": {
"name": {
"type": "Name",
"version": "v0"
},
"avatar": {
"type": "Optional",
"version": "v0"
},
"phone": {
"type": "Optional",
"version": "v0"
},
"email": {
"type": "Optional",
"version": "v0"
},
"address": {
"type": "Optional",
"version": "v0"
},
"organization": {
"type": "Optional",
"version": "v0"
}
}
},
"JsonPreview": {
"fields": {
"url": {
"type": "String"
},
"title": {
"type": "String"
},
"attachment": {
"type": "JsonAttachment",
"version": "v0"
}
}
},
"JsonSticker": {
"fields": {
"packID": {
"type": "String"
},
"packKey": {
"type": "String"
},
"stickerID": {
"type": "int"
},
"attachment": {
"type": "JsonAttachment",
"version": "v0"
}
}
},
"RemoteDelete": {
"fields": {
"targetSentTimestamp": {
"type": "long"
}
}
},
"ConfigurationMessage": {
"fields": {
"readReceipts": {
"type": "Optional",
"version": "v0"
},
"unidentifiedDeliveryIndicators": {
"type": "Optional",
"version": "v0"
},
"typingIndicators": {
"type": "Optional",
"version": "v0"
},
"linkPreviews": {
"type": "Optional",
"version": "v0"
}
}
},
"JsonStickerPackOperationMessage": {
"fields": {
"packID": {
"type": "String"
},
"packKey": {
"type": "String"
},
"type": {
"type": "String"
}
}
},
"OfferMessage": {
"fields": {
"id": {
"type": "long"
},
"sdp": {
"type": "String"
},
"type": {
"type": "Type",
"version": "v0"
},
"opaque": {
"type": "String"
}
}
},
"AnswerMessage": {
"fields": {
"id": {
"type": "long"
},
"sdp": {
"type": "String"
},
"opaque": {
"type": "String"
}
}
},
"BusyMessage": {
"fields": {
"id": {
"type": "long"
}
}
},
"HangupMessage": {
"fields": {
"id": {
"type": "long"
},
"type": {
"type": "Type",
"version": "v0"
},
"deviceId": {
"type": "int"
},
"legacy": {
"type": "boolean"
}
}
},
"IceUpdateMessage": {
"fields": {
"id": {
"type": "long"
},
"opaque": {
"type": "String"
},
"sdp": {
"type": "String"
}
}
},
"JsonQuotedAttachment": {
"fields": {
"contentType": {
"type": "String"
},
"fileName": {
"type": "String"
},
"thumbnail": {
"type": "JsonAttachment",
"version": "v0"
}
}
},
"Mention": {
"fields": {
"uuid": {
"type": "UUID"
},
"start": {
"type": "int"
},
"length": {
"type": "int"
}
}
},
"Success": {
"fields": {
"unidentified": {
"type": "boolean"
},
"needsSync": {
"type": "boolean"
},
"duration": {
"type": "long"
}
}
},
"Name": {
"fields": {
"display": {
"type": "Optional",
"version": "v0"
},
"given": {
"type": "Optional",
"version": "v0"
},
"family": {
"type": "Optional",
"version": "v0"
},
"prefix": {
"type": "Optional",
"version": "v0"
},
"suffix": {
"type": "Optional",
"version": "v0"
},
"middle": {
"type": "Optional",
"version": "v0"
}
}
},
"Optional": {
"fields": {
"present": {
"type": "boolean"
}
}
},
"Type": {
"fields": {}
}
},
"v1alpha1": {
"ProtocolRequest": {
"fields": {}
}
}
},
"actions": {
"v1": {
"send": {
"request": "SendRequest",
"response": "SendResponse"
},
"react": {
"request": "ReactRequest",
"response": "SendResponse",
"doc": "react to a previous message"
},
"version": {
"request": "VersionRequest",
"response": "JsonVersionMessage"
}
},
"v1alpha1": {
"protocol": {
"request": "ProtocolRequest"
}
}
}
}