diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 99cae85..994e572 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,11 +1,10 @@ stages: - build - - test - publish lint: - image: golang:1.17 - stage: test + image: golang:latest + stage: build before_script: - apt-get update - apt-get install -y wget golang-go @@ -18,30 +17,6 @@ lint: - diff --color=always go.sum "${CI_PROJECT_DIR}/go.sum" rules: - when: on_success - needs: [] - -test sqlite to postgres: - image: - name: registry.gitlab.com/signald/signald:unstable - entrypoint: [""] - stage: test - needs: - - "build:x86" - before_script: - - apt-get update && apt-get install -y postgresql-client - script: - - cd / - - signald --migrate-data - - echo 'CREATE DATABASE signald' | psql -h postgres -U postgres -a - - "${CI_PROJECT_DIR}/signaldctl db-move postgresql://postgres@postgres/signald?sslmode=disable" - - SIGNALD_DATABASE=postgresql://postgres@postgres/signald?sslmode=disable signald --migrate-data - variables: - SIGNALD_VERBOSE_LOGGING: "true" - services: - - name: postgres:latest - alias: postgres - variables: - POSTGRES_HOST_AUTH_METHOD: trust .build: stage: build @@ -62,22 +37,27 @@ test sqlite to postgres: .build-deb: stage: build image: debian:buster - before_script: + script: - echo deb http://deb.debian.org/debian buster-backports main > /etc/apt/sources.list.d/backports.list - apt-get update - - apt-get install -y -t buster-backports git-buildpackage dh-golang bash-completion golang-any golang-github-spf13-cobra-dev golang-github-spf13-viper-dev golang-github-google-uuid-dev golang-github-mattn-go-sqlite3-dev golang-github-lib-pq-dev golang-github-satori-go.uuid-dev wget unzip - - wget -O golang-github-mdp-qrterminal.zip --quiet "https://gitlab.com/api/v4/projects/signald%2Flibraries%2Fgolang-github-mdp-qrterminal/jobs/artifacts/master/download?job=build" - - wget -O golang-github-jedib0t-go-pretty.zip --quiet "https://gitlab.com/api/v4/projects/signald%2Flibraries%2Fgolang-github-jedib0t-go-pretty/jobs/artifacts/master/download?job=build" - - for z in *.zip; do unzip $z; done + - apt-get install -y -t buster-backports git-buildpackage dh-golang bash-completion golang-any golang-github-spf13-cobra-dev golang-github-spf13-viper-dev golang-github-google-uuid-dev golang-github-mattn-go-sqlite3-dev golang-github-lib-pq-dev golang-github-satori-go.uuid-dev - apt-get install -y ./*.deb && rm -vf *.deb - script: - 'sed -i "s/^Architecture:.*/Architecture: ${ARCH}/g" debian/control' - go run ./cmd/signaldctl doc -o man - go run ./cmd/signaldctl completion bash > debian/package.bash-completion - ls *.1 > debian/manpages - - gbp dch --ignore-branch --debian-tag="%(version)s" --git-author --new-version="$(./version.sh | cut -c2-)" + - gbp dch --ignore-branch --debian-tag="%(version)s" --git-author --new-version="$(./version.sh)" - dpkg-buildpackage -us -uc -b - mv ../*.deb . + needs: + - project: signald/libraries/golang-github-mdp-qrterminal + job: build + ref: master + artifacts: true + - project: signald/libraries/golang-github-jedib0t-go-pretty + job: build + ref: master + artifacts: true variables: SIGNALDCTL_PUBLIC_DOC_MODE: "on" artifacts: @@ -162,11 +142,9 @@ publish deb: - aptly repo create signald - aptly mirror create -ignore-signatures backfill-mirror https://updates.signald.org "${DISTRIBUTION}" main - aptly mirror update -ignore-signatures backfill-mirror - - aptly repo import backfill-mirror signald signald 'signaldctl (>= 0.3.0)' + - aptly repo import backfill-mirror signald signald signaldctl - aptly repo add signald *.deb - - gpg1 --import "${SIGNING_KEY_PATH}" - - gpg1 --list-secret-keys - - aptly publish repo -config=.aptly.conf -batch -gpg-key="${SIGNING_KEY_ID}" -distribution="${DISTRIBUTION}" "signald" "s3:updates.signald.org:" + - aptly publish repo -config=.aptly.conf -batch -gpg-key="${SIGNING_KEY}" -distribution="${DISTRIBUTION}" "signald" "s3:updates.signald.org:" variables: DISTRIBUTION: unstable rules: diff --git a/cmd/signaldctl/cmd/account/link/link-account.go b/cmd/signaldctl/cmd/account/link/link-account.go index 9cb3fa3..899815d 100644 --- a/cmd/signaldctl/cmd/account/link/link-account.go +++ b/cmd/signaldctl/cmd/account/link/link-account.go @@ -34,7 +34,6 @@ import ( var ( testing bool deviceName string - overwrite bool LinkAccountCmd = &cobra.Command{ Use: "link", @@ -81,7 +80,6 @@ var ( finishReq := v1.FinishLinkRequest{ DeviceName: deviceName, SessionId: response.SessionId, - Overwrite: overwrite, } _, err = finishReq.Submit(common.Signald) @@ -101,5 +99,4 @@ func init() { } LinkAccountCmd.Flags().BoolVarP(&testing, "testing", "t", false, "use the Signal testing server") LinkAccountCmd.Flags().StringVarP(&deviceName, "device-name", "n", name, "the name of this device. shown to other devices on the signal account") - LinkAccountCmd.Flags().BoolVar(&overwrite, "overwrite", false, "if an account with the same id already exists in signald's database, delete it before linking") } diff --git a/cmd/signaldctl/cmd/account/requestsync/main.go b/cmd/signaldctl/cmd/account/requestsync/main.go deleted file mode 100644 index 480a595..0000000 --- a/cmd/signaldctl/cmd/account/requestsync/main.go +++ /dev/null @@ -1,36 +0,0 @@ -package requestsync - -import ( - "log" - - "github.com/spf13/cobra" - "gitlab.com/signald/signald-go/cmd/signaldctl/common" - "gitlab.com/signald/signald-go/cmd/signaldctl/config" - v1 "gitlab.com/signald/signald-go/signald/client-protocol/v1" -) - -var ( - account string - RequestSyncCmd = &cobra.Command{ - Use: "request-sync", - Short: "Ask other devices on the account to send sync data. Must subscribe for result", - PreRun: func(cmd *cobra.Command, args []string) { - if account == "" { - account = config.Config.DefaultAccount - } - }, - Run: func(_ *cobra.Command, _ []string) { - go common.Signald.Listen(nil) - req := &v1.RequestSyncRequest{Account: account} - err := req.Submit(common.Signald) - if err != nil { - panic(err) - } - log.Println("sync requested. Must be subscribed to receive response") - }, - } -) - -func init() { - RequestSyncCmd.Flags().StringVarP(&account, "account", "a", "", "the signald account to use") -} diff --git a/cmd/signaldctl/cmd/account/root.go b/cmd/signaldctl/cmd/account/root.go index aca722e..2888868 100644 --- a/cmd/signaldctl/cmd/account/root.go +++ b/cmd/signaldctl/cmd/account/root.go @@ -23,7 +23,6 @@ import ( "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/account/list" "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/account/register" "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/account/remoteconfig" - "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/account/requestsync" "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/account/setprofile" "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/account/verify" ) @@ -38,8 +37,7 @@ func init() { AccountCmd.AddCommand(link.LinkAccountCmd) AccountCmd.AddCommand(list.ListAccountCmd) AccountCmd.AddCommand(register.RegisterAccountCmd) - AccountCmd.AddCommand(remoteconfig.RemoteConfigCmd) - AccountCmd.AddCommand(requestsync.RequestSyncCmd) - AccountCmd.AddCommand(setprofile.SetProfileCmd) AccountCmd.AddCommand(verify.VerifyAccountCmd) + AccountCmd.AddCommand(setprofile.SetProfileCmd) + AccountCmd.AddCommand(remoteconfig.RemoteConfigCmd) } diff --git a/cmd/signaldctl/cmd/account/setprofile/set-profile.go b/cmd/signaldctl/cmd/account/setprofile/set-profile.go index 1d99673..a1c646a 100644 --- a/cmd/signaldctl/cmd/account/setprofile/set-profile.go +++ b/cmd/signaldctl/cmd/account/setprofile/set-profile.go @@ -27,14 +27,10 @@ import ( var ( account string - name string - avatar string - emoji string - about string SetProfileCmd = &cobra.Command{ - Use: "set-profile [name]", - Short: "update an account's profile data", + Use: "set-profile name", + Short: "updates the profile data with a new name", PreRun: func(cmd *cobra.Command, args []string) { if account == "" { account = config.Config.DefaultAccount @@ -43,19 +39,16 @@ var ( common.Must(cmd.Help()) log.Fatal("No account specified. Please specify with --account or set a default") } - - if len(args) > 0 { - name = args[0] + if len(args) != 1 { + common.Must(cmd.Help()) + log.Fatal("must specify a name") } }, - Run: func(_ *cobra.Command, _ []string) { + Run: func(_ *cobra.Command, args []string) { go common.Signald.Listen(nil) req := v1.SetProfile{ - Account: account, - Name: name, - AvatarFile: avatar, - Emoji: emoji, - About: about, + Account: account, + Name: args[0], } err := req.Submit(common.Signald) if err != nil { @@ -68,7 +61,4 @@ var ( func init() { SetProfileCmd.Flags().StringVarP(&account, "account", "a", "", "the signald account to use") - SetProfileCmd.Flags().StringVarP(&avatar, "avatar", "A", "", "path to avatar file") - SetProfileCmd.Flags().StringVar(&emoji, "emoji", "", "an emoji to be shown next to the about section") - SetProfileCmd.Flags().StringVar(&about, "about", "", "profile about section") } diff --git a/cmd/signaldctl/cmd/db/migrate.go b/cmd/signaldctl/cmd/db/migrate.go index 2241838..7c57dd8 100644 --- a/cmd/signaldctl/cmd/db/migrate.go +++ b/cmd/signaldctl/cmd/db/migrate.go @@ -7,7 +7,6 @@ import ( "log" "os" "os/user" - "strings" "time" "github.com/lib/pq" @@ -17,25 +16,7 @@ import ( "gitlab.com/signald/signald-go/cmd/signaldctl/common" ) -type Migration struct { - InstalledRank int - Version string - Description string - Script string - Checksum int -} - var ( - migrations = []Migration{ - {InstalledRank: 1, Version: "1", Description: "create tables", Script: "V1__create_tables.sql", Checksum: -1247750968}, - {InstalledRank: 2, Version: "12", Description: "create contacts table", Script: "V12__create_contacts_table.sql", Checksum: -852729911}, - {InstalledRank: 3, Version: "13", Description: "recipient registration status", Script: "V13__recipient_registration_status.sql", Checksum: 405376321}, - {InstalledRank: 4, Version: "14", Description: "multiple identity keys per account", Script: "V14__multiple_identity_keys_per_account.sql", Checksum: -1635788950}, - {InstalledRank: 5, Version: "15", Description: "profiles tables", Script: "V15__profiles_tables.sql", Checksum: 809686180}, - {InstalledRank: 6, Version: "16", Description: "destination uuid in envelope", Script: "V16__destination_uuid_in_envelope.sql", Checksum: 357656854}, - {InstalledRank: 7, Version: "17", Description: "update server ca", Script: "V17__update_server_ca.sql", Checksum: 1647934070}, - } - sqlitePath string postgresURL string MoveCmd = &cobra.Command{ @@ -43,7 +24,7 @@ var ( Short: "move a signald database from sqlite to postgres", Long: `move a signald sqlite database into a postgres database. If sqlite-path is not specified, the default (~/.config/signald/signald.db) will be used. - + Please note that signald must NOT be running while this command runs. After the data is moved, the sqlite file will be deleted`, @@ -61,7 +42,7 @@ var ( } return nil }, - RunE: func(cmd *cobra.Command, args []string) (err error) { + RunE: func(cmd *cobra.Command, args []string) error { source, err := sql.Open("sqlite3", sqlitePath) if err != nil { return err @@ -94,37 +75,77 @@ var ( } log.Println("created schema") - migrate := func(fn func(*sql.DB, *sql.DB) error, targetName string) { - if err = fn(source, dest); err != nil { - log.Println("error moving", targetName) - panic(err) - } - log.Println("moved", targetName) + if err := moveAccounts(source, dest); err != nil { + log.Println("error migrating accounts table") + return err } - defer func() { - if r := recover(); r != nil && r != err { - // If r is something other than the error returned via the named return, re-panic it - panic(r) - } - }() + log.Println("moved accounts table") - migrate(moveAccounts, "accounts table") - migrate(moveRecipients, "recipients table") - migrate(movePrekeys, "prekeys table") - migrate(moveSessions, "sessions table") - migrate(moveSignedPrekeys, "signed prekeys table") - migrate(moveIdentityKeys, "identity keys table") - migrate(moveAccountData, "account data") - migrate(movePendingAccountData, "pending account data table") - migrate(moveSenderKeys, "sender keys table") - migrate(moveSenderKeyShared, "sender key shared table") - migrate(moveGroups, "groups table") - migrate(moveGroupCredentials, "group credentials table") - migrate(moveContacts, "contacts table") - migrate(moveProfileKeys, "profile keys table") - migrate(moveProfiles, "profiles tables") - migrate(moveProfileCapabilities, "profile capabilities tables") - migrate(moveProfileBadges, "profile badges tables") + if err := moveRecipients(source, dest); err != nil { + log.Println("error migrating recipients table") + return err + } + log.Println("moved recipients table") + + if err := movePrekeys(source, dest); err != nil { + log.Println("error migrating prekeys table") + return err + } + log.Println("moved prekeys table") + + if err := moveSessions(source, dest); err != nil { + log.Println("error migrating sessions table") + return err + } + log.Println("moved sessions table") + + if err := moveSignedPrekeys(source, dest); err != nil { + log.Println("error migrating signed prekeys table") + return err + } + log.Println("moved signed prekeys table") + + if err := moveIdentityKeys(source, dest); err != nil { + log.Println("error migrating identity keys table") + return err + } + log.Println("moved identity keys table") + + if err := moveAccountData(source, dest); err != nil { + log.Println("error migrating account data") + return err + } + log.Println("moved account data table") + + if err := movePendingAccountData(source, dest); err != nil { + log.Println("error migrating pending account data tabe") + return err + } + log.Println("moved pending account data table") + + if err := moveSenderKeys(source, dest); err != nil { + log.Println("error migrating sender keys table") + return err + } + log.Println("moved sender keys table") + + if err := moveSenderKeyShared(source, dest); err != nil { + log.Println("error migrating sender key shared table") + return err + } + log.Println("moved sender key shared table") + + if err := moveGroups(source, dest); err != nil { + log.Println("error migrating groups table") + return err + } + log.Println("moved groups table") + + if err := moveGroupCredentials(source, dest); err != nil { + log.Println("error migrating group credentials table") + return err + } + log.Println("moved group credentials table") if err := os.Remove(sqlitePath); err != nil { log.Println("error deleting sqlite file") @@ -137,28 +158,15 @@ var ( ) func verifyMigration(source *sql.DB) error { - // Lower bound of the database state. - rows, err := source.Query("SELECT version FROM flyway_schema_history ORDER BY installed_rank DESC LIMIT 1") + rows, err := source.Query("SELECT * FROM flyway_schema_history WHERE version = 11") if err != nil { return err } defer rows.Close() if !rows.Next() { - return errors.New("source database is not up to date! Please update signald and start it to move all data into sqlite before moving data to postgres") + return errors.New("source database is not up to date! Please update to signald 0.17.0-16-5101c6ef and start it to move the sqlite database to an acceptable format") } - - var version string - err = rows.Scan(&version) - if err != nil { - return err - } - - expectedMigrationVersion := migrations[len(migrations)-1].Version - if version != expectedMigrationVersion { - return fmt.Errorf("source database must be on migration %s (found %s instead). Please update signald, or file an issue if the migrations are out of date", expectedMigrationVersion, version) - } - return nil } @@ -168,24 +176,13 @@ func createSchema(dest *sql.DB) error { return err } - for _, migration := range migrations { - _, err = dest.Exec(` - INSERT INTO flyway_schema_history - (installed_rank, version, description, type, script, checksum, installed_by, execution_time, success) - VALUES ($1, $2, $3, 'SQL', $4, $5, current_user, 0, true) - `, - migration.InstalledRank, migration.Version, migration.Description, migration.Script, migration.Checksum, - ) - if err != nil { - return err - } - } - - return nil + _, err = dest.Exec("INSERT INTO flyway_schema_history (installed_rank, version, description, type, script, checksum, installed_by, execution_time, success) VALUES ($1, $2, $3, $4, $5, $6, current_user, $7, $8)", + 1, 1, "create tables", "SQL", "V1__create_tables.sql", -1247750968, 0, true) + return err } func moveAccounts(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT uuid, e164, server FROM accounts") + rows, err := source.Query("SELECT uuid, e164, filename, server FROM accounts") if err != nil { return err } @@ -195,13 +192,14 @@ func moveAccounts(source *sql.DB, dest *sql.DB) error { var ( accountUUID uuid.UUID e164 string + filename string server uuid.UUID ) - err = rows.Scan(&accountUUID, &e164, &server) + err = rows.Scan(&accountUUID, &e164, &filename, &server) if err != nil { return err } - _, err = dest.Exec("INSERT INTO signald_accounts (uuid, e164, server) VALUES ($1, $2, $3)", accountUUID, e164, server) + _, err = dest.Exec("INSERT INTO signald_accounts (uuid, e164, filename, server) VALUES ($1, $2, $3, $4)", accountUUID, e164, filename, server) if err != nil { return err } @@ -210,9 +208,7 @@ func moveAccounts(source *sql.DB, dest *sql.DB) error { } func moveRecipients(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT rowid, account_uuid, uuid, e164, registered FROM recipients" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)", - ) + rows, err := source.Query("SELECT rowid, account_uuid, uuid, e164 FROM recipients") if err != nil { return err } @@ -222,39 +218,23 @@ func moveRecipients(source *sql.DB, dest *sql.DB) error { var ( rowID int64 accountUUID uuid.UUID - recipientUUID uuid.NullUUID + recipientUUID uuid.UUID e164 sql.NullString - registered bool ) - err = rows.Scan(&rowID, &accountUUID, &recipientUUID, &e164, ®istered) + err = rows.Scan(&rowID, &accountUUID, &recipientUUID, &e164) if err != nil { return err } - - if e164.Valid && !strings.HasPrefix(e164.String, "+") { - log.Println("corrupt e164 found, setting to null") - e164.Valid = false - e164.String = "" - } - - _, err = dest.Exec("INSERT INTO signald_recipients (rowid, account_uuid, uuid, e164, registered) VALUES ($1, $2, $3, $4, $5)", rowID, accountUUID, recipientUUID, e164, registered) + _, err = dest.Exec("INSERT INTO signald_recipients (rowid, account_uuid, uuid, e164) VALUES ($1, $2, $3, $4)", rowID, accountUUID, recipientUUID, e164) if err != nil { return err } } - - // start new rowids one above the current max value - _, err = dest.Exec("SELECT setval(pg_get_serial_sequence('signald_recipients', 'rowid'), (SELECT MAX(rowid) FROM signald_recipients)+1)") - if err != nil { - return err - } return nil } func movePrekeys(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, id, record FROM prekeys" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)", - ) + rows, err := source.Query("SELECT account_uuid, id, record FROM prekeys") if err != nil { return err } @@ -279,10 +259,7 @@ func movePrekeys(source *sql.DB, dest *sql.DB) error { } func moveSessions(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, recipient, device_id, record FROM sessions" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)" + - " AND recipient IN (SELECT DISTINCT rowid FROM recipients)", - ) + rows, err := source.Query("SELECT account_uuid, recipient, device_id, record FROM sessions") if err != nil { return err } @@ -317,9 +294,7 @@ func moveSessions(source *sql.DB, dest *sql.DB) error { } func moveSignedPrekeys(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, id, record FROM signed_prekeys" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)", - ) + rows, err := source.Query("SELECT account_uuid, id, record FROM signed_prekeys") if err != nil { return err } @@ -344,9 +319,7 @@ func moveSignedPrekeys(source *sql.DB, dest *sql.DB) error { } func moveIdentityKeys(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, recipient, identity_key, trust_level, added FROM identity_keys" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)", - ) + rows, err := source.Query("SELECT account_uuid, recipient, identity_key, trust_level, added FROM identity_keys") if err != nil { return err } @@ -373,9 +346,7 @@ func moveIdentityKeys(source *sql.DB, dest *sql.DB) error { } func moveAccountData(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, key, value FROM account_data" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)", - ) + rows, err := source.Query("SELECT account_uuid, key, value FROM account_data") if err != nil { return err } @@ -408,15 +379,15 @@ func movePendingAccountData(source *sql.DB, dest *sql.DB) error { for rows.Next() { var ( - username string - key string - value []byte + accountUUID uuid.UUID + key string + value []byte ) - err = rows.Scan(&username, &key, &value) + err = rows.Scan(&accountUUID, &key, &value) if err != nil { return err } - _, err = dest.Exec("INSERT INTO signald_pending_account_data (username, key, value) VALUES ($1, $2, $3)", username, key, value) + _, err = dest.Exec("INSERT INTO signald_pending_account_data (username, key, value) VALUES ($1, $2, $3)", accountUUID, key, value) if err != nil { return err } @@ -425,9 +396,7 @@ func movePendingAccountData(source *sql.DB, dest *sql.DB) error { } func moveSenderKeys(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, address, device, distribution_id, record, created_at FROM sender_keys" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)", - ) + rows, err := source.Query("SELECT account_uuid, address, device, distribution_id, record, created_at FROM sender_keys") if err != nil { return err } @@ -463,9 +432,7 @@ func moveSenderKeys(source *sql.DB, dest *sql.DB) error { } func moveSenderKeyShared(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, distribution_id, address, device FROM sender_key_shared" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)", - ) + rows, err := source.Query("SELECT account_uuid, distribution_id, address, device FROM sender_key_shared") if err != nil { return err } @@ -501,9 +468,7 @@ func moveSenderKeyShared(source *sql.DB, dest *sql.DB) error { } func moveGroups(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT rowid, account_uuid, group_id, master_key, revision, last_avatar_fetch, distribution_id, group_info FROM groups" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)", - ) + rows, err := source.Query("SELECT rowid, account_uuid, group_id, master_key, revision, last_avatar_fetch, distribution_id, group_info FROM groups") if err != nil { return err } @@ -529,20 +494,11 @@ func moveGroups(source *sql.DB, dest *sql.DB) error { return err } } - - // start new rowids one above the current max value - _, err = dest.Exec("SELECT setval(pg_get_serial_sequence('signald_groups', 'rowid'), (SELECT MAX(rowid) FROM signald_groups)+1)") - if err != nil { - return err - } return nil } func moveGroupCredentials(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, date, max(credential) FROM group_credentials" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)" + - " GROUP BY account_uuid, date", - ) + rows, err := source.Query("SELECT account_uuid, date, credential FROM group_credentials") if err != nil { return err } @@ -565,183 +521,3 @@ func moveGroupCredentials(source *sql.DB, dest *sql.DB) error { } return nil } - -func moveContacts(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, recipient, name, color, profile_key, message_expiration_time, inbox_position FROM contacts" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)" + - " AND recipient IN (SELECT DISTINCT rowid FROM recipients)", - ) - if err != nil { - return err - } - defer rows.Close() - - for rows.Next() { - var ( - accountUUID uuid.UUID - recipient int64 - name sql.NullString - color sql.NullString - profile_key []byte - message_expiration_time sql.NullInt64 - inbox_position sql.NullInt64 - ) - err = rows.Scan(&accountUUID, &recipient, &name, &color, &profile_key, &message_expiration_time, &inbox_position) - if err != nil { - return err - } - _, err = dest.Exec(` - INSERT INTO signald_contacts - (account_uuid, recipient, name, color, profile_key, message_expiration_time, inbox_position) - VALUES ($1, $2, $3, $4, $5, $6, $7) - `, accountUUID, recipient, name, color, profile_key, message_expiration_time, inbox_position) - if err != nil { - return err - } - } - return nil -} - -func moveProfileKeys(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, recipient, profile_key, profile_key_credential, request_pending, unidentified_access_mode FROM profile_keys" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)" + - " AND recipient IN (SELECT DISTINCT rowid FROM recipients)", - ) - if err != nil { - return err - } - defer rows.Close() - - for rows.Next() { - var ( - accountUUID uuid.UUID - recipient int64 - profile_key []byte - profile_key_credential []byte - request_pending bool - unidentified_access_mode int - ) - err = rows.Scan(&accountUUID, &recipient, &profile_key, &profile_key_credential, &request_pending, &unidentified_access_mode) - if err != nil { - return err - } - _, err = dest.Exec(` - INSERT INTO signald_profile_keys - (account_uuid, recipient, profile_key, profile_key_credential, request_pending, unidentified_access_mode) - VALUES ($1, $2, $3, $4, $5, $6) - `, accountUUID, recipient, profile_key, profile_key_credential, request_pending, unidentified_access_mode) - if err != nil { - return err - } - } - return nil -} - -func moveProfiles(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, recipient, last_update, given_name, family_name, about, emoji, payment_address, badges FROM profiles" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)" + - " AND recipient IN (SELECT DISTINCT rowid FROM recipients)", - ) - if err != nil { - return err - } - defer rows.Close() - - for rows.Next() { - var ( - accountUUID uuid.UUID - recipient int64 - last_update int64 - given_name string - family_name string - about string - emoji string - payment_address []byte - badges sql.NullString - ) - err = rows.Scan(&accountUUID, &recipient, &last_update, &given_name, &family_name, &about, &emoji, &payment_address, &badges) - if err != nil { - return err - } - _, err = dest.Exec(` - INSERT INTO signald_profiles - (account_uuid, recipient, last_update, given_name, family_name, about, emoji, payment_address, badges) - VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) - `, accountUUID, recipient, last_update, given_name, family_name, about, emoji, payment_address, badges) - if err != nil { - return err - } - } - return nil -} - -func moveProfileCapabilities(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, recipient, storage, gv1_migration, sender_key, announcement_group, change_number, stories FROM profile_capabilities" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)" + - " AND recipient IN (SELECT DISTINCT rowid FROM recipients)", - ) - if err != nil { - return err - } - defer rows.Close() - - for rows.Next() { - var ( - accountUUID uuid.UUID - recipient int64 - storage bool - gv1_migration bool - sender_key bool - announcement_group bool - change_number bool - stories bool - ) - err = rows.Scan(&accountUUID, &recipient, &storage, &gv1_migration, &sender_key, &announcement_group, &change_number, &stories) - if err != nil { - return err - } - _, err = dest.Exec(` - INSERT INTO signald_profile_capabilities - (account_uuid, recipient, storage, gv1_migration, sender_key, announcement_group, change_number, stories) - VALUES ($1, $2, $3, $4, $5, $6, $7, $8) - `, accountUUID, recipient, storage, gv1_migration, sender_key, announcement_group, change_number, stories) - if err != nil { - return err - } - } - return nil -} - -func moveProfileBadges(source *sql.DB, dest *sql.DB) error { - rows, err := source.Query("SELECT account_uuid, id, category, name, description, sprite6 FROM profile_badges" + - " WHERE account_uuid IN (SELECT DISTINCT uuid FROM accounts)", - ) - if err != nil { - return err - } - defer rows.Close() - - for rows.Next() { - var ( - accountUUID uuid.UUID - id string - category string - name string - description string - sprite6 string - ) - err = rows.Scan(&accountUUID, &id, &category, &name, &description, &sprite6) - if err != nil { - return err - } - _, err = dest.Exec(` - INSERT INTO signald_profile_badges - (account_uuid, id, category, name, description, sprite6) - VALUES ($1, $2, $3, $4, $5, $6) - `, accountUUID, id, category, name, description, sprite6) - if err != nil { - return err - } - } - return nil -} diff --git a/cmd/signaldctl/cmd/db/postgres.go b/cmd/signaldctl/cmd/db/postgres.go index abc8594..af2776a 100644 --- a/cmd/signaldctl/cmd/db/postgres.go +++ b/cmd/signaldctl/cmd/db/postgres.go @@ -1,22 +1,8 @@ package db var ( - pgScheme = ` - CREATE TABLE public.flyway_schema_history ( - installed_rank integer NOT NULL, - version character varying(50), - description character varying(200) NOT NULL, - type character varying(20) NOT NULL, - script character varying(1000) NOT NULL, - checksum integer, - installed_by character varying(100) NOT NULL, - installed_on timestamp without time zone DEFAULT now() NOT NULL, - execution_time integer NOT NULL, - success boolean NOT NULL - ); - - -- from signald in src/main/resources/db/migration/postgresql/V1__create_tables.sql - CREATE TABLE signald_message_queue ( + // from signald in src/main/resources/db/migration/postgresql/V1__create_tables.sql + pgScheme = `CREATE TABLE signald_message_queue ( id SERIAL PRIMARY KEY, account UUID NOT NULL, version INTEGER NOT NULL, @@ -29,10 +15,9 @@ var ( legacy_message BYTEA, server_received_timestamp BIGINT, server_delivered_timestamp BIGINT, - server_uuid UUID, - destination_uuid TEXT + server_uuid UUID ); - + CREATE TABLE signald_servers ( server_uuid UUID PRIMARY KEY, service_url TEXT NOT NULL, @@ -50,7 +35,7 @@ var ( cds_mrenclave VARCHAR(64), ias_ca BYTEA ); - + INSERT INTO signald_servers VALUES ( '6e2eb5a8-5706-45d0-8377-127a816411a4', -- server_uuid @@ -104,78 +89,79 @@ var ( -- ias_ca E'\\x00000002000000141e139877c131235200356d48d741b9e8538d4a290000078101000369617300000164adeb7976000000000005582e3530390000054f3082054b308203b3a003020102020900d107765d32a3b094300d06092a864886f70d01010b0500307e310b3009060355040613025553310b300906035504080c0243413114301206035504070c0b53616e746120436c617261311a3018060355040a0c11496e74656c20436f72706f726174696f6e3130302e06035504030c27496e74656c20534758204174746573746174696f6e205265706f7274205369676e696e672043413020170d3136313131343135333733315a180f32303439313233313233353935395a307e310b3009060355040613025553310b300906035504080c0243413114301206035504070c0b53616e746120436c617261311a3018060355040a0c11496e74656c20436f72706f726174696f6e3130302e06035504030c27496e74656c20534758204174746573746174696f6e205265706f7274205369676e696e67204341308201a2300d06092a864886f70d01010105000382018f003082018a02820181009f3c647eb5773cbb512d2732c0d7415ebb55a0fa9ede2e649199e6821db910d53177370977466a6a5e4786ccd2ddebd4149d6a2f6325529dd10cc98737b0779c1a07e29c47a1ae004948476c489f45a5a15d7ac8ecc6acc645adb43d87679df59c093bc5a2e9696c5478541b979e754b573914be55d32ff4c09ddf27219934cd990527b3f92ed78fbf29246abecb71240ef39c2d7107b447545a7ffb10eb060a68a98580219e36910952683892d6a5e2a80803193e407531404e36b315623799aa825074409754a2dfe8f5afd5fe631e1fc2af3808906f28a790d9dd9fe060939b125790c5805d037df56a99531b96de69de33ed226cc1207d1042b5c9ab7f404fc711c0fe4769fb9578b1dc0ec469ea1a25e0ff9914886ef2699b235bb4847dd6ff40b606e6170793c2fb98b314587f9cfd257362dfeab10b3bd2d97673a1a4bd44c453aaf47fc1f2d3d0f384f74a06f89c089f0da6cdb7fceee8c9821a8e54f25c0416d18c46839a5f8012fbdd3dc74d256279adc2c0d55aff6f0622425d1b0203010001a381c93081c630600603551d1f045930573055a053a051864f687474703a2f2f7472757374656473657276696365732e696e74656c2e636f6d2f636f6e74656e742f43524c2f5347582f4174746573746174696f6e5265706f72745369676e696e6743412e63726c301d0603551d0e0416041478437b76a67ebcd0af7e4237eb357c3b8701513c301f0603551d2304183016801478437b76a67ebcd0af7e4237eb357c3b8701513c300e0603551d0f0101ff04040302010630120603551d130101ff040830060101ff020100300d06092a864886f70d01010b05000382018100785f2d60c5c80af42a797610213915da82c9b29e89e0902a25a6c75b16091c68ab204aae711889492c7e1e320911455a8fc13442312e77a63994d99795c8ea4576823cea8ad1e191cfa862fab8a932d3d9b0535a0702d0555f74e520e30330f33480e7adc9d7c81e20703142bf00c528a80b463381fd602a82c7035281aae59562ccb5334ea8903e650b010681f5ce8eb62eac9c414988243aec92f25bf13cdff7ebcc298ee51bba5a3538b66b26cbc45a51de003cad306531ad7cf5d4ef0f8805d1b9133d24135ab3c4641a2f8808349d7333295e0e76ee4bc5227232628efa80d79d92ab4e3d1120f3fb5ad119cd8d544aa1d4a6865e6b57beac5771307e2e3cb9070da47b4bfc8869e01413ea093541de8a792811b74636c5e91452cf0cee59f2fb404acd0bc584cb9c835404734c0e7ec6605cdfcf2ff439b6d4719f702f0e0c3fa04fdb12a6cb2ad1ab1c9af1f8f4c3a08edd72a32b0bb5d0ad256ffd159a683b2a5a1f1d11fa62532f03d754caef0da5735a1e5a884c7e89d91218c9d7008515e5f5992ccc471f3b1bc1aaec24a2997e6ad3' ); - + CREATE TABLE signald_accounts ( uuid UUID NOT NULL, e164 TEXT NOT NULL, + filename TEXT NOT NULL, server UUID NOT NULL REFERENCES signald_servers(server_uuid) ON DELETE CASCADE, - - PRIMARY KEY (uuid, e164, server), + + PRIMARY KEY (uuid, e164, filename, server), UNIQUE (e164), + UNIQUE (filename), UNIQUE (uuid) ); - + CREATE TABLE signald_recipients ( rowid SERIAL PRIMARY KEY, account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, uuid UUID, e164 TEXT, - registered BOOLEAN DEFAULT true, -- from signald in src/main/resources/db/migration/postgresql/V13__recipient_registration_status.sql - + UNIQUE (account_uuid, e164, uuid) ); - + CREATE TABLE signald_prekeys ( account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, id INTEGER NOT NULL, record BYTEA NOT NULL, - + PRIMARY KEY (account_uuid, id) ); - + CREATE TABLE signald_sessions ( account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, recipient INTEGER NOT NULL REFERENCES signald_recipients(rowid) ON DELETE CASCADE, device_id INTEGER, record BYTEA NOT NULL, - + PRIMARY KEY (account_uuid, recipient, device_id) ); - + CREATE TABLE signald_signed_prekeys ( account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, id INTEGER NOT NULL, record BYTEA NOT NULL, - + PRIMARY KEY (account_uuid, id) ); - + CREATE TABLE signald_identity_keys ( account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, recipient INTEGER NOT NULL, identity_key BYTEA NOT NULL, trust_level TEXT NOT NULL, added TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, - + PRIMARY KEY (account_uuid, recipient, identity_key) ); - + CREATE TABLE signald_account_data ( account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, key TEXT NOT NULL, value BYTEA NOT NULL, - + PRIMARY KEY (account_uuid, key) ); - + CREATE TABLE signald_pending_account_data ( username TEXT, key TEXT NOT NULL, value BYTEA NOT NULL, - + PRIMARY KEY (username, key) ); - + CREATE TABLE signald_sender_keys ( account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, address TEXT NOT NULL, @@ -183,19 +169,19 @@ var ( distribution_id UUID NOT NULL, record BYTEA NOT NULL, created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL, - + PRIMARY KEY (account_uuid, address, device, distribution_id) ); - + CREATE TABLE signald_sender_key_shared ( account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, distribution_id UUID NOT NULL, address TEXT NOT NULL, device INTEGER NOT NULL, - + PRIMARY KEY (account_uuid, address, device) ); - + CREATE TABLE signald_groups ( rowid SERIAL PRIMARY KEY, account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, @@ -205,80 +191,29 @@ var ( last_avatar_fetch INTEGER, distribution_id UUID, group_info BYTEA, - + UNIQUE (account_uuid, group_id) ); - + CREATE TABLE signald_group_credentials ( account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, date BIGINT NOT NULL, credential BYTEA NOT NULL, - + PRIMARY KEY (account_uuid, date) ); - -- from signald in src/main/resources/db/migration/postgresql/V12__create_contacts_table.sql - CREATE TABLE signald_contacts ( - account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, - recipient INTEGER NOT NULL REFERENCES signald_recipients(rowid) ON DELETE CASCADE, - name TEXT, - color TEXT, - profile_key BYTEA, - message_expiration_time INTEGER, - inbox_position INTEGER, - - PRIMARY KEY (account_uuid, recipient) - ); - - -- from signald in src/main/resources/db/migration/postgresql/V15__profiles_tables.sql - - CREATE TABLE signald_profile_keys ( - account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, - recipient INTEGER NOT NULL REFERENCES signald_recipients(rowid) ON DELETE CASCADE, - profile_key BYTEA DEFAULT NULL, - profile_key_credential BYTEA DEFAULT NULL, - request_pending boolean DEFAULT FALSE, - unidentified_access_mode int DEFAULT 0, - - PRIMARY KEY (account_uuid, recipient) - ); - - CREATE TABLE signald_profiles ( - account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, - recipient INTEGER NOT NULL REFERENCES signald_recipients(rowid) ON DELETE CASCADE, - last_update BIGINT, - given_name TEXT, - family_name TEXT, - about TEXT, - emoji TEXT, - payment_address BYTEA, - badges TEXT, - - PRIMARY KEY (account_uuid, recipient) - ); - - CREATE TABLE signald_profile_capabilities ( - account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, - recipient INTEGER NOT NULL REFERENCES signald_recipients(rowid) ON DELETE CASCADE, - storage BOOLEAN, - gv1_migration BOOLEAN, - sender_key BOOLEAN, - announcement_group BOOLEAN, - change_number BOOLEAN, - stories BOOLEAN, - - PRIMARY KEY (account_uuid, recipient) - ); - - CREATE TABLE signald_profile_badges ( - account_uuid UUID NOT NULL REFERENCES signald_accounts(uuid) ON DELETE CASCADE, - id TEXT NOT NULL, - category TEXT NOT NULL, - name TEXT NOT NULL, - description TEXT NOT NULL, - sprite6 TEXT NOT NULL, - - PRIMARY KEY (account_uuid, id) + CREATE TABLE public.flyway_schema_history ( + installed_rank integer NOT NULL, + version character varying(50), + description character varying(200) NOT NULL, + type character varying(20) NOT NULL, + script character varying(1000) NOT NULL, + checksum integer, + installed_by character varying(100) NOT NULL, + installed_on timestamp without time zone DEFAULT now() NOT NULL, + execution_time integer NOT NULL, + success boolean NOT NULL ); ` ) diff --git a/cmd/signaldctl/cmd/device/root.go b/cmd/signaldctl/cmd/device/root.go index 408e559..f3169bd 100644 --- a/cmd/signaldctl/cmd/device/root.go +++ b/cmd/signaldctl/cmd/device/root.go @@ -25,7 +25,7 @@ import ( var DeviceCmd = &cobra.Command{ Use: "device", - Aliases: []string{"devices"}, + Aliases: []string{"msg", "devices"}, } func init() { diff --git a/cmd/signaldctl/cmd/group/preview/preview.go b/cmd/signaldctl/cmd/group/preview/preview.go deleted file mode 100644 index 4f51e77..0000000 --- a/cmd/signaldctl/cmd/group/preview/preview.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright © 2021 Finn Herzfeld -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package preview - -import ( - "encoding/json" - "errors" - "log" - "os" - "strings" - - "github.com/jedib0t/go-pretty/v6/table" - "github.com/spf13/cobra" - "gopkg.in/yaml.v2" - - "gitlab.com/signald/signald-go/cmd/signaldctl/common" - "gitlab.com/signald/signald-go/cmd/signaldctl/config" - "gitlab.com/signald/signald-go/signald/client-protocol/v1" -) - -var ( - account string - joinURL string - PreviewGroupCmd = &cobra.Command{ - Use: "preview https://signal.group/...", - Short: "preview information about a group without joining", - PreRunE: func(cmd *cobra.Command, args []string) error { - if account == "" { - account = config.Config.DefaultAccount - } - if account == "" { - common.Must(cmd.Help()) - log.Fatal("No account specified. Please specify with --account or set a default") - } - - if len(args) == 0 { - return errors.New("please specify signald.group URL") - } - joinURL = args[0] - - if !strings.HasPrefix(joinURL, "https://signal.group/#") { - return errors.New("invalid group link (must start with https://signal.group/#") - } - - return nil - }, - RunE: func(_ *cobra.Command, args []string) error { - go common.Signald.Listen(nil) - req := v1.GroupLinkInfoRequest{ - Account: account, - Uri: joinURL, - } - - info, err := req.Submit(common.Signald) - if err != nil { - return err - } - - switch common.OutputFormat { - case common.OutputFormatJSON: - return json.NewEncoder(os.Stdout).Encode(info) - case common.OutputFormatYAML: - return yaml.NewEncoder(os.Stdout).Encode(info) - case common.OutputFormatDefault, common.OutputFormatTable: - t := table.NewWriter() - t.SetOutputMirror(os.Stdout) - - joinApproval := "unknown" - switch info.AddFromInviteLink { - case 3: - joinApproval = "yes" - case 1: - joinApproval = "no" - } - - t.AppendRows([]table.Row{ - table.Row{"Title", info.Title}, - table.Row{"Group ID", info.GroupID}, - table.Row{"Member Count", info.MemberCount}, - table.Row{"Membership Approval", joinApproval}, - }) - common.StylizeTable(t) - t.Render() - } - - return nil - }, - } -) diff --git a/cmd/signaldctl/cmd/group/root.go b/cmd/signaldctl/cmd/group/root.go index 8be78ea..3f7d0ea 100644 --- a/cmd/signaldctl/cmd/group/root.go +++ b/cmd/signaldctl/cmd/group/root.go @@ -24,7 +24,6 @@ import ( "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/group/join" "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/group/leave" "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/group/list" - "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/group/preview" "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/group/removemember" "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/group/show" "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/group/update" @@ -42,7 +41,6 @@ func init() { GroupCmd.AddCommand(join.JoinGroupCmd) GroupCmd.AddCommand(leave.LeaveGroupCmd) GroupCmd.AddCommand(list.ListGroupCmd) - GroupCmd.AddCommand(preview.PreviewGroupCmd) GroupCmd.AddCommand(removemember.RemoveMemberCmd) GroupCmd.AddCommand(show.ShowGroupCmd) GroupCmd.AddCommand(update.UpdateGroupCmd) diff --git a/cmd/signaldctl/cmd/message/send/send-message.go b/cmd/signaldctl/cmd/message/send/send-message.go index 4e99598..e4f705e 100644 --- a/cmd/signaldctl/cmd/message/send/send-message.go +++ b/cmd/signaldctl/cmd/message/send/send-message.go @@ -18,11 +18,8 @@ package send import ( "encoding/json" "fmt" - "io" - "io/ioutil" "log" "os" - "os/exec" "path/filepath" "strings" @@ -32,23 +29,17 @@ import ( "gitlab.com/signald/signald-go/cmd/signaldctl/common" "gitlab.com/signald/signald-go/cmd/signaldctl/config" - v1 "gitlab.com/signald/signald-go/signald/client-protocol/v1" -) - -const ( - CAPTCHA_HELPER = "signal-captcha-helper" + "gitlab.com/signald/signald-go/signald/client-protocol/v1" ) var ( - account string - toAddress *v1.JsonAddress - toGroup string - attachments []string - message string - captchaHelper bool + account string + toAddress *v1.JsonAddress + toGroup string + attachments []string SendMessageCmd = &cobra.Command{ - Use: "send {group id | phone number} [message]", + Use: "send ", Short: "send a message", PreRun: func(cmd *cobra.Command, args []string) { if account == "" { @@ -58,20 +49,9 @@ var ( common.Must(cmd.Help()) log.Fatal("No account specified. Please specify with --account or set a default") } - if len(args) < 1 { + if len(args) < 2 { common.Must(cmd.Help()) - log.Fatal("must specify both destination (either group id or phone number)") - } - - if len(args) == 1 { - messageBytes, err := ioutil.ReadAll(os.Stdin) - if err != nil { - log.Println("error reading message from stdin, perhaps you meant to include it in the command line arguments?") - panic(err) - } - message = string(messageBytes) - } else { - message = strings.Join(args[1:], " ") + log.Fatal("must specify both destination (either group id or phone number) and message") } to, err := common.StringToAddress(args[0]) if err != nil { @@ -85,7 +65,7 @@ var ( req := v1.SendRequest{ Username: account, - MessageBody: message, + MessageBody: strings.Join(args[1:], " "), Attachments: []*v1.JsonAttachment{}, RecipientAddress: toAddress, RecipientGroupID: toGroup, @@ -104,48 +84,6 @@ var ( if err != nil { log.Fatal("error sending request to signald: ", err) } - - resends := []*v1.JsonAddress{} - - for _, result := range resp.Results { - if result.ProofRequiredFailure != nil { - if captchaHelper { - err = runCaptchaHelper(result.ProofRequiredFailure.Token) - if err != nil { - log.Println("error running captcha helper: ", err) - } - resends = append(resends, result.Address) - } - } - } - - if len(resends) > 0 { - resendReq := v1.SendRequest{ - Username: req.Username, - MessageBody: req.MessageBody, - Attachments: req.Attachments, - RecipientGroupID: req.RecipientGroupID, - Members: resends, - Timestamp: resp.Timestamp, - } - resendResponse, err := resendReq.Submit(common.Signald) - if err != nil { - log.Println("error resending messages: ", err) - } else { - for i, originalResult := range resp.Results { - if originalResult.ProofRequiredFailure == nil { - continue - } - - for _, result := range resendResponse.Results { - if result.Address.UUID == originalResult.Address.UUID { - resp.Results[i] = result - } - } - } - } - } - switch common.OutputFormat { case common.OutputFormatJSON: err := json.NewEncoder(os.Stdout).Encode(resp) @@ -197,55 +135,7 @@ var ( } ) -func runCaptchaHelper(challenge string) error { - if !captchaHelper { - return nil - } - - _, err := exec.LookPath(CAPTCHA_HELPER) - if err != nil { - return err - } - - cmd := exec.Command(CAPTCHA_HELPER, "--challenge") - - stdout, err := cmd.StdoutPipe() - if err != nil { - return err - } - - err = cmd.Start() - if err != nil { - return err - } - - captchaToken := new(strings.Builder) - _, err = io.Copy(captchaToken, stdout) - if err != nil { - return err - } - - err = cmd.Wait() - if err != nil { - return err - } - - req := v1.SubmitChallengeRequest{ - Account: account, - CaptchaToken: captchaToken.String(), - Challenge: challenge, - } - - err = req.Submit(common.Signald) - if err != nil { - return err - } - - return nil -} - func init() { SendMessageCmd.Flags().StringVarP(&account, "account", "a", "", "local account to use") - SendMessageCmd.Flags().BoolVarP(&captchaHelper, "captcha-helper", "c", false, "Invoke signal-captcha-helper and process the response when a push challenge response appears. After completing the challenge, the message will be redelivered to the failed recipient") SendMessageCmd.Flags().StringSliceVarP(&attachments, "attachment", "A", []string{}, "attach a file to your outbound message. may be specified multiple times.") } diff --git a/cmd/signaldctl/cmd/session/root.go b/cmd/signaldctl/cmd/session/root.go index 614b827..29673b5 100644 --- a/cmd/signaldctl/cmd/session/root.go +++ b/cmd/signaldctl/cmd/session/root.go @@ -15,6 +15,7 @@ package session + import ( "github.com/spf13/cobra" ) diff --git a/cmd/signaldctl/cmd/subscribe.go b/cmd/signaldctl/cmd/subscribe.go deleted file mode 100644 index b649b22..0000000 --- a/cmd/signaldctl/cmd/subscribe.go +++ /dev/null @@ -1,96 +0,0 @@ -package cmd - -import ( - "encoding/json" - "fmt" - "log" - "os" - - "github.com/spf13/cobra" - - "gitlab.com/signald/signald-go/cmd/signaldctl/common" - "gitlab.com/signald/signald-go/cmd/signaldctl/config" - client_protocol "gitlab.com/signald/signald-go/signald/client-protocol" - v1 "gitlab.com/signald/signald-go/signald/client-protocol/v1" -) - -var ( - accountIdentifier string - subscribeCmd = &cobra.Command{ - Use: "subscribe", - Short: "subscribe to incoming messages from signald", - Long: `subscribe to incoming messages from signald. - - if no default account is set, the -a/--account argument is required. - - the default output format (-o default) is being worked on, subject to change and should not be relied upon. Thoughts? come by the #signald IRC/matrix room - - if you want to future-proof your scripts, use json output (-o json) and parse it.`, - PreRun: func(cmd *cobra.Command, args []string) { - if accountIdentifier == "" { - accountIdentifier = config.Config.DefaultAccount - } - if accountIdentifier == "" { - common.Must(cmd.Help()) - log.Fatal("No account specified. Please specify with --account or set a default") - } - }, - RunE: func(cmd *cobra.Command, args []string) error { - incoming := make(chan client_protocol.BasicResponse) - go common.Signald.Listen(incoming) - - req := v1.SubscribeRequest{Account: accountIdentifier} - err := req.Submit(common.Signald) - if err != nil { - panic(err) - } - - for msg := range incoming { - switch common.OutputFormat { - case common.OutputFormatDefault: - if msg.Type != "IncomingMessage" { - continue - } - var data v1.IncomingMessage - err := json.Unmarshal(msg.Data, &data) - if err != nil { - continue - } - - if data.DataMessage == nil { - continue - } - - group := "-" - if data.DataMessage.GroupV2 != nil { - group = fmt.Sprintf("%s|%d", data.DataMessage.GroupV2.ID, data.DataMessage.GroupV2.Revision) - } - - attachment := "-" - if len(data.DataMessage.Attachments) > 0 { - attachment = data.DataMessage.Attachments[0].StoredFilename - } - - body := "-" - if data.DataMessage.Body != "" { - body = data.DataMessage.Body - } - fmt.Println(data.DataMessage.Timestamp, data.Account, data.Source.UUID, group, attachment, body) - case common.OutputFormatJSON: - err := json.NewEncoder(os.Stdout).Encode(msg) - if err != nil { - panic(err) - } - default: - log.Fatal("unsupported output format") - } - } - return nil - }, - } -) - -func init() { - subscribeCmd.Flags().StringVarP(&accountIdentifier, "account", "a", "", "the signald account to use") - RootCmd.AddCommand(subscribeCmd) -} diff --git a/cmd/signaldctl/config/config.go b/cmd/signaldctl/config/config.go index ea5c391..319f0a1 100644 --- a/cmd/signaldctl/config/config.go +++ b/cmd/signaldctl/config/config.go @@ -18,7 +18,6 @@ package config import ( "log" "os" - "path" "gopkg.in/yaml.v2" ) @@ -55,9 +54,6 @@ func Load() error { } func Save() error { - if err := os.MkdirAll(path.Dir(Path), 0770); err != nil { - return err - } f, err := os.Create(Path) if err != nil { return err diff --git a/protocol.json b/protocol.json index 807e84d..a0ded3f 100644 --- a/protocol.json +++ b/protocol.json @@ -1 +1,4770 @@ -{"doc_version":"v1","version":{"name":"signald","version":"unversioned","branch":"","commit":""},"info":"This document describes objects that may be used when communicating with signald.","types":{"v0":{"JsonAccountList":{"fields":{"accounts":{"list":true,"type":"JsonAccount","version":"v0"}},"deprecated":true,"removal_date":1641027661},"JsonMessageEnvelope":{"fields":{"username":{"type":"String","example":"\"+12024561414\""},"uuid":{"type":"String","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\""},"source":{"type":"JsonAddress","version":"v0"},"sourceDevice":{"type":"int"},"type":{"type":"String"},"relay":{"type":"String","doc":"this field is no longer available and will never be populated"},"timestamp":{"type":"long","example":"1615576442475"},"timestampISO":{"type":"String"},"serverTimestamp":{"type":"long"},"serverDeliveredTimestamp":{"type":"long","example":"161557644247580"},"hasLegacyMessage":{"type":"boolean"},"hasContent":{"type":"boolean"},"isUnidentifiedSender":{"type":"boolean"},"dataMessage":{"type":"JsonDataMessage","version":"v0"},"syncMessage":{"type":"JsonSyncMessage","version":"v0"},"callMessage":{"type":"JsonCallMessage","version":"v0"},"receipt":{"type":"JsonReceiptMessage","version":"v0"},"typing":{"type":"JsonTypingMessage","version":"v0"}},"deprecated":true,"removal_date":1641027661},"JsonAccount":{"fields":{"deviceId":{"type":"int"},"username":{"type":"String"},"filename":{"type":"String"},"uuid":{"type":"String"},"registered":{"type":"boolean"},"has_keys":{"type":"boolean"},"subscribed":{"type":"boolean"}},"deprecated":true,"removal_date":1641027661},"JsonAddress":{"fields":{"number":{"type":"String"},"uuid":{"type":"UUID"},"relay":{"type":"String"}},"deprecated":true,"removal_date":1641027661},"JsonDataMessage":{"fields":{"timestamp":{"type":"long","doc":"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.","example":"1615576442475"},"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.","example":"\"hello\""},"group":{"type":"JsonGroupInfo","version":"v0","doc":"if the incoming message was sent to a v1 group, information about that group will be here"},"groupV2":{"type":"JsonGroupV2Info","version":"v0","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":"v0","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":"v0","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"},"mentions":{"list":true,"type":"JsonMention","version":"v0","doc":"list of mentions in the message"}},"deprecated":true,"removal_date":1641027661},"JsonSyncMessage":{"fields":{"sent":{"type":"JsonSentTranscriptMessage","version":"v0"},"contacts":{"type":"JsonAttachment","version":"v0"},"contactsComplete":{"type":"boolean"},"groups":{"type":"JsonAttachment","version":"v0"},"blockedList":{"type":"JsonBlockedListMessage","version":"v0"},"request":{"type":"String"},"readMessages":{"list":true,"type":"JsonReadMessage","version":"v0"},"viewOnceOpen":{"type":"JsonViewOnceOpenMessage","version":"v0"},"verified":{"type":"JsonVerifiedMessage","version":"v0"},"configuration":{"type":"ConfigurationMessage","version":"v0"},"stickerPackOperations":{"list":true,"type":"JsonStickerPackOperationMessage","version":"v0"},"fetchType":{"type":"String"},"messageRequestResponse":{"type":"JsonMessageRequestResponseMessage","version":"v0"}},"deprecated":true,"removal_date":1641027661},"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"}},"deprecated":true,"removal_date":1641027661},"JsonReceiptMessage":{"fields":{"type":{"type":"String"},"timestamps":{"list":true,"type":"Long"},"when":{"type":"long"}},"deprecated":true,"removal_date":1641027661},"JsonTypingMessage":{"fields":{"action":{"type":"String"},"timestamp":{"type":"long"},"groupId":{"type":"String"}},"deprecated":true,"removal_date":1641027661},"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"}},"deprecated":true,"removal_date":1641027661},"JsonGroupInfo":{"fields":{"groupId":{"type":"String"},"members":{"list":true,"type":"JsonAddress","version":"v0"},"name":{"type":"String"},"type":{"type":"String"},"avatarId":{"type":"long"}},"deprecated":true,"removal_date":1641027661},"JsonGroupV2Info":{"fields":{"id":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\""},"revision":{"type":"int","example":"5"},"title":{"type":"String","example":"\"Parkdale Run Club\""},"description":{"type":"String"},"avatar":{"type":"String","doc":"path to the group's avatar on local disk, if available","example":"\"/var/lib/signald/avatars/group-EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\""},"timer":{"type":"int","example":"604800"},"members":{"list":true,"type":"JsonAddress","version":"v0"},"pendingMembers":{"list":true,"type":"JsonAddress","version":"v0"},"requestingMembers":{"list":true,"type":"JsonAddress","version":"v0"},"inviteLink":{"type":"String","doc":"the signal.group link, if applicable"},"accessControl":{"type":"GroupAccessControl","version":"v0","doc":"current access control settings for this group"},"memberDetail":{"list":true,"type":"GroupMember","version":"v0","doc":"detailed member list"},"pendingMemberDetail":{"list":true,"type":"GroupMember","version":"v0","doc":"detailed pending member list"}},"deprecated":true,"removal_date":1641027661},"JsonQuote":{"fields":{"id":{"type":"long","doc":"the client timestamp of the message being quoted","example":"1615576442475"},"author":{"type":"JsonAddress","version":"v0","doc":"the author of the message being quoted"},"text":{"type":"String","doc":"the body of the message being quoted","example":"\"hey  what's up?\""},"attachments":{"list":true,"type":"JsonQuotedAttachment","version":"v0","doc":"list of files attached to the quoted message"},"mentions":{"list":true,"type":"JsonMention","version":"v0","doc":"list of mentions in the quoted message"}},"doc":"A quote is a reply to a previous message. ID is the sent time of the message being replied to","deprecated":true,"removal_date":1641027661},"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"}},"deprecated":true,"removal_date":1641027661},"JsonSticker":{"fields":{"packID":{"type":"String"},"packKey":{"type":"String"},"stickerID":{"type":"int"},"attachment":{"type":"JsonAttachment","version":"v0"},"image":{"type":"String"}},"deprecated":true,"removal_date":1641027661},"JsonReaction":{"fields":{"emoji":{"type":"String","doc":"the emoji to react with","example":"\"👍\""},"remove":{"type":"boolean","doc":"set to true to remove the reaction. requires emoji be set to previously reacted emoji"},"targetAuthor":{"type":"JsonAddress","version":"v0","doc":"the author of the message being reacted to"},"targetSentTimestamp":{"type":"long","doc":"the client timestamp of the message being reacted to","example":"1615576442475"}},"deprecated":true,"removal_date":1641027661},"RemoteDelete":{"fields":{"targetSentTimestamp":{"type":"long"}}},"JsonMention":{"fields":{"uuid":{"type":"String","doc":"The UUID of the account being mentioned","example":"\"aeed01f0-a234-478e-8cf7-261c283151e7\""},"start":{"type":"int","doc":"The number of characters in that the mention starts at. Note that due to a quirk of how signald encodes JSON, if this value is 0 (for example if the first character in the message is the mention) the field won't show up.","example":"4"},"length":{"type":"int","doc":"The length of the mention represented in the message. Seems to always be 1 but included here in case that changes.","example":"1"}},"deprecated":true,"removal_date":1641027661},"JsonSentTranscriptMessage":{"fields":{"destination":{"type":"JsonAddress","version":"v0"},"timestamp":{"type":"long","example":"1615576442475"},"expirationStartTimestamp":{"type":"long"},"message":{"type":"JsonDataMessage","version":"v0"},"unidentifiedStatus":{"type":"Map"},"isRecipientUpdate":{"type":"boolean"}},"deprecated":true,"removal_date":1641027661},"JsonBlockedListMessage":{"fields":{"addresses":{"list":true,"type":"JsonAddress","version":"v0"},"groupIds":{"list":true,"type":"String"}},"deprecated":true,"removal_date":1641027661},"JsonReadMessage":{"fields":{"sender":{"type":"JsonAddress","version":"v0"},"timestamp":{"type":"long","example":"1615576442475"}},"deprecated":true,"removal_date":1641027661},"JsonViewOnceOpenMessage":{"fields":{"sender":{"type":"JsonAddress","version":"v0"},"timestamp":{"type":"long","example":"1615576442475"}},"deprecated":true,"removal_date":1641027661},"JsonVerifiedMessage":{"fields":{"destination":{"type":"JsonAddress","version":"v0"},"identityKey":{"type":"String"},"verified":{"type":"String"},"timestamp":{"type":"long"}},"deprecated":true,"removal_date":1641027661},"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"}},"deprecated":true,"removal_date":1641027661},"JsonMessageRequestResponseMessage":{"fields":{"person":{"type":"JsonAddress","version":"v0"},"groupId":{"type":"String"},"type":{"type":"String"}},"deprecated":true,"removal_date":1641027661},"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"}},"deprecated":true,"removal_date":1641027661},"GroupAccessControl":{"fields":{"link":{"type":"String","doc":"UNSATISFIABLE when the group link is disabled, ADMINISTRATOR when the group link is enabled but an administrator must approve new members, ANY when the group link is enabled and no approval is required","example":"\"ANY\""},"attributes":{"type":"String","doc":"who can edit group info"},"members":{"type":"String","doc":"who can add members"}},"doc":"group access control settings. Options for each controlled action are: UNKNOWN, ANY, MEMBER, ADMINISTRATOR, UNSATISFIABLE and UNRECOGNIZED","deprecated":true,"removal_date":1641027661},"GroupMember":{"fields":{"uuid":{"type":"String","example":"\"aeed01f0-a234-478e-8cf7-261c283151e7\""},"role":{"type":"String","doc":"possible values are: UNKNOWN, DEFAULT, ADMINISTRATOR and UNRECOGNIZED","example":"\"DEFAULT\""},"joined_revision":{"type":"int"}},"deprecated":true,"removal_date":1641027661},"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":{"empty":{"type":"boolean"},"present":{"type":"boolean"}}},"Type":{"fields":{}}},"v1":{"ClientMessageWrapper":{"fields":{"type":{"type":"String","doc":"the type of object to expect in the `data` field"},"version":{"type":"String","doc":"the version of the object in the `data` field"},"data":{"type":"Object","doc":"the incoming object. The structure will vary from message to message, see `type` and `version` fields"},"error":{"type":"Boolean","doc":"true if the incoming message represents an error"},"account":{"type":"String","doc":"the account this message is from"}},"doc":"Wraps all incoming messages sent to the client after a v1 subscribe request is issued"},"DuplicateMessageError":{"fields":{"timestamp":{"type":"long"},"message":{"type":"String"}},"error":true},"UntrustedIdentityError":{"fields":{"identifier":{"type":"String"},"message":{"type":"String"},"identity_key":{"type":"IdentityKey","version":"v1"}},"error":true},"ProtocolNoSessionError":{"fields":{"sender":{"type":"String"},"timestamp":{"type":"long"},"message":{"type":"String"},"sender_device":{"type":"int"},"content_hint":{"type":"int"},"group_id":{"type":"String"}},"error":true},"ProtocolInvalidKeyIdError":{"fields":{"sender":{"type":"String"},"timestamp":{"type":"long"},"message":{"type":"String"},"sender_device":{"type":"int"},"content_hint":{"type":"int"},"group_id":{"type":"String"}},"error":true},"ProtocolInvalidMessageError":{"fields":{"sender":{"type":"String"},"timestamp":{"type":"long"},"message":{"type":"String"},"sender_device":{"type":"int"},"content_hint":{"type":"int"},"group_id":{"type":"String"}},"error":true},"IncomingMessage":{"fields":{"account":{"type":"String","example":"\"+12024561414\""},"source":{"type":"JsonAddress","version":"v1"},"type":{"type":"String"},"timestamp":{"type":"long","example":"1615576442475"},"source_device":{"type":"int"},"server_receiver_timestamp":{"type":"long","example":"1615576442475"},"server_deliver_timestamp":{"type":"long","example":"1615576442475"},"has_legacy_message":{"type":"boolean"},"has_content":{"type":"boolean"},"unidentified_sender":{"type":"boolean"},"data_message":{"type":"JsonDataMessage","version":"v1"},"sync_message":{"type":"JsonSyncMessage","version":"v1"},"call_message":{"type":"CallMessage","version":"v1"},"receipt_message":{"type":"ReceiptMessage","version":"v1"},"typing_message":{"type":"TypingMessage","version":"v1"},"story_message":{"type":"StoryMessage","version":"v1"},"server_guid":{"type":"String"}}},"ListenerState":{"fields":{"connected":{"type":"boolean"}},"doc":"prior attempt to indicate signald connectivity state. WebSocketConnectionState messages will be delivered at the same time as well as in other parts of the websocket lifecycle."},"WebSocketConnectionState":{"fields":{"state":{"type":"String","doc":"One of: DISCONNECTED, CONNECTING, CONNECTED, RECONNECTING, DISCONNECTING, AUTHENTICATION_FAILED, FAILED"},"socket":{"type":"String","doc":"One of: UNIDENTIFIED, IDENTIFIED"}},"doc":"indicates when the websocket connection state to the signal server has changed"},"StorageChange":{"fields":{"version":{"type":"long","doc":"Seems to behave like the group version numbers and increments every time the state changes"}},"doc":"Broadcast to subscribed clients when there is a state change from the storage service"},"SendRequest":{"fields":{"username":{"type":"String","example":"\"+12024561414\""},"account":{"type":"String","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\""},"recipientAddress":{"type":"JsonAddress","version":"v1"},"recipientGroupId":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\""},"messageBody":{"type":"String","example":"\"hello\""},"attachments":{"list":true,"type":"JsonAttachment","version":"v1"},"quote":{"type":"JsonQuote","version":"v1"},"timestamp":{"type":"Long"},"mentions":{"list":true,"type":"JsonMention","version":"v1"},"previews":{"list":true,"type":"JsonPreview","version":"v1"},"members":{"list":true,"type":"JsonAddress","version":"v1","doc":"Optionally set to a sub-set of group members. Ignored if recipientGroupId isn't specified"}}},"SendResponse":{"fields":{"results":{"list":true,"type":"JsonSendMessageResult","version":"v1"},"timestamp":{"type":"long","example":"1615576442475"}}},"NoSuchAccountError":{"fields":{"account":{"type":"String"},"message":{"type":"String"}},"error":true},"ServerNotFoundError":{"fields":{"uuid":{"type":"String"},"message":{"type":"String"}},"error":true},"InvalidProxyError":{"fields":{"message":{"type":"String"}},"error":true},"NoSendPermissionError":{"fields":{"message":{"type":"String"}},"error":true},"InvalidAttachmentError":{"fields":{"filename":{"type":"String"},"message":{"type":"String"}},"error":true},"InternalError":{"fields":{"exceptions":{"list":true,"type":"String"},"message":{"type":"String"}},"doc":"an internal error in signald has occurred. typically these are things that \"should never happen\" such as issues saving to the local disk, but it is also the default error type and may catch some things that should have their own error type. If you find tht your code is depending on the exception list for any particular behavior, please file an issue so we can pull those errors out to a separate error type: https://gitlab.com/signald/signald/-/issues/new","error":true},"InvalidRequestError":{"fields":{"message":{"type":"String"}},"error":true},"UnknownGroupError":{"fields":{"message":{"type":"String"}},"error":true},"RateLimitError":{"fields":{"message":{"type":"String"}},"error":true},"InvalidRecipientError":{"fields":{"message":{"type":"String"}},"error":true},"AttachmentTooLargeError":{"fields":{"filename":{"type":"String"},"message":{"type":"String"}},"error":true},"AuthorizationFailedError":{"fields":{"message":{"type":"String"}},"doc":"Indicates the server rejected our credentials or a failed group update. Typically means the linked device was removed by the primary device, or that the account was re-registered. For group updates, this can indicate that we lack permissions.","error":true},"SQLError":{"fields":{"message":{"type":"String"}},"error":true},"ReactRequest":{"fields":{"username":{"type":"String","example":"\"+12024561414\"","required":true},"recipientAddress":{"type":"JsonAddress","version":"v1"},"recipientGroupId":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\""},"reaction":{"type":"JsonReaction","version":"v1","required":true},"timestamp":{"type":"long"},"members":{"list":true,"type":"JsonAddress","version":"v1","doc":"Optionally set to a sub-set of group members. Ignored if recipientGroupId isn't specified"}},"doc":"react to a previous message"},"UnregisteredUserError":{"fields":{"message":{"type":"String"},"e164_number":{"type":"String"}},"error":true},"VersionRequest":{"fields":{}},"JsonVersionMessage":{"fields":{"name":{"type":"String","example":"\"signald\""},"version":{"type":"String","example":"\"unversioned\""},"branch":{"type":"String","example":"\"\""},"commit":{"type":"String","example":"\"\""}}},"AcceptInvitationRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"groupID":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"","required":true}},"doc":"Accept a v2 group invitation. Note that you must have a profile name set to join groups."},"JsonGroupV2Info":{"fields":{"id":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\""},"revision":{"type":"int","example":"5"},"title":{"type":"String","example":"\"Parkdale Run Club\""},"description":{"type":"String"},"avatar":{"type":"String","doc":"path to the group's avatar on local disk, if available","example":"\"/var/lib/signald/avatars/group-EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\""},"timer":{"type":"int","example":"604800"},"members":{"list":true,"type":"JsonAddress","version":"v1"},"pendingMembers":{"list":true,"type":"JsonAddress","version":"v1"},"requestingMembers":{"list":true,"type":"JsonAddress","version":"v1"},"inviteLink":{"type":"String","doc":"the signal.group link, if applicable"},"accessControl":{"type":"GroupAccessControl","version":"v1","doc":"current access control settings for this group"},"memberDetail":{"list":true,"type":"GroupMember","version":"v1","doc":"detailed member list"},"pendingMemberDetail":{"list":true,"type":"GroupMember","version":"v1","doc":"detailed pending member list"},"announcements":{"type":"String","doc":"indicates if the group is an announcements group. Only admins are allowed to send messages to announcements groups. Options are UNKNOWN, ENABLED or DISABLED"},"removed":{"type":"boolean","doc":"will be set to true for incoming messages to indicate the user has been removed from the group"},"banned_members":{"list":true,"type":"BannedGroupMember","version":"v1"},"group_change":{"type":"GroupChange","version":"v1","doc":"Represents a peer-to-peer group change done by a user. Will not be set if the group change signature fails verification. This is usually only set inside of incoming messages."}},"doc":"Information about a Signal group"},"OwnProfileKeyDoesNotExistError":{"fields":{"message":{"type":"String"}},"error":true},"GroupPatchNotAcceptedError":{"fields":{"message":{"type":"String"}},"doc":"Indicates the server rejected our group update. This can be due to errors such as trying to add a user that's already in the group.","error":true},"ApproveMembershipRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"groupID":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"","required":true},"members":{"list":true,"type":"JsonAddress","version":"v1","doc":"list of requesting members to approve","required":true}},"doc":"approve a request to join a group"},"GroupVerificationError":{"fields":{"message":{"type":"String"}},"error":true},"GetGroupRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"groupID":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"","required":true},"revision":{"type":"int","doc":"the latest known revision, default value (-1) forces fetch from server"}},"doc":"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."},"InvalidGroupStateError":{"fields":{"message":{"type":"String"}},"error":true},"GetLinkedDevicesRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true}},"doc":"list all linked devices on a Signal account"},"LinkedDevices":{"fields":{"devices":{"list":true,"type":"DeviceInfo","version":"v1"}}},"JoinGroupRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"uri":{"type":"String","doc":"The signal.group URL","example":"\"https://signal.group/#CjQKINH_GZhXhfifTcnBkaKTNRxW-hHKnGSq-cJNyPVqHRp8EhDUB7zjKNEl0NaULhsqJCX3\"","required":true}},"doc":"Join a group using the a signal.group URL. Note that you must have a profile name set to join groups."},"JsonGroupJoinInfo":{"fields":{"groupID":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\""},"title":{"type":"String","example":"\"Parkdale Run Club\""},"description":{"type":"String","example":"\"A club for running in Parkdale\""},"memberCount":{"type":"int","example":"3"},"addFromInviteLink":{"type":"int","doc":"The access level required in order to join the group from the invite link, as an AccessControl.AccessRequired enum from the upstream Signal groups.proto file. This is UNSATISFIABLE (4) when the group link is disabled; ADMINISTRATOR (3) when the group link is enabled, but an administrator must approve new members; and ANY (1) when the group link is enabled and no approval is required. See theGroupAccessControl structure and the upstream enum ordinals."},"revision":{"type":"int","doc":"The Group V2 revision. This is incremented by clients whenever they update group information, and it is often used by clients to determine if the local group state is out-of-date with the server's revision.","example":"5"},"pendingAdminApproval":{"type":"boolean","doc":"Whether the account is waiting for admin approval in order to be added to the group."}}},"InvalidInviteURIError":{"fields":{"message":{"type":"String"}},"error":true},"GroupNotActiveError":{"fields":{"message":{"type":"String"}},"error":true},"RemoveLinkedDeviceRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"+12024561414\"","required":true},"deviceId":{"type":"long","doc":"the ID of the device to unlink","example":"3","required":true}},"doc":"Remove a linked device from the Signal account. Only allowed when the local device id is 1"},"UpdateGroupRequest":{"fields":{"account":{"type":"String","doc":"The identifier of the account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"groupID":{"type":"String","doc":"the ID of the group to update","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"","required":true},"title":{"type":"String","example":"\"Parkdale Run Club\""},"description":{"type":"String","doc":"A new group description. Set to empty string to remove an existing description.","example":"\"A club for running in Parkdale\""},"avatar":{"type":"String","example":"\"/tmp/image.jpg\""},"updateTimer":{"type":"int","doc":"update the group timer."},"addMembers":{"list":true,"type":"JsonAddress","version":"v1"},"removeMembers":{"list":true,"type":"JsonAddress","version":"v1"},"updateRole":{"type":"GroupMember","version":"v1"},"updateAccessControl":{"type":"GroupAccessControl","version":"v1","doc":"note that only one of the access controls may be updated per request"},"resetLink":{"type":"boolean","doc":"regenerate the group link password, invalidating the old one"},"announcements":{"type":"String","doc":"ENABLED to only allow admins to post messages, DISABLED to allow anyone to post"}},"doc":"modify a group. Note that only one modification action may be performed at once"},"GroupInfo":{"fields":{"v1":{"type":"JsonGroupInfo","version":"v1"},"v2":{"type":"JsonGroupV2Info","version":"v1"}},"doc":"A generic type that is used when the group version is not known"},"UnsupportedGroupError":{"fields":{"message":{"type":"String"}},"doc":"returned in response to use v1 groups, which are no longer supported","error":true},"SetProfile":{"fields":{"account":{"type":"String","doc":"The phone number of the account to use","example":"\"+12024561414\"","required":true},"name":{"type":"String","doc":"Change the profile name","example":"\"signald user\""},"avatarFile":{"type":"String","doc":"Path to new profile avatar file. If unset or null, unset the profile avatar","example":"\"/tmp/image.jpg\""},"about":{"type":"String","doc":"Change the 'about' profile field"},"emoji":{"type":"String","doc":"Change the profile emoji"},"mobilecoin_address":{"type":"String","doc":"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."},"visible_badge_ids":{"list":true,"type":"String","doc":"configure visible badge IDs"}}},"InvalidBase64Error":{"fields":{"message":{"type":"String"}},"error":true},"ResolveAddressRequest":{"fields":{"account":{"type":"String","doc":"The signal account to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"partial":{"type":"JsonAddress","version":"v1","doc":"The partial address, missing fields","required":true}},"doc":"Resolve a partial JsonAddress with only a number or UUID to one with both. Anywhere that signald accepts a JsonAddress will except a partial, this is a convenience function for client authors, mostly because signald doesn't resolve all the partials it returns."},"JsonAddress":{"fields":{"number":{"type":"String","doc":"An e164 phone number, starting with +. Currently the only available user-facing Signal identifier.","example":"\"+13215551234\""},"uuid":{"type":"UUID","doc":"A UUID, the unique identifier for a particular Signal account."},"relay":{"type":"String"}}},"MarkReadRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"to":{"type":"JsonAddress","version":"v1","doc":"The address that sent the message being marked as read","required":true},"timestamps":{"list":true,"type":"Long","doc":"List of messages to mark as read","example":"1615576442475","required":true},"when":{"type":"Long"}}},"ProofRequiredError":{"fields":{"token":{"type":"String"},"options":{"list":true,"type":"String","doc":"possible list values are RECAPTCHA and PUSH_CHALLENGE"},"message":{"type":"String"},"retry_after":{"type":"long","doc":"value in seconds"}},"error":true},"GetProfileRequest":{"fields":{"account":{"type":"String","doc":"the signald account to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"async":{"type":"boolean","doc":"if true, return results from local store immediately, refreshing from server in the background if needed. if false (default), block until profile can be retrieved from server"},"address":{"type":"JsonAddress","version":"v1","doc":"the address to look up","required":true}},"doc":"Get all information available about a user"},"Profile":{"fields":{"name":{"type":"String","doc":"The user's name from local contact names if available, or if not in contact list their Signal profile name"},"avatar":{"type":"String","doc":"path to avatar on local disk"},"address":{"type":"JsonAddress","version":"v1"},"capabilities":{"type":"Capabilities","version":"v1"},"color":{"type":"String","doc":"color of the chat with this user"},"about":{"type":"String"},"emoji":{"type":"String"},"contact_name":{"type":"String","doc":"The user's name from local contact names"},"profile_name":{"type":"String","doc":"The user's Signal profile name"},"inbox_position":{"type":"int"},"expiration_time":{"type":"int"},"mobilecoin_address":{"type":"String","doc":"*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"},"visible_badge_ids":{"list":true,"type":"String","doc":"currently unclear how these work, as they are not available in the production Signal apps"}},"doc":"Information about a Signal user"},"ProfileUnavailableError":{"fields":{"message":{"type":"String"}},"error":true},"ListGroupsRequest":{"fields":{"account":{"type":"String","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true}}},"GroupList":{"fields":{"groups":{"list":true,"type":"JsonGroupV2Info","version":"v1"},"legacyGroups":{"list":true,"type":"JsonGroupInfo","version":"v1","doc":"list of legacy (v1) groups, no longer supported (will always be empty)"}}},"ListContactsRequest":{"fields":{"account":{"type":"String","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"async":{"type":"boolean","doc":"return results from local store immediately, refreshing from server afterward if needed. If false (default), block until all pending profiles have been retrieved."}}},"ProfileList":{"fields":{"profiles":{"list":true,"type":"Profile","version":"v1"}}},"CreateGroupRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"title":{"type":"String","example":"\"Parkdale Run Club\"","required":true},"avatar":{"type":"String","example":"\"/tmp/image.jpg\""},"members":{"list":true,"type":"JsonAddress","version":"v1","required":true},"timer":{"type":"int","doc":"the message expiration timer"},"member_role":{"type":"String","doc":"The role of all members other than the group creator. Options are ADMINISTRATOR or DEFAULT (case insensitive)","example":"\"ADMINISTRATOR\""}}},"NoKnownUUIDError":{"fields":{"message":{"type":"String"}},"error":true},"LeaveGroupRequest":{"fields":{"account":{"type":"String","doc":"The account to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"groupID":{"type":"String","doc":"The group to leave","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"","required":true}}},"GenerateLinkingURIRequest":{"fields":{"server":{"type":"String","doc":"The identifier of the server to use. Leave blank for default (usually Signal production servers but configurable at build time)"}},"doc":"Generate a linking URI. Typically this is QR encoded and scanned by the primary device. Submit the returned session_id with a finish_link request."},"LinkingURI":{"fields":{"uri":{"type":"String"},"session_id":{"type":"String"}}},"FinishLinkRequest":{"fields":{"overwrite":{"type":"boolean","doc":"overwrite existing account data if the phone number conflicts. false by default"},"device_name":{"type":"String"},"session_id":{"type":"String"}},"doc":"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."},"Account":{"fields":{"address":{"type":"JsonAddress","version":"v1","doc":"The address of this account"},"pending":{"type":"Boolean","doc":"indicates the account has not completed registration"},"pni":{"type":"String"},"device_id":{"type":"int","doc":"The Signal device ID. Official Signal mobile clients (iPhone and Android) have device ID = 1, while linked devices such as Signal Desktop or Signal iPad have higher device IDs."},"account_id":{"type":"String","doc":"The primary identifier on the account, included with all requests to signald for this account. Previously called 'username'"}},"doc":"A local account in signald"},"NoSuchSessionError":{"fields":{"message":{"type":"String"}},"error":true},"UserAlreadyExistsError":{"fields":{"uuid":{"type":"UUID"},"message":{"type":"String"}},"error":true},"ScanTimeoutError":{"fields":{"message":{"type":"String"}},"error":true},"AddLinkedDeviceRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"uri":{"type":"String","doc":"the sgnl://linkdevice uri provided (typically in qr code form) by the new device","example":"\"sgnl://linkdevice?uuid=jAaZ5lxLfh7zVw5WELd6-Q&pub_key=BfFbjSwmAgpVJBXUdfmSgf61eX3a%2Bq9AoxAVpl1HUap9\"","required":true}},"doc":"Link a new device to a local Signal account"},"RegisterRequest":{"fields":{"account":{"type":"String","doc":"the e164 phone number to register with","example":"\"+12024561414\"","required":true},"voice":{"type":"boolean","doc":"set to true to request a voice call instead of an SMS for verification"},"captcha":{"type":"String","doc":"See https://signald.org/articles/captcha/"},"server":{"type":"String","doc":"The identifier of the server to use. Leave blank for default (usually Signal production servers but configurable at build time)"}},"doc":"begin the account registration process by requesting a phone number verification code. when the code is received, submit it with a verify request"},"CaptchaRequiredError":{"fields":{"more":{"type":"String"},"message":{"type":"String"}},"error":true},"VerifyRequest":{"fields":{"account":{"type":"String","doc":"the e164 phone number being verified","example":"\"+12024561414\"","required":true},"code":{"type":"String","doc":"the verification code, dash (-) optional","example":"\"555555\"","required":true}},"doc":"verify an account's phone number with a code after registering, completing the account creation process"},"AccountHasNoKeysError":{"fields":{"message":{"type":"String"}},"error":true},"AccountAlreadyVerifiedError":{"fields":{"message":{"type":"String"}},"error":true},"AccountLockedError":{"fields":{"more":{"type":"String"},"message":{"type":"String"}},"error":true},"GetIdentitiesRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"address":{"type":"JsonAddress","version":"v1","doc":"address to get keys for","required":true}},"doc":"Get information about a known keys for a particular address"},"IdentityKeyList":{"fields":{"address":{"type":"JsonAddress","version":"v1"},"identities":{"list":true,"type":"IdentityKey","version":"v1"}},"doc":"a list of identity keys associated with a particular address"},"TrustRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"address":{"type":"JsonAddress","version":"v1","doc":"The user to query identity keys for","required":true},"safety_number":{"type":"String","doc":"required if qr_code_data is absent","example":"\"373453558586758076680580548714989751943247272727416091564451\""},"qr_code_data":{"type":"String","doc":"base64-encoded QR code data. required if safety_number is absent"},"trust_level":{"type":"String","doc":"One of TRUSTED_UNVERIFIED, TRUSTED_VERIFIED or UNTRUSTED. Default is TRUSTED_VERIFIED","example":"\"TRUSTED_VERIFIED\""}},"doc":"Trust another user's safety number using either the QR code data or the safety number text"},"FingerprintVersionMismatchError":{"fields":{"message":{"type":"String"}},"error":true},"UnknownIdentityKeyError":{"fields":{"message":{"type":"String"}},"error":true},"InvalidFingerprintError":{"fields":{"message":{"type":"String"}},"error":true},"DeleteAccountRequest":{"fields":{"account":{"type":"String","doc":"The account to delete","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"server":{"type":"boolean","doc":"delete account information from the server as well (default false)"}},"doc":"delete all account data signald has on disk, and optionally delete the account from the server as well. Note that this is not \"unlink\" and will delete the entire account, even from a linked device."},"TypingRequest":{"fields":{"account":{"type":"String","doc":"The account to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"address":{"type":"JsonAddress","version":"v1"},"group":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\""},"typing":{"type":"boolean","example":"true","required":true},"when":{"type":"long"}},"doc":"send a typing started or stopped message"},"InvalidGroupError":{"fields":{"message":{"type":"String"}},"error":true},"ResetSessionRequest":{"fields":{"account":{"type":"String","doc":"The account to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"address":{"type":"JsonAddress","version":"v1","doc":"the user to reset session with","required":true},"timestamp":{"type":"Long"}},"doc":"reset a session with a particular user"},"RequestSyncRequest":{"fields":{"groups":{"type":"boolean","doc":"request group sync (default true)"},"configuration":{"type":"boolean","doc":"request configuration sync (default true)"},"contacts":{"type":"boolean","doc":"request contact sync (default true)"},"blocked":{"type":"boolean","doc":"request block list sync (default true)"},"keys":{"type":"boolean","doc":"request storage service keys"},"account":{"type":"String","doc":"The account to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true}},"doc":"Request other devices on the account send us their group list, syncable config and contact list."},"ListAccountsRequest":{"fields":{},"doc":"return all local accounts"},"AccountList":{"fields":{"accounts":{"list":true,"type":"Account","version":"v1"}}},"GroupLinkInfoRequest":{"fields":{"account":{"type":"String","doc":"The account to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"uri":{"type":"String","doc":"the signald.group link","example":"\"https://signal.group/#CjQKINH_GZhXhfifTcnBkaKTNRxW-hHKnGSq-cJNyPVqHRp8EhDUB7zjKNEl0NaULhsqJCX3\"","required":true}},"doc":"Get information about a group from a signal.group link"},"GroupLinkNotActiveError":{"fields":{"message":{"type":"String"}},"error":true},"UpdateContactRequest":{"fields":{"account":{"type":"String","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"address":{"type":"JsonAddress","version":"v1","required":true},"name":{"type":"String"},"color":{"type":"String"},"inbox_position":{"type":"int"}},"doc":"update information about a local contact"},"SetExpirationRequest":{"fields":{"account":{"type":"String","doc":"The account to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"address":{"type":"JsonAddress","version":"v1"},"group":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\""},"expiration":{"type":"int","example":"604800","required":true}},"doc":"Set the message expiration timer for a thread. Expiration must be specified in seconds, set to 0 to disable timer"},"SetDeviceNameRequest":{"fields":{"account":{"type":"String","doc":"The account to set the device name of","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"device_name":{"type":"String","doc":"The device name"}},"doc":"set this device's name. This will show up on the mobile device on the same account under settings -> linked devices"},"GetAllIdentities":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"+12024561414\"","required":true}},"doc":"get all known identity keys"},"AllIdentityKeyList":{"fields":{"identity_keys":{"list":true,"type":"IdentityKeyList","version":"v1"}}},"SubscribeRequest":{"fields":{"account":{"type":"String","doc":"The account to subscribe to incoming message for","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true}},"doc":"receive incoming messages. After making a subscribe request, incoming messages will be sent to the client encoded as ClientMessageWrapper. Send an unsubscribe request or disconnect from the socket to stop receiving messages."},"UnsubscribeRequest":{"fields":{"account":{"type":"String","doc":"The account to unsubscribe from","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true}},"doc":"See subscribe for more info"},"RemoteDeleteRequest":{"fields":{"account":{"type":"String","doc":"the account to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"address":{"type":"JsonAddress","version":"v1","doc":"the address to send the delete message to. should match address the message to be deleted was sent to. required if group is not set."},"group":{"type":"String","doc":"the group to send the delete message to. should match group the message to be deleted was sent to. required if address is not set.","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\""},"timestamp":{"type":"long","required":true},"members":{"list":true,"type":"JsonAddress","version":"v1","doc":"Optionally set to a sub-set of group members. Ignored if group isn't specified"}},"doc":"delete a message previously sent"},"AddServerRequest":{"fields":{"server":{"type":"Server","version":"v1","required":true}},"doc":"add a new server to connect to. Returns the new server's UUID."},"GetServersRequest":{"fields":{}},"ServerList":{"fields":{"servers":{"list":true,"type":"Server","version":"v1"}}},"RemoveServerRequest":{"fields":{"uuid":{"type":"String"}}},"SendPaymentRequest":{"fields":{"account":{"type":"String","doc":"the account to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"address":{"type":"JsonAddress","version":"v1","doc":"the address to send the payment message to","required":true},"payment":{"type":"Payment","version":"v1","required":true},"when":{"type":"Long"}},"doc":"send a mobilecoin payment"},"RemoteConfigRequest":{"fields":{"account":{"type":"String","doc":"The account to use to retrieve the remote config","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true}},"doc":"Retrieves the remote config (feature flags) from the server."},"RemoteConfigList":{"fields":{"config":{"list":true,"type":"RemoteConfig","version":"v1"}}},"RefuseMembershipRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"members":{"list":true,"type":"JsonAddress","version":"v1","doc":"list of requesting members to refuse","required":true},"group_id":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"","required":true},"also_ban":{"type":"boolean"}},"doc":"deny a request to join a group"},"SubmitChallengeRequest":{"fields":{"account":{"type":"String","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"challenge":{"type":"String","required":true},"captcha_token":{"type":"String"}}},"IsIdentifierRegisteredRequest":{"fields":{"account":{"type":"String","doc":"The account to use to use","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"identifier":{"type":"String","doc":"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).","example":"\"aeed01f0-a234-478e-8cf7-261c283151e7\"","required":true}},"doc":"Determine whether an account identifier is registered on the Signal service."},"BooleanMessage":{"fields":{"value":{"type":"boolean"}},"doc":"A message containing a single boolean, usually as a response"},"WaitForScanRequest":{"fields":{"session_id":{"type":"String"}},"doc":"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"},"GetGroupRevisionPagesRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"group_id":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"","required":true},"from_revision":{"type":"int","doc":"The revision to start the pages from. Note that if this is lower than the revision you joined the group, an AuthorizationFailedError is returned.","required":true},"include_first_revision":{"type":"boolean","doc":"Whether to include the first state in the returned pages (default false)"}},"doc":"Query the server for group revision history. The history contains information about the changes between each revision and the user that made the change."},"GroupHistoryPage":{"fields":{"results":{"list":true,"type":"GroupHistoryEntry","version":"v1"},"paging_data":{"type":"PagingData","version":"v1"}},"doc":"The result of fetching a group's history along with paging data."},"SendSyncMessageRequest":{"fields":{"account":{"type":"String","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"view_once_open_message":{"type":"JsonViewOnceOpenMessage","version":"v1","doc":"This can be set to indicate to other devices about having viewed a view-once message."},"message_request_response":{"type":"JsonMessageRequestResponseMessage","version":"v1","doc":"This can be set to indicate to other devices about a response to an incoming message request from an unknown user or group. Warning: Using the BLOCK and BLOCK_AND_DELETE options relies on other devices to do the blocking, and it does not make you leave the group!"}},"doc":"Sends a sync message to the account's devices"},"JsonSendMessageResult":{"fields":{"address":{"type":"JsonAddress","version":"v1"},"success":{"type":"SendSuccess","version":"v1"},"networkFailure":{"type":"boolean","example":"false"},"unregisteredFailure":{"type":"boolean","example":"false"},"identityFailure":{"type":"String"},"proof_required_failure":{"type":"ProofRequiredError","version":"v1"}}},"BanUserRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"group_id":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"","required":true},"users":{"list":true,"type":"JsonAddress","version":"v1","doc":"List of users to ban","required":true}},"doc":"Bans users from a group. This works even if the users aren't in the group. If they are currently in the group, they will also be removed."},"UnbanUserRequest":{"fields":{"account":{"type":"String","doc":"The account to interact with","example":"\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"","required":true},"group_id":{"type":"String","example":"\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"","required":true},"users":{"list":true,"type":"JsonAddress","version":"v1","doc":"List of users to unban","required":true}},"doc":"Unbans users from a group."},"IdentityKey":{"fields":{"added":{"type":"long","doc":"the first time this identity key was seen"},"safety_number":{"type":"String","example":"\"373453558586758076680580548714989751943247272727416091564451\""},"qr_code_data":{"type":"String","doc":"base64-encoded QR code data"},"trust_level":{"type":"String","doc":"One of TRUSTED_UNVERIFIED, TRUSTED_VERIFIED or UNTRUSTED"}}},"JsonDataMessage":{"fields":{"timestamp":{"type":"long","doc":"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.","example":"1615576442475"},"attachments":{"list":true,"type":"JsonAttachment","version":"v1","doc":"files attached to the incoming message"},"body":{"type":"String","doc":"the text body of the incoming message.","example":"\"hello\""},"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":"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."},"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":"v1","doc":"if the incoming message has a shared contact, the contact's information will be here"},"previews":{"list":true,"type":"JsonPreview","version":"v1","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":"v1","doc":"if the inbound message is deleting a previously sent message, indicates which message should be deleted"},"mentions":{"list":true,"type":"JsonMention","version":"v1","doc":"list of mentions in the message"},"payment":{"type":"Payment","version":"v1","doc":"details about the MobileCoin payment attached to the message, if present"},"is_expiration_update":{"type":"boolean","doc":"whether or not this message changes the expiresInSeconds value for the whole chat. Some messages (remote deletes, reactions, etc) will have expiresInSeconds=0 even though the chat has disappearing messages enabled."},"group_call_update":{"type":"String","doc":"the eraId string from a group call message update"},"story_context":{"type":"StoryContext","version":"v1"}}},"JsonSyncMessage":{"fields":{"sent":{"type":"JsonSentTranscriptMessage","version":"v1"},"contacts":{"type":"JsonAttachment","version":"v1"},"contactsComplete":{"type":"boolean"},"groups":{"type":"JsonAttachment","version":"v1"},"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"}}},"CallMessage":{"fields":{"offer_message":{"type":"OfferMessage","version":"v1"},"answer_message":{"type":"AnswerMessage","version":"v1"},"busy_message":{"type":"BusyMessage","version":"v1"},"hangup_message":{"type":"HangupMessage","version":"v1"},"ice_update_message":{"list":true,"type":"IceUpdateMessage","version":"v1"},"destination_device_id":{"type":"int"},"multi_ring":{"type":"boolean"}}},"ReceiptMessage":{"fields":{"type":{"type":"String","doc":"options: UNKNOWN, DELIVERY, READ, VIEWED"},"timestamps":{"list":true,"type":"Long"},"when":{"type":"long"}}},"TypingMessage":{"fields":{"action":{"type":"String"},"timestamp":{"type":"long"},"group_id":{"type":"String"}}},"StoryMessage":{"fields":{"group":{"type":"JsonGroupV2Info","version":"v1"},"file":{"type":"JsonAttachment","version":"v1"},"text":{"type":"TextAttachment","version":"v1"},"allow_replies":{"type":"Boolean"}}},"JsonAttachment":{"fields":{"contentType":{"type":"String"},"id":{"type":"String"},"size":{"type":"int"},"storedFilename":{"type":"String","doc":"when receiving, the path that file has been downloaded to"},"filename":{"type":"String","doc":"when sending, the path to the local file to upload"},"customFilename":{"type":"String","doc":"the original name of the file"},"caption":{"type":"String"},"width":{"type":"int"},"height":{"type":"int"},"voiceNote":{"type":"boolean"},"key":{"type":"String"},"digest":{"type":"String"},"blurhash":{"type":"String"}},"doc":"represents a file attached to a message. When sending, only `filename` is required."},"JsonQuote":{"fields":{"id":{"type":"long","doc":"the client timestamp of the message being quoted","example":"1615576442475"},"author":{"type":"JsonAddress","version":"v1","doc":"the author of the message being quoted"},"text":{"type":"String","doc":"the body of the message being quoted","example":"\"hey  what's up?\""},"attachments":{"list":true,"type":"JsonQuotedAttachment","version":"v0","doc":"list of files attached to the quoted message"},"mentions":{"list":true,"type":"JsonMention","version":"v1","doc":"list of mentions in the quoted message"}},"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","doc":"The UUID of the account being mentioned","example":"\"aeed01f0-a234-478e-8cf7-261c283151e7\""},"start":{"type":"int","doc":"The number of characters in that the mention starts at. Note that due to a quirk of how signald encodes JSON, if this value is 0 (for example if the first character in the message is the mention) the field won't show up.","example":"4"},"length":{"type":"int","doc":"The length of the mention represented in the message. Seems to always be 1 but included here in case that changes.","example":"1"}}},"JsonPreview":{"fields":{"url":{"type":"String"},"title":{"type":"String"},"description":{"type":"String"},"date":{"type":"long"},"attachment":{"type":"JsonAttachment","version":"v1","doc":"an optional image file attached to the preview"}},"doc":"metadata about one of the links in a message"},"JsonReaction":{"fields":{"emoji":{"type":"String","doc":"the emoji to react with","example":"\"👍\""},"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","example":"1615576442475"}}},"GroupAccessControl":{"fields":{"link":{"type":"String","doc":"UNSATISFIABLE when the group link is disabled, ADMINISTRATOR when the group link is enabled but an administrator must approve new members, ANY when the group link is enabled and no approval is required","example":"\"ANY\""},"attributes":{"type":"String","doc":"who can edit group info"},"members":{"type":"String","doc":"who can add members"}},"doc":"group access control settings. Options for each controlled action are: UNKNOWN, ANY, MEMBER, ADMINISTRATOR, UNSATISFIABLE and UNRECOGNIZED"},"GroupMember":{"fields":{"uuid":{"type":"String","example":"\"aeed01f0-a234-478e-8cf7-261c283151e7\""},"role":{"type":"String","doc":"possible values are: UNKNOWN, DEFAULT, ADMINISTRATOR and UNRECOGNIZED","example":"\"DEFAULT\""},"joined_revision":{"type":"int"}}},"BannedGroupMember":{"fields":{"uuid":{"type":"String","example":"\"aeed01f0-a234-478e-8cf7-261c283151e7\""},"timestamp":{"type":"long","doc":"Timestamp as milliseconds since Unix epoch of when the user was banned. This field is set by the server."}}},"GroupChange":{"fields":{"editor":{"type":"JsonAddress","version":"v1","doc":"The user that made the change."},"revision":{"type":"int","doc":"The group revision that this change brings the group to."},"new_members":{"list":true,"type":"GroupMember","version":"v1","doc":"Represents users have been added to the group. This can be from group members adding users, or a users joining via a group link that required no approval."},"delete_members":{"list":true,"type":"JsonAddress","version":"v1","doc":"Represents users that have been removed from the group. This can be from admins removing users, or users choosing to leave the group"},"modify_member_roles":{"list":true,"type":"GroupMember","version":"v1","doc":"Represents users with their new, modified role."},"modified_profile_keys":{"list":true,"type":"GroupMember","version":"v1","doc":"Represents users that have rotated their profile key. Note that signald currently does not expose profile keys to clients. The joined revision property will always be 0 in this list."},"new_pending_members":{"list":true,"type":"GroupPendingMember","version":"v1","doc":"Represents a user that has been invited to the group by another user."},"delete_pending_members":{"list":true,"type":"JsonAddress","version":"v1"},"promote_pending_members":{"list":true,"type":"GroupMember","version":"v1"},"new_banned_members":{"list":true,"type":"BannedGroupMember","version":"v1"},"new_unbanned_members":{"list":true,"type":"BannedGroupMember","version":"v1"},"new_title":{"type":"String"},"new_avatar":{"type":"Boolean","doc":"Whether this group change changed the avatar."},"new_timer":{"type":"int","doc":"New disappearing messages timer value."},"new_access_control":{"type":"GroupAccessControl","version":"v1","doc":"If not null, then this group change modified one of the access controls. Some of the properties in here will be null."},"new_requesting_members":{"list":true,"type":"GroupRequestingMember","version":"v1","doc":"Represents users that have requested to join the group via the group link. Note that members requesting to join might not necessarily have the list of users in the group, so they won't be able to send a peer-to-peer group update message to inform users of their request to join. Other users in the group may inform us that the revision has increased, but the members requesting access will have to be obtained from the server instead (which signald will handle). For now, a get_group request has to be made to get the users that have requested to join the group."},"delete_requesting_members":{"list":true,"type":"JsonAddress","version":"v1"},"promote_requesting_members":{"list":true,"type":"GroupMember","version":"v1"},"new_invite_link_password":{"type":"Boolean","doc":"Whether this group change involved resetting the group invite link."},"new_description":{"type":"String"},"new_is_announcement_group":{"type":"String","doc":"Whether this change affected the announcement group setting. Possible values are UNKNOWN, ENABLED or DISABLED"}},"doc":"Represents a group change made by a user. This can also represent request link invites. Only the fields relevant to the group change performed will be set. Note that in signald, group changes are currently only received from incoming messages from a message subscription."},"DeviceInfo":{"fields":{"id":{"type":"long"},"name":{"type":"String"},"created":{"type":"long"},"lastSeen":{"type":"long"}}},"JsonGroupInfo":{"fields":{"groupId":{"type":"String"},"members":{"list":true,"type":"JsonAddress","version":"v1"},"name":{"type":"String"},"type":{"type":"String"},"avatarId":{"type":"long"}},"doc":"information about a legacy group"},"Capabilities":{"fields":{"gv2":{"type":"boolean","doc":"this capability is deprecated and will always be true"},"storage":{"type":"boolean"},"stories":{"type":"boolean"},"gv1-migration":{"type":"boolean"},"sender_key":{"type":"boolean"},"announcement_group":{"type":"boolean"},"change_number":{"type":"boolean"}}},"Server":{"fields":{"uuid":{"type":"UUID","doc":"A unique identifier for the server, referenced when adding accounts. Must be a valid UUID. Will be generated if not specified when creating."},"proxy":{"type":"String"},"ca":{"type":"String","doc":"base64 encoded trust store, password must be 'whisper'"},"service_url":{"type":"String"},"cdn_urls":{"list":true,"type":"ServerCDN","version":"v1"},"contact_discovery_url":{"type":"String"},"key_backup_url":{"type":"String"},"storage_url":{"type":"String"},"zk_param":{"type":"String","doc":"base64 encoded ZKGROUP_SERVER_PUBLIC_PARAMS value"},"unidentified_sender_root":{"type":"String","doc":"base64 encoded"},"key_backup_service_name":{"type":"String"},"key_backup_service_id":{"type":"String","doc":"base64 encoded"},"key_backup_mrenclave":{"type":"String"},"cds_mrenclave":{"type":"String"},"ias_ca":{"type":"String","doc":"base64 encoded trust store, password must be 'whisper'"}},"doc":"a Signal server"},"Payment":{"fields":{"receipt":{"type":"String","doc":"base64 encoded payment receipt data. This is a protobuf value which can be decoded as the Receipt object described in https://github.com/mobilecoinfoundation/mobilecoin/blob/master/api/proto/external.proto"},"note":{"type":"String","doc":"note attached to the payment"}},"doc":"details about a MobileCoin payment"},"RemoteConfig":{"fields":{"name":{"type":"String","doc":"The name of this remote config entry. These names may be prefixed with the platform type (\"android.\", \"ios.\", \"desktop.\", etc.) Typically, clients only handle the relevant configs for its platform, hardcoding the names it cares about handling and ignoring the rest.","example":"desktop.mediaQuality.levels"},"value":{"type":"String","doc":"The value for this remote config entry. Even though this is a string, it could be a boolean as a string, an integer/long value, a comma-delimited list, etc. Clients usually consume this by hardcoding the feature flagsit should track in the app and assuming that the server will send the type that the client expects. If an unexpected type occurs, it falls back to a default value.","example":"1:2,61:2,81:2,82:2,65:2,31:2,47:2,41:2,32:2,385:2,971:2,974:2,49:2,33:2,*:1"}},"doc":"A remote config (feature flag) entry."},"GroupHistoryEntry":{"fields":{"group":{"type":"JsonGroupV2Info","version":"v1"},"change":{"type":"GroupChange","version":"v1"}}},"PagingData":{"fields":{"has_more_pages":{"type":"boolean"},"next_page_revision":{"type":"int"}}},"JsonViewOnceOpenMessage":{"fields":{"sender":{"type":"JsonAddress","version":"v1"},"timestamp":{"type":"long","example":"1615576442475"}}},"JsonMessageRequestResponseMessage":{"fields":{"person":{"type":"JsonAddress","version":"v1"},"groupId":{"type":"String"},"type":{"type":"String","doc":"One of UNKNOWN, ACCEPT, DELETE, BLOCK, BLOCK_AND_DELETE, UNBLOCK_AND_ACCEPT"}},"doc":"Responses to message requests from unknown users or groups"},"SendSuccess":{"fields":{"unidentified":{"type":"boolean"},"needsSync":{"type":"boolean"},"duration":{"type":"long"},"devices":{"list":true,"type":"int"}}},"SharedContact":{"fields":{"name":{"type":"SharedContactName","version":"v1","doc":"the name of the shared contact"},"email":{"list":true,"type":"SharedContactEmail","version":"v1","doc":"the email addresses of the shared contact"},"phone":{"list":true,"type":"SharedContactPhone","version":"v1","doc":"the phone numbers of the shared contact"},"address":{"list":true,"type":"SharedContactAddress","version":"v1","doc":"the physical addresses of the shared contact"},"avatar":{"type":"SharedContactAvatar","version":"v1","doc":"the profile picture/avatar of the shared contact"},"organization":{"type":"String","doc":"the organization (e.g. workplace) of the shared contact"}}},"RemoteDelete":{"fields":{"target_sent_timestamp":{"type":"long"}}},"StoryContext":{"fields":{"author":{"type":"String"},"sent_timestamp":{"type":"long"}}},"JsonSentTranscriptMessage":{"fields":{"destination":{"type":"JsonAddress","version":"v1"},"timestamp":{"type":"long","example":"1615576442475"},"expirationStartTimestamp":{"type":"long"},"message":{"type":"JsonDataMessage","version":"v1"},"story":{"type":"StoryMessage","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","example":"1615576442475"}}},"JsonVerifiedMessage":{"fields":{"destination":{"type":"JsonAddress","version":"v1"},"identityKey":{"type":"String"},"verified":{"type":"String"},"timestamp":{"type":"long"}}},"OfferMessage":{"fields":{"id":{"type":"long"},"sdp":{"type":"String"},"type":{"type":"String"},"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":"String"},"legacy":{"type":"boolean"},"device_id":{"type":"int"}}},"IceUpdateMessage":{"fields":{"id":{"type":"long"},"opaque":{"type":"String"},"sdp":{"type":"String"}}},"TextAttachment":{"fields":{"text":{"type":"String"},"style":{"type":"String"},"preview":{"type":"JsonPreview","version":"v1"},"text_foreground_color":{"type":"String"},"text_background_color":{"type":"String"},"background_gradient":{"type":"Gradient","version":"v1"},"background_color":{"type":"String"}}},"GroupPendingMember":{"fields":{"uuid":{"type":"String","example":"\"aeed01f0-a234-478e-8cf7-261c283151e7\""},"role":{"type":"String","doc":"possible values are: UNKNOWN, DEFAULT, ADMINISTRATOR and UNRECOGNIZED","example":"\"DEFAULT\""},"timestamp":{"type":"long"},"added_by_uuid":{"type":"String","example":"\"aeed01f0-a234-478e-8cf7-261c283151e7\""}}},"GroupRequestingMember":{"fields":{"uuid":{"type":"String","example":"\"aeed01f0-a234-478e-8cf7-261c283151e7\""},"timestamp":{"type":"long"}}},"ServerCDN":{"fields":{"number":{"type":"int"},"url":{"type":"String"}}},"SharedContactName":{"fields":{"display":{"type":"String","doc":"the full name that should be displayed"},"given":{"type":"String","doc":"given name"},"middle":{"type":"String","doc":"middle name"},"family":{"type":"String","doc":"family name (surname)"},"prefix":{"type":"String"},"suffix":{"type":"String"}}},"SharedContactEmail":{"fields":{"type":{"type":"String","doc":"the type of email (options: HOME, WORK, MOBILE, CUSTOM)"},"value":{"type":"String","doc":"the email address"},"label":{"type":"String","doc":"the type label when type is CUSTOM"}}},"SharedContactPhone":{"fields":{"type":{"type":"String","doc":"the type of phone (options: HOME, WORK, MOBILE, CUSTOM)"},"value":{"type":"String","doc":"the phone number"},"label":{"type":"String","doc":"the type label when type is CUSTOM"}}},"SharedContactAddress":{"fields":{"type":{"type":"String","doc":"the type of address (options: HOME, WORK, CUSTOM)"},"label":{"type":"String"},"street":{"type":"String"},"pobox":{"type":"String"},"neighborhood":{"type":"String"},"city":{"type":"String"},"region":{"type":"String"},"postcode":{"type":"String"},"country":{"type":"String"}}},"SharedContactAvatar":{"fields":{"attachment":{"type":"JsonAttachment","version":"v1"},"is_profile":{"type":"boolean"}}},"Gradient":{"fields":{"start_color":{"type":"String"},"end_color":{"type":"String"}}}}},"actions":{"v1":{"send":{"request":"SendRequest","response":"SendResponse","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"NoSendPermissionError"},{"name":"InvalidAttachmentError"},{"name":"InternalError"},{"name":"InvalidRequestError"},{"name":"UnknownGroupError"},{"name":"RateLimitError"},{"name":"InvalidRecipientError"},{"name":"AttachmentTooLargeError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"react":{"request":"ReactRequest","response":"SendResponse","doc":"react to a previous message","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"InternalError"},{"name":"InvalidRecipientError"},{"name":"UnknownGroupError"},{"name":"InvalidRequestError"},{"name":"RateLimitError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"version":{"request":"VersionRequest","response":"JsonVersionMessage"},"accept_invitation":{"request":"AcceptInvitationRequest","response":"JsonGroupV2Info","doc":"Accept a v2 group invitation. Note that you must have a profile name set to join groups.","errors":[{"name":"NoSuchAccountError"},{"name":"OwnProfileKeyDoesNotExistError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"UnknownGroupError"},{"name":"InternalError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError","doc":"Can be caused if signald is setup as a linked device that has been removed by the primary device. If trying to update a group, this can also be caused if group permissions don't allow the update (e.g. current role insufficient or not a member)."},{"name":"SQLError"},{"name":"GroupPatchNotAcceptedError","doc":"Caused when server rejects the group update."}]},"approve_membership":{"request":"ApproveMembershipRequest","response":"JsonGroupV2Info","doc":"approve a request to join a group","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"UnknownGroupError"},{"name":"InternalError"},{"name":"GroupVerificationError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError","doc":"Can be caused if signald is setup as a linked device that has been removed by the primary device. If trying to update a group, this can also be caused if group permissions don't allow the update (e.g. current role insufficient or not a member)."},{"name":"SQLError"},{"name":"GroupPatchNotAcceptedError","doc":"Caused when server rejects the group update."}]},"get_group":{"request":"GetGroupRequest","response":"JsonGroupV2Info","doc":"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.","errors":[{"name":"NoSuchAccountError"},{"name":"UnknownGroupError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"InternalError"},{"name":"GroupVerificationError"},{"name":"InvalidGroupStateError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"get_linked_devices":{"request":"GetLinkedDevicesRequest","response":"LinkedDevices","doc":"list all linked devices on a Signal account","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"join_group":{"request":"JoinGroupRequest","response":"JsonGroupJoinInfo","doc":"Join a group using the a signal.group URL. Note that you must have a profile name set to join groups.","errors":[{"name":"InvalidRequestError"},{"name":"InvalidInviteURIError"},{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"OwnProfileKeyDoesNotExistError"},{"name":"GroupVerificationError"},{"name":"GroupNotActiveError"},{"name":"UnknownGroupError"},{"name":"InvalidGroupStateError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"remove_linked_device":{"request":"RemoveLinkedDeviceRequest","doc":"Remove a linked device from the Signal account. Only allowed when the local device id is 1","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"update_group":{"request":"UpdateGroupRequest","response":"GroupInfo","doc":"modify a group. Note that only one modification action may be performed at once","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"UnknownGroupError"},{"name":"GroupVerificationError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError","doc":"Can be caused if signald is setup as a linked device that has been removed by the primary device. If trying to update a group, this can also be caused if group permissions don't allow the update (e.g. current role insufficient or not a member)."},{"name":"UnregisteredUserError"},{"name":"SQLError"},{"name":"GroupPatchNotAcceptedError","doc":"Caused when server rejects the group update, e.g. trying to add a user that's already in the group"},{"name":"UnsupportedGroupError"}]},"set_profile":{"request":"SetProfile","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"InvalidBase64Error"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"resolve_address":{"request":"ResolveAddressRequest","response":"JsonAddress","doc":"Resolve a partial JsonAddress with only a number or UUID to one with both. Anywhere that signald accepts a JsonAddress will except a partial, this is a convenience function for client authors, mostly because signald doesn't resolve all the partials it returns.","errors":[{"name":"InternalError"},{"name":"NoSuchAccountError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"mark_read":{"request":"MarkReadRequest","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"InternalError"},{"name":"UntrustedIdentityError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"},{"name":"InvalidRequestError"},{"name":"ProofRequiredError"}]},"get_profile":{"request":"GetProfileRequest","response":"Profile","doc":"Get all information available about a user","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"ProfileUnavailableError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"},{"name":"InvalidRequestError"}]},"list_groups":{"request":"ListGroupsRequest","response":"GroupList","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"list_contacts":{"request":"ListContactsRequest","response":"ProfileList","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"},{"name":"InvalidRequestError"}]},"create_group":{"request":"CreateGroupRequest","response":"JsonGroupV2Info","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"OwnProfileKeyDoesNotExistError"},{"name":"NoKnownUUIDError"},{"name":"InvalidRequestError"},{"name":"GroupVerificationError"},{"name":"InvalidGroupStateError"},{"name":"UnknownGroupError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"leave_group":{"request":"LeaveGroupRequest","response":"GroupInfo","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"InternalError"},{"name":"UnknownGroupError"},{"name":"GroupVerificationError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"generate_linking_uri":{"request":"GenerateLinkingURIRequest","response":"LinkingURI","doc":"Generate a linking URI. Typically this is QR encoded and scanned by the primary device. Submit the returned session_id with a finish_link request.","errors":[{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"}]},"finish_link":{"request":"FinishLinkRequest","response":"Account","doc":"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.","errors":[{"name":"NoSuchSessionError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"InternalError"},{"name":"NoSuchAccountError"},{"name":"UserAlreadyExistsError"},{"name":"ScanTimeoutError"}]},"add_device":{"request":"AddLinkedDeviceRequest","doc":"Link a new device to a local Signal account","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"InvalidRequestError","doc":"caused by syntax errors with the provided linking URI"},{"name":"InternalError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"register":{"request":"RegisterRequest","response":"Account","doc":"begin the account registration process by requesting a phone number verification code. when the code is received, submit it with a verify request","errors":[{"name":"CaptchaRequiredError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"}]},"verify":{"request":"VerifyRequest","response":"Account","doc":"verify an account's phone number with a code after registering, completing the account creation process","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"AccountHasNoKeysError"},{"name":"AccountAlreadyVerifiedError"},{"name":"AccountLockedError"},{"name":"NoSuchAccountError"}]},"get_identities":{"request":"GetIdentitiesRequest","response":"IdentityKeyList","doc":"Get information about a known keys for a particular address","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"trust":{"request":"TrustRequest","doc":"Trust another user's safety number using either the QR code data or the safety number text","errors":[{"name":"InvalidRequestError"},{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"FingerprintVersionMismatchError"},{"name":"InvalidBase64Error"},{"name":"UnknownIdentityKeyError"},{"name":"InvalidFingerprintError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"delete_account":{"request":"DeleteAccountRequest","doc":"delete all account data signald has on disk, and optionally delete the account from the server as well. Note that this is not \"unlink\" and will delete the entire account, even from a linked device.","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"SQLError"}]},"typing":{"request":"TypingRequest","doc":"send a typing started or stopped message","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"InvalidRecipientError"},{"name":"InvalidGroupError"},{"name":"UntrustedIdentityError"},{"name":"UnknownGroupError"},{"name":"InvalidRequestError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"reset_session":{"request":"ResetSessionRequest","response":"SendResponse","doc":"reset a session with a particular user","errors":[{"name":"InternalError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"NoSuchAccountError"},{"name":"InvalidRequestError"},{"name":"UnknownGroupError"},{"name":"RateLimitError"},{"name":"InvalidRecipientError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"request_sync":{"request":"RequestSyncRequest","doc":"Request other devices on the account send us their group list, syncable config and contact list.","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"UntrustedIdentityError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"list_accounts":{"request":"ListAccountsRequest","response":"AccountList","doc":"return all local accounts","errors":[{"name":"NoSuchAccountError"},{"name":"InternalError"}]},"group_link_info":{"request":"GroupLinkInfoRequest","response":"JsonGroupJoinInfo","doc":"Get information about a group from a signal.group link","errors":[{"name":"GroupLinkNotActiveError"},{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"InvalidRequestError"},{"name":"GroupVerificationError"},{"name":"SQLError"}]},"update_contact":{"request":"UpdateContactRequest","response":"Profile","doc":"update information about a local contact","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"InternalError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"set_expiration":{"request":"SetExpirationRequest","response":"SendResponse","doc":"Set the message expiration timer for a thread. Expiration must be specified in seconds, set to 0 to disable timer","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"UnknownGroupError"},{"name":"GroupVerificationError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError","doc":"Can be caused if signald is setup as a linked device that has been removed by the primary device. If trying to update a group, this can also be caused if group permissions don't allow the update (e.g. current role insufficient or not a member)."},{"name":"UnregisteredUserError"},{"name":"SQLError"},{"name":"GroupPatchNotAcceptedError","doc":"If updating a group, caused when server rejects the group update."},{"name":"UnsupportedGroupError"}]},"set_device_name":{"request":"SetDeviceNameRequest","doc":"set this device's name. This will show up on the mobile device on the same account under settings -> linked devices","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"},{"name":"InvalidRequestError"}]},"get_all_identities":{"request":"GetAllIdentities","response":"AllIdentityKeyList","doc":"get all known identity keys","errors":[{"name":"InvalidProxyError"},{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InternalError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"subscribe":{"request":"SubscribeRequest","doc":"receive incoming messages. After making a subscribe request, incoming messages will be sent to the client encoded as ClientMessageWrapper. Send an unsubscribe request or disconnect from the socket to stop receiving messages.","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"InternalError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"unsubscribe":{"request":"UnsubscribeRequest","doc":"See subscribe for more info","errors":[{"name":"NoSuchAccountError"},{"name":"InternalError"},{"name":"SQLError"}]},"remote_delete":{"request":"RemoteDeleteRequest","response":"SendResponse","doc":"delete a message previously sent","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"InvalidRecipientError"},{"name":"UnknownGroupError"},{"name":"InvalidRequestError"},{"name":"RateLimitError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"add_server":{"request":"AddServerRequest","response":"String","doc":"add a new server to connect to. Returns the new server's UUID.","errors":[{"name":"InvalidProxyError"},{"name":"InternalError"}]},"get_servers":{"request":"GetServersRequest","response":"ServerList","errors":[{"name":"InternalError"}]},"delete_server":{"request":"RemoveServerRequest","errors":[{"name":"InternalError"}]},"send_payment":{"request":"SendPaymentRequest","response":"SendResponse","doc":"send a mobilecoin payment","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"InvalidBase64Error"},{"name":"InvalidRecipientError"},{"name":"UnknownGroupError"},{"name":"InvalidRequestError"},{"name":"RateLimitError"},{"name":"UnregisteredUserError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"get_remote_config":{"request":"RemoteConfigRequest","response":"RemoteConfigList","doc":"Retrieves the remote config (feature flags) from the server.","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"SQLError"}]},"refuse_membership":{"request":"RefuseMembershipRequest","response":"JsonGroupV2Info","doc":"deny a request to join a group","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"UnknownGroupError"},{"name":"GroupVerificationError"},{"name":"InternalError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError","doc":"Can be caused if signald is setup as a linked device that has been removed by the primary device. If trying to update a group, this can also be caused if group permissions don't allow the update (e.g. current role insufficient or not a member)."},{"name":"UnregisteredUserError"},{"name":"SQLError"},{"name":"GroupPatchNotAcceptedError","doc":"Caused when server rejects the group update."}]},"submit_challenge":{"request":"SubmitChallengeRequest","errors":[{"name":"NoSuchAccountError"},{"name":"InvalidRequestError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"InternalError"},{"name":"SQLError"}]},"is_identifier_registered":{"request":"IsIdentifierRegisteredRequest","response":"BooleanMessage","doc":"Determine whether an account identifier is registered on the Signal service.","errors":[{"name":"InternalError"},{"name":"InvalidProxyError"},{"name":"ServerNotFoundError"},{"name":"NoSuchAccountError"},{"name":"SQLError"}]},"wait_for_scan":{"request":"WaitForScanRequest","doc":"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","errors":[{"name":"NoSuchSessionError"},{"name":"ScanTimeoutError"},{"name":"InternalError"}]},"get_group_revision_pages":{"request":"GetGroupRevisionPagesRequest","response":"GroupHistoryPage","doc":"Query the server for group revision history. The history contains information about the changes between each revision and the user that made the change.","errors":[{"name":"NoSuchAccountError"},{"name":"UnknownGroupError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"InternalError"},{"name":"GroupVerificationError"},{"name":"InvalidGroupStateError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError","doc":"caused when not a member of the group, when requesting logs from a revision lower than your joinedAtVersion, etc."},{"name":"RateLimitError"},{"name":"SQLError"}]},"send_sync_message":{"request":"SendSyncMessageRequest","response":"JsonSendMessageResult","doc":"Sends a sync message to the account's devices","errors":[{"name":"InvalidRequestError"},{"name":"RateLimitError"},{"name":"InternalError"},{"name":"UnregisteredUserError"},{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"AuthorizationFailedError"},{"name":"SQLError"}]},"ban_user":{"request":"BanUserRequest","response":"JsonGroupV2Info","doc":"Bans users from a group. This works even if the users aren't in the group. If they are currently in the group, they will also be removed.","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"UnknownGroupError"},{"name":"GroupVerificationError"},{"name":"InternalError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError","doc":"Can be caused if signald is setup as a linked device that has been removed by the primary device. If trying to update a group, this can also be caused if group permissions don't allow the update (e.g. current role insufficient or not a member)."},{"name":"SQLError"},{"name":"GroupPatchNotAcceptedError","doc":"Caused when server rejects the group update."}]},"unban_user":{"request":"UnbanUserRequest","response":"JsonGroupV2Info","doc":"Unbans users from a group.","errors":[{"name":"NoSuchAccountError"},{"name":"ServerNotFoundError"},{"name":"InvalidProxyError"},{"name":"UnknownGroupError"},{"name":"GroupVerificationError"},{"name":"InternalError"},{"name":"InvalidRequestError"},{"name":"AuthorizationFailedError","doc":"Can be caused if signald is setup as a linked device that has been removed by the primary device. If trying to update a group, this can also be caused if group permissions don't allow the update (e.g. current role insufficient or not a member)."},{"name":"SQLError"},{"name":"GroupPatchNotAcceptedError","doc":"Caused when server rejects the group update."}]}}}} \ No newline at end of file +{ + "doc_version": "v1", + "version": { + "name": "signald", + "version": "0.17.0", + "branch": "main", + "commit": "3d482a6060b7235a18cdb8a4dc60aba61f99da74" + }, + "info": "This document describes objects that may be used when communicating with signald.", + "types": { + "v0": { + "JsonAccountList": { + "fields": { + "accounts": { + "list": true, + "type": "JsonAccount", + "version": "v0" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonMessageEnvelope": { + "fields": { + "username": { + "type": "String", + "example": "\"+12024561414\"" + }, + "uuid": { + "type": "String", + "example": "\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"" + }, + "source": { + "type": "JsonAddress", + "version": "v0" + }, + "sourceDevice": { + "type": "int" + }, + "type": { + "type": "String" + }, + "relay": { + "type": "String", + "doc": "this field is no longer available and will never be populated" + }, + "timestamp": { + "type": "long", + "example": "1615576442475" + }, + "timestampISO": { + "type": "String" + }, + "serverTimestamp": { + "type": "long" + }, + "serverDeliveredTimestamp": { + "type": "long", + "example": "161557644247580" + }, + "hasLegacyMessage": { + "type": "boolean" + }, + "hasContent": { + "type": "boolean" + }, + "isUnidentifiedSender": { + "type": "boolean" + }, + "dataMessage": { + "type": "JsonDataMessage", + "version": "v0" + }, + "syncMessage": { + "type": "JsonSyncMessage", + "version": "v0" + }, + "callMessage": { + "type": "JsonCallMessage", + "version": "v0" + }, + "receipt": { + "type": "JsonReceiptMessage", + "version": "v0" + }, + "typing": { + "type": "JsonTypingMessage", + "version": "v0" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonAccount": { + "fields": { + "deviceId": { + "type": "int" + }, + "username": { + "type": "String" + }, + "filename": { + "type": "String" + }, + "uuid": { + "type": "String" + }, + "registered": { + "type": "boolean" + }, + "has_keys": { + "type": "boolean" + }, + "subscribed": { + "type": "boolean" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonAddress": { + "fields": { + "number": { + "type": "String" + }, + "uuid": { + "type": "UUID" + }, + "relay": { + "type": "String" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonDataMessage": { + "fields": { + "timestamp": { + "type": "long", + "doc": "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.", + "example": "1615576442475" + }, + "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.", + "example": "\"hello\"" + }, + "group": { + "type": "JsonGroupInfo", + "version": "v0", + "doc": "if the incoming message was sent to a v1 group, information about that group will be here" + }, + "groupV2": { + "type": "JsonGroupV2Info", + "version": "v0", + "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": "v0", + "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": "v0", + "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" + }, + "mentions": { + "list": true, + "type": "JsonMention", + "version": "v0", + "doc": "list of mentions in the message" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonSyncMessage": { + "fields": { + "sent": { + "type": "JsonSentTranscriptMessage", + "version": "v0" + }, + "contacts": { + "type": "JsonAttachment", + "version": "v0" + }, + "contactsComplete": { + "type": "boolean" + }, + "groups": { + "type": "JsonAttachment", + "version": "v0" + }, + "blockedList": { + "type": "JsonBlockedListMessage", + "version": "v0" + }, + "request": { + "type": "String" + }, + "readMessages": { + "list": true, + "type": "JsonReadMessage", + "version": "v0" + }, + "viewOnceOpen": { + "type": "JsonViewOnceOpenMessage", + "version": "v0" + }, + "verified": { + "type": "JsonVerifiedMessage", + "version": "v0" + }, + "configuration": { + "type": "ConfigurationMessage", + "version": "v0" + }, + "stickerPackOperations": { + "list": true, + "type": "JsonStickerPackOperationMessage", + "version": "v0" + }, + "fetchType": { + "type": "String" + }, + "messageRequestResponse": { + "type": "JsonMessageRequestResponseMessage", + "version": "v0" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "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" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonReceiptMessage": { + "fields": { + "type": { + "type": "String" + }, + "timestamps": { + "list": true, + "type": "Long" + }, + "when": { + "type": "long" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonTypingMessage": { + "fields": { + "action": { + "type": "String" + }, + "timestamp": { + "type": "long" + }, + "groupId": { + "type": "String" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "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" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonGroupInfo": { + "fields": { + "groupId": { + "type": "String" + }, + "members": { + "list": true, + "type": "JsonAddress", + "version": "v0" + }, + "name": { + "type": "String" + }, + "type": { + "type": "String" + }, + "avatarId": { + "type": "long" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonGroupV2Info": { + "fields": { + "id": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"" + }, + "revision": { + "type": "int", + "example": "5" + }, + "title": { + "type": "String", + "example": "\"Parkdale Run Club\"" + }, + "description": { + "type": "String" + }, + "avatar": { + "type": "String", + "doc": "path to the group's avatar on local disk, if available", + "example": "\"/var/lib/signald/avatars/group-EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"" + }, + "timer": { + "type": "int", + "example": "604800" + }, + "members": { + "list": true, + "type": "JsonAddress", + "version": "v0" + }, + "pendingMembers": { + "list": true, + "type": "JsonAddress", + "version": "v0" + }, + "requestingMembers": { + "list": true, + "type": "JsonAddress", + "version": "v0" + }, + "inviteLink": { + "type": "String", + "doc": "the signal.group link, if applicable" + }, + "accessControl": { + "type": "GroupAccessControl", + "version": "v0", + "doc": "current access control settings for this group" + }, + "memberDetail": { + "list": true, + "type": "GroupMember", + "version": "v0", + "doc": "detailed member list" + }, + "pendingMemberDetail": { + "list": true, + "type": "GroupMember", + "version": "v0", + "doc": "detailed pending member list" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonQuote": { + "fields": { + "id": { + "type": "long", + "doc": "the client timestamp of the message being quoted", + "example": "1615576442475" + }, + "author": { + "type": "JsonAddress", + "version": "v0", + "doc": "the author of the message being quoted" + }, + "text": { + "type": "String", + "doc": "the body of the message being quoted", + "example": "\"hey ? what's up?\"" + }, + "attachments": { + "list": true, + "type": "JsonQuotedAttachment", + "version": "v0", + "doc": "list of files attached to the quoted message" + }, + "mentions": { + "list": true, + "type": "JsonMention", + "version": "v0", + "doc": "list of mentions in the quoted message" + } + }, + "doc": "A quote is a reply to a previous message. ID is the sent time of the message being replied to", + "deprecated": true, + "removal_date": 1641027661 + }, + "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" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonSticker": { + "fields": { + "packID": { + "type": "String" + }, + "packKey": { + "type": "String" + }, + "stickerID": { + "type": "int" + }, + "attachment": { + "type": "JsonAttachment", + "version": "v0" + }, + "image": { + "type": "String" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonReaction": { + "fields": { + "emoji": { + "type": "String", + "doc": "the emoji to react with", + "example": "\"?\"" + }, + "remove": { + "type": "boolean", + "doc": "set to true to remove the reaction. requires emoji be set to previously reacted emoji" + }, + "targetAuthor": { + "type": "JsonAddress", + "version": "v0", + "doc": "the author of the message being reacted to" + }, + "targetSentTimestamp": { + "type": "long", + "doc": "the client timestamp of the message being reacted to", + "example": "1615576442475" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "RemoteDelete": { + "fields": { + "targetSentTimestamp": { + "type": "long" + } + } + }, + "JsonMention": { + "fields": { + "uuid": { + "type": "String", + "doc": "The UUID of the account being mentioned", + "example": "\"aeed01f0-a234-478e-8cf7-261c283151e7\"" + }, + "start": { + "type": "int", + "doc": "The number of characters in that the mention starts at. Note that due to a quirk of how signald encodes JSON, if this value is 0 (for example if the first character in the message is the mention) the field won't show up.", + "example": "4" + }, + "length": { + "type": "int", + "doc": "The length of the mention represented in the message. Seems to always be 1 but included here in case that changes.", + "example": "1" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonSentTranscriptMessage": { + "fields": { + "destination": { + "type": "JsonAddress", + "version": "v0" + }, + "timestamp": { + "type": "long", + "example": "1615576442475" + }, + "expirationStartTimestamp": { + "type": "long" + }, + "message": { + "type": "JsonDataMessage", + "version": "v0" + }, + "unidentifiedStatus": { + "type": "Map" + }, + "isRecipientUpdate": { + "type": "boolean" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonBlockedListMessage": { + "fields": { + "addresses": { + "list": true, + "type": "JsonAddress", + "version": "v0" + }, + "groupIds": { + "list": true, + "type": "String" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonReadMessage": { + "fields": { + "sender": { + "type": "JsonAddress", + "version": "v0" + }, + "timestamp": { + "type": "long", + "example": "1615576442475" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonViewOnceOpenMessage": { + "fields": { + "sender": { + "type": "JsonAddress", + "version": "v0" + }, + "timestamp": { + "type": "long", + "example": "1615576442475" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonVerifiedMessage": { + "fields": { + "destination": { + "type": "JsonAddress", + "version": "v0" + }, + "identityKey": { + "type": "String" + }, + "verified": { + "type": "String" + }, + "timestamp": { + "type": "long" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "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" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "JsonMessageRequestResponseMessage": { + "fields": { + "person": { + "type": "JsonAddress", + "version": "v0" + }, + "groupId": { + "type": "String" + }, + "type": { + "type": "String" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "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" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "GroupAccessControl": { + "fields": { + "link": { + "type": "String", + "doc": "UNSATISFIABLE when the group link is disabled, ADMINISTRATOR when the group link is enabled but an administrator must approve new members, ANY when the group link is enabled and no approval is required", + "example": "\"ANY\"" + }, + "attributes": { + "type": "String", + "doc": "who can edit group info" + }, + "members": { + "type": "String", + "doc": "who can add members" + } + }, + "doc": "group access control settings. Options for each controlled action are: UNKNOWN, ANY, MEMBER, ADMINISTRATOR, UNSATISFIABLE and UNRECOGNIZED", + "deprecated": true, + "removal_date": 1641027661 + }, + "GroupMember": { + "fields": { + "uuid": { + "type": "String", + "example": "\"aeed01f0-a234-478e-8cf7-261c283151e7\"" + }, + "role": { + "type": "String", + "doc": "possible values are: UNKNOWN, DEFAULT, ADMINISTRATOR and UNRECOGNIZED", + "example": "\"DEFAULT\"" + }, + "joined_revision": { + "type": "int" + } + }, + "deprecated": true, + "removal_date": 1641027661 + }, + "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": {} + } + }, + "v1": { + "ListenerState": { + "fields": { + "connected": { + "type": "boolean" + } + }, + "doc": "prior attempt to indicate signald connectivity state. WebSocketConnectionState messages will be delivered at the same time as well as in other parts of the websocket lifecycle." + }, + "IncomingMessage": { + "fields": { + "account": { + "type": "String", + "example": "\"+12024561414\"" + }, + "source": { + "type": "JsonAddress", + "version": "v1" + }, + "type": { + "type": "String" + }, + "timestamp": { + "type": "long", + "example": "1615576442475" + }, + "source_device": { + "type": "int" + }, + "server_receiver_timestamp": { + "type": "long", + "example": "1615576442475" + }, + "server_deliver_timestamp": { + "type": "long", + "example": "1615576442475" + }, + "has_legacy_message": { + "type": "boolean" + }, + "has_content": { + "type": "boolean" + }, + "unidentified_sender": { + "type": "boolean" + }, + "data_message": { + "type": "JsonDataMessage", + "version": "v1" + }, + "sync_message": { + "type": "JsonSyncMessage", + "version": "v1" + }, + "call_message": { + "type": "CallMessage", + "version": "v1" + }, + "receipt_message": { + "type": "ReceiptMessage", + "version": "v1" + }, + "typing_message": { + "type": "TypingMessage", + "version": "v1" + }, + "server_guid": { + "type": "String" + } + } + }, + "WebSocketConnectionState": { + "fields": { + "state": { + "type": "String", + "doc": "One of: DISCONNECTED, CONNECTING, CONNECTED, RECONNECTING, DISCONNECTING, AUTHENTICATION_FAILED, FAILED" + }, + "socket": { + "type": "String", + "doc": "One of: UNIDENTIFIED, IDENTIFIED" + } + }, + "doc": "indicates when the websocket connection state to the signal server has changed" + }, + "JsonMessageEnvelope": { + "fields": { + "username": { + "type": "String", + "example": "\"+12024561414\"" + }, + "uuid": { + "type": "String", + "example": "\"0cc10e61-d64c-4dbc-b51c-334f7dd45a4a\"" + }, + "source": { + "type": "JsonAddress", + "version": "v1" + }, + "sourceDevice": { + "type": "int" + }, + "type": { + "type": "String" + }, + "relay": { + "type": "String" + }, + "timestamp": { + "type": "long", + "example": "1615576442475" + }, + "timestampISO": { + "type": "String" + }, + "serverTimestamp": { + "type": "long" + }, + "serverDeliveredTimestamp": { + "type": "long", + "example": "161557644247580" + }, + "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" + } + } + }, + "ClientMessageWrapper": { + "fields": { + "type": { + "type": "String", + "doc": "the type of object to expect in the `data` field" + }, + "version": { + "type": "String", + "doc": "the version of the object in the `data` field" + }, + "data": { + "type": "Object", + "doc": "the incoming object. The structure will vary from message to message, see `type` and `version` fields" + }, + "error": { + "type": "Boolean", + "doc": "true if the incoming message represents an error" + }, + "account": { + "type": "String", + "doc": "the account this message is from" + } + }, + "doc": "Wraps all incoming messages sent to the client after a v1 subscribe request is issued" + }, + "UntrustedIdentityError": { + "fields": { + "identifier": { + "type": "String" + }, + "message": { + "type": "String" + }, + "identity_key": { + "type": "IdentityKey", + "version": "v1" + } + }, + "error": true + }, + "ProtocolInvalidMessageError": { + "fields": { + "sender": { + "type": "String" + }, + "timestamp": { + "type": "long" + }, + "message": { + "type": "String" + }, + "sender_device": { + "type": "int" + }, + "content_hint": { + "type": "int" + }, + "group_id": { + "type": "String" + } + }, + "error": true + }, + "DuplicateMessageError": { + "fields": { + "timestamp": { + "type": "long" + }, + "message": { + "type": "String" + } + }, + "error": true + }, + "SendRequest": { + "fields": { + "username": { + "type": "String", + "example": "\"+12024561414\"", + "required": true + }, + "recipientAddress": { + "type": "JsonAddress", + "version": "v1" + }, + "recipientGroupId": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"" + }, + "messageBody": { + "type": "String", + "example": "\"hello\"" + }, + "attachments": { + "list": true, + "type": "JsonAttachment", + "version": "v1" + }, + "quote": { + "type": "JsonQuote", + "version": "v1" + }, + "timestamp": { + "type": "Long" + }, + "mentions": { + "list": true, + "type": "JsonMention", + "version": "v1" + }, + "previews": { + "list": true, + "type": "JsonPreview", + "version": "v1" + }, + "members": { + "list": true, + "type": "JsonAddress", + "version": "v1", + "doc": "Optionally set to a sub-set of group members. Ignored if recipientGroupId isn't specified" + } + } + }, + "SendResponse": { + "fields": { + "results": { + "list": true, + "type": "JsonSendMessageResult", + "version": "v1" + }, + "timestamp": { + "type": "long", + "example": "1615576442475" + } + } + }, + "NoSuchAccountError": { + "fields": { + "account": { + "type": "String" + }, + "message": { + "type": "String" + } + }, + "error": true + }, + "ServerNotFoundError": { + "fields": { + "uuid": { + "type": "String" + }, + "message": { + "type": "String" + } + }, + "error": true + }, + "InvalidProxyError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "NoSendPermissionError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "InvalidAttachmentError": { + "fields": { + "filename": { + "type": "String" + }, + "message": { + "type": "String" + } + }, + "error": true + }, + "InternalError": { + "fields": { + "exceptions": { + "list": true, + "type": "String" + }, + "message": { + "type": "String" + } + }, + "doc": "an internal error in signald has occurred. typically these are things that \"should never happen\" such as issues saving to the local disk, but it is also the default error type and may catch some things that should have their own error type. If you find tht your code is depending on the exception list for any particular behavior, please file an issue so we can pull those errors out to a separate error type: https://gitlab.com/signald/signald/-/issues/new", + "error": true + }, + "InvalidRequestError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "UnknownGroupError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "RateLimitError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "InvalidRecipientError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "AttachmentTooLargeError": { + "fields": { + "filename": { + "type": "String" + }, + "message": { + "type": "String" + } + }, + "error": true + }, + "ReactRequest": { + "fields": { + "username": { + "type": "String", + "example": "\"+12024561414\"", + "required": true + }, + "recipientAddress": { + "type": "JsonAddress", + "version": "v1" + }, + "recipientGroupId": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"" + }, + "reaction": { + "type": "JsonReaction", + "version": "v1", + "required": true + }, + "timestamp": { + "type": "long" + }, + "members": { + "list": true, + "type": "JsonAddress", + "version": "v1", + "doc": "Optionally set to a sub-set of group members. Ignored if recipientGroupId isn't specified" + } + }, + "doc": "react to a previous message" + }, + "UnregisteredUserError": { + "fields": { + "message": { + "type": "String" + }, + "e164_number": { + "type": "String" + } + }, + "error": true + }, + "VersionRequest": { + "fields": {} + }, + "JsonVersionMessage": { + "fields": { + "name": { + "type": "String", + "example": "\"signald\"" + }, + "version": { + "type": "String", + "example": "\"0.17.0\"" + }, + "branch": { + "type": "String", + "example": "\"main\"" + }, + "commit": { + "type": "String", + "example": "\"3d482a6060b7235a18cdb8a4dc60aba61f99da74\"" + } + } + }, + "AcceptInvitationRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "groupID": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"", + "required": true + } + }, + "doc": "Accept a v2 group invitation. Note that you must have a profile name set to join groups." + }, + "JsonGroupV2Info": { + "fields": { + "id": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"" + }, + "revision": { + "type": "int", + "example": "5" + }, + "title": { + "type": "String", + "example": "\"Parkdale Run Club\"" + }, + "description": { + "type": "String" + }, + "avatar": { + "type": "String", + "doc": "path to the group's avatar on local disk, if available", + "example": "\"/var/lib/signald/avatars/group-EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"" + }, + "timer": { + "type": "int", + "example": "604800" + }, + "members": { + "list": true, + "type": "JsonAddress", + "version": "v1" + }, + "pendingMembers": { + "list": true, + "type": "JsonAddress", + "version": "v1" + }, + "requestingMembers": { + "list": true, + "type": "JsonAddress", + "version": "v1" + }, + "inviteLink": { + "type": "String", + "doc": "the signal.group link, if applicable" + }, + "accessControl": { + "type": "GroupAccessControl", + "version": "v1", + "doc": "current access control settings for this group" + }, + "memberDetail": { + "list": true, + "type": "GroupMember", + "version": "v1", + "doc": "detailed member list" + }, + "pendingMemberDetail": { + "list": true, + "type": "GroupMember", + "version": "v1", + "doc": "detailed pending member list" + }, + "announcements": { + "type": "String", + "doc": "indicates if the group is an announcements group. Only admins are allowed to send messages to announcements groups. Options are UNKNOWN, ENABLED or DISABLED" + }, + "removed": { + "type": "boolean", + "doc": "will be set to true for incoming messages to indicate the user has been removed from the group" + } + }, + "doc": "Information about a Signal group" + }, + "OwnProfileKeyDoesNotExistError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "AuthorizationFailedError": { + "fields": { + "message": { + "type": "String" + } + }, + "doc": "indicates the server rejected our credentials. Typically means the linked device was removed by the primary device, or that the account was re-registered", + "error": true + }, + "ApproveMembershipRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "groupID": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"", + "required": true + }, + "members": { + "list": true, + "type": "JsonAddress", + "version": "v1", + "doc": "list of requesting members to approve", + "required": true + } + }, + "doc": "approve a request to join a group" + }, + "GroupVerificationError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "GetGroupRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "groupID": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"", + "required": true + }, + "revision": { + "type": "int", + "doc": "the latest known revision, default value (-1) forces fetch from server" + } + }, + "doc": "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." + }, + "InvalidGroupStateError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "GetLinkedDevicesRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + } + }, + "doc": "list all linked devices on a Signal account" + }, + "LinkedDevices": { + "fields": { + "devices": { + "list": true, + "type": "DeviceInfo", + "version": "v1" + } + } + }, + "JoinGroupRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "uri": { + "type": "String", + "doc": "The signal.group URL", + "example": "\"https://signal.group/#CjQKINH_GZhXhfifTcnBkaKTNRxW-hHKnGSq-cJNyPVqHRp8EhDUB7zjKNEl0NaULhsqJCX3\"", + "required": true + } + }, + "doc": "Join a group using the a signal.group URL. Note that you must have a profile name set to join groups." + }, + "JsonGroupJoinInfo": { + "fields": { + "groupID": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"" + }, + "title": { + "type": "String", + "example": "\"Parkdale Run Club\"" + }, + "description": { + "type": "String", + "example": "\"A club for running in Parkdale\"" + }, + "memberCount": { + "type": "int", + "example": "3" + }, + "addFromInviteLink": { + "type": "int", + "doc": "The access level required in order to join the group from the invite link, as an AccessControl.AccessRequired enum from the upstream Signal groups.proto file. This is UNSATISFIABLE (4) when the group link is disabled; ADMINISTRATOR (3) when the group link is enabled, but an administrator must approve new members; and ANY (1) when the group link is enabled and no approval is required. See theGroupAccessControl structure and the upstream enum ordinals." + }, + "revision": { + "type": "int", + "doc": "The Group V2 revision. This is incremented by clients whenever they update group information, and it is often used by clients to determine if the local group state is out-of-date with the server's revision.", + "example": "5" + }, + "pendingAdminApproval": { + "type": "boolean", + "doc": "Whether the account is waiting for admin approval in order to be added to the group." + } + } + }, + "InvalidInviteURIError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "GroupNotActiveError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "RemoveLinkedDeviceRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "deviceId": { + "type": "long", + "doc": "the ID of the device to unlink", + "example": "3", + "required": true + } + }, + "doc": "Remove a linked device from the Signal account. Only allowed when the local device id is 1" + }, + "UpdateGroupRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The identifier of the account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "groupID": { + "type": "String", + "doc": "the ID of the group to update", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"", + "required": true + }, + "title": { + "type": "String", + "example": "\"Parkdale Run Club\"" + }, + "description": { + "type": "String", + "doc": "A new group description. Set to empty string to remove an existing description.", + "example": "\"A club for running in Parkdale\"" + }, + "avatar": { + "type": "String", + "example": "\"/tmp/image.jpg\"" + }, + "updateTimer": { + "type": "int", + "doc": "update the group timer." + }, + "addMembers": { + "list": true, + "type": "JsonAddress", + "version": "v1" + }, + "removeMembers": { + "list": true, + "type": "JsonAddress", + "version": "v1" + }, + "updateRole": { + "type": "GroupMember", + "version": "v1" + }, + "updateAccessControl": { + "type": "GroupAccessControl", + "version": "v1", + "doc": "note that only one of the access controls may be updated per request" + }, + "resetLink": { + "type": "boolean", + "doc": "regenerate the group link password, invalidating the old one" + }, + "announcements": { + "type": "String", + "doc": "ENABLED to only allow admins to post messages, DISABLED to allow anyone to post" + } + }, + "doc": "modify a group. Note that only one modification action may be performed at once" + }, + "GroupInfo": { + "fields": { + "v1": { + "type": "JsonGroupInfo", + "version": "v1" + }, + "v2": { + "type": "JsonGroupV2Info", + "version": "v1" + } + }, + "doc": "A generic type that is used when the group version is not known" + }, + "SetProfile": { + "fields": { + "account": { + "type": "String", + "doc": "The phone number of the account to use", + "example": "\"+12024561414\"", + "required": true + }, + "name": { + "type": "String", + "doc": "Change the profile name", + "example": "\"signald user\"" + }, + "avatarFile": { + "type": "String", + "doc": "Path to new profile avatar file. If unset or null, unset the profile avatar", + "example": "\"/tmp/image.jpg\"" + }, + "about": { + "type": "String", + "doc": "Change the 'about' profile field" + }, + "emoji": { + "type": "String", + "doc": "Change the profile emoji" + }, + "mobilecoin_address": { + "type": "String", + "doc": "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." + }, + "visible_badge_ids": { + "list": true, + "type": "String", + "doc": "configure visible badge IDs" + } + } + }, + "InvalidBase64Error": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "ResolveAddressRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The signal account to use", + "example": "\"+12024561414\"", + "required": true + }, + "partial": { + "type": "JsonAddress", + "version": "v1", + "doc": "The partial address, missing fields", + "required": true + } + }, + "doc": "Resolve a partial JsonAddress with only a number or UUID to one with both. Anywhere that signald accepts a JsonAddress will except a partial, this is a convenience function for client authors, mostly because signald doesn't resolve all the partials it returns." + }, + "JsonAddress": { + "fields": { + "number": { + "type": "String", + "doc": "An e164 phone number, starting with +. Currently the only available user-facing Signal identifier.", + "example": "\"+13215551234\"" + }, + "uuid": { + "type": "UUID", + "doc": "A UUID, the unique identifier for a particular Signal account." + }, + "relay": { + "type": "String" + } + } + }, + "MarkReadRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "to": { + "type": "JsonAddress", + "version": "v1", + "doc": "The address that sent the message being marked as read", + "required": true + }, + "timestamps": { + "list": true, + "type": "Long", + "doc": "List of messages to mark as read", + "example": "1615576442475", + "required": true + }, + "when": { + "type": "Long" + } + } + }, + "GetProfileRequest": { + "fields": { + "account": { + "type": "String", + "doc": "the signald account to use", + "required": true + }, + "async": { + "type": "boolean", + "doc": "if true, return results from local store immediately, refreshing from server in the background if needed. if false (default), block until profile can be retrieved from server" + }, + "address": { + "type": "JsonAddress", + "version": "v1", + "doc": "the address to look up", + "required": true + } + }, + "doc": "Get all information available about a user" + }, + "Profile": { + "fields": { + "name": { + "type": "String", + "doc": "The user's name from local contact names if available, or if not in contact list their Signal profile name" + }, + "avatar": { + "type": "String", + "doc": "path to avatar on local disk" + }, + "address": { + "type": "JsonAddress", + "version": "v1" + }, + "capabilities": { + "type": "Capabilities", + "version": "v1" + }, + "color": { + "type": "String", + "doc": "color of the chat with this user" + }, + "about": { + "type": "String" + }, + "emoji": { + "type": "String" + }, + "profile_name": { + "type": "String", + "doc": "The user's Signal profile name" + }, + "inbox_position": { + "type": "Integer" + }, + "expiration_time": { + "type": "int" + }, + "mobilecoin_address": { + "type": "String", + "doc": "*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" + }, + "visible_badge_ids": { + "list": true, + "type": "String", + "doc": "currently unclear how these work, as they are not available in the production Signal apps" + } + }, + "doc": "Information about a Signal user" + }, + "ProfileUnavailableError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "ListGroupsRequest": { + "fields": { + "account": { + "type": "String", + "required": true + } + } + }, + "GroupList": { + "fields": { + "groups": { + "list": true, + "type": "JsonGroupV2Info", + "version": "v1" + }, + "legacyGroups": { + "list": true, + "type": "JsonGroupInfo", + "version": "v1" + } + } + }, + "ListContactsRequest": { + "fields": { + "account": { + "type": "String", + "required": true + }, + "async": { + "type": "boolean", + "doc": "return results from local store immediately, refreshing from server afterward if needed. If false (default), block until all pending profiles have been retrieved." + } + } + }, + "ProfileList": { + "fields": { + "profiles": { + "list": true, + "type": "Profile", + "version": "v1" + } + } + }, + "CreateGroupRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "title": { + "type": "String", + "example": "\"Parkdale Run Club\"", + "required": true + }, + "avatar": { + "type": "String", + "example": "\"/tmp/image.jpg\"" + }, + "members": { + "list": true, + "type": "JsonAddress", + "version": "v1", + "required": true + }, + "timer": { + "type": "int", + "doc": "the message expiration timer" + }, + "member_role": { + "type": "String", + "doc": "The role of all members other than the group creator. Options are ADMINISTRATOR or DEFAULT (case insensitive)", + "example": "\"ADMINISTRATOR\"" + } + } + }, + "NoKnownUUIDError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "LeaveGroupRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to use", + "example": "\"+12024561414\"", + "required": true + }, + "groupID": { + "type": "String", + "doc": "The group to leave", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"", + "required": true + } + } + }, + "GenerateLinkingURIRequest": { + "fields": { + "server": { + "type": "String", + "doc": "The identifier of the server to use. Leave blank for default (usually Signal production servers but configurable at build time)" + } + }, + "doc": "Generate a linking URI. Typically this is QR encoded and scanned by the primary device. Submit the returned session_id with a finish_link request." + }, + "LinkingURI": { + "fields": { + "uri": { + "type": "String" + }, + "session_id": { + "type": "String" + } + } + }, + "FinishLinkRequest": { + "fields": { + "device_name": { + "type": "String" + }, + "session_id": { + "type": "String" + } + }, + "doc": "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." + }, + "Account": { + "fields": { + "address": { + "type": "JsonAddress", + "version": "v1", + "doc": "The address of this account" + }, + "pending": { + "type": "Boolean", + "doc": "indicates the account has not completed registration" + }, + "device_id": { + "type": "int", + "doc": "The Signal device ID. Official Signal mobile clients (iPhone and Android) have device ID = 1, while linked devices such as Signal Desktop or Signal iPad have higher device IDs." + }, + "account_id": { + "type": "String", + "doc": "The primary identifier on the account, included with all requests to signald for this account. Previously called 'username'" + } + }, + "doc": "A local account in signald" + }, + "NoSuchSessionError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "UserAlreadyExistsError": { + "fields": { + "uuid": { + "type": "UUID" + }, + "message": { + "type": "String" + } + }, + "error": true + }, + "ScanTimeoutError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "AddLinkedDeviceRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "uri": { + "type": "String", + "doc": "the sgnl://linkdevice uri provided (typically in qr code form) by the new device", + "example": "\"sgnl://linkdevice?uuid=jAaZ5lxLfh7zVw5WELd6-Q&pub_key=BfFbjSwmAgpVJBXUdfmSgf61eX3a%2Bq9AoxAVpl1HUap9\"", + "required": true + } + }, + "doc": "Link a new device to a local Signal account" + }, + "RegisterRequest": { + "fields": { + "account": { + "type": "String", + "doc": "the e164 phone number to register with", + "example": "\"+12024561414\"", + "required": true + }, + "voice": { + "type": "boolean", + "doc": "set to true to request a voice call instead of an SMS for verification" + }, + "captcha": { + "type": "String", + "doc": "See https://signald.org/articles/captcha/" + }, + "server": { + "type": "String", + "doc": "The identifier of the server to use. Leave blank for default (usually Signal production servers but configurable at build time)" + } + }, + "doc": "begin the account registration process by requesting a phone number verification code. when the code is received, submit it with a verify request" + }, + "CaptchaRequiredError": { + "fields": { + "more": { + "type": "String" + }, + "message": { + "type": "String" + } + }, + "error": true + }, + "VerifyRequest": { + "fields": { + "account": { + "type": "String", + "doc": "the e164 phone number being verified", + "example": "\"+12024561414\"", + "required": true + }, + "code": { + "type": "String", + "doc": "the verification code, dash (-) optional", + "example": "\"555555\"", + "required": true + } + }, + "doc": "verify an account's phone number with a code after registering, completing the account creation process" + }, + "AccountHasNoKeysError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "AccountAlreadyVerifiedError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "AccountLockedError": { + "fields": { + "more": { + "type": "String" + }, + "message": { + "type": "String" + } + }, + "error": true + }, + "GetIdentitiesRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "address": { + "type": "JsonAddress", + "version": "v1", + "doc": "address to get keys for", + "required": true + } + }, + "doc": "Get information about a known keys for a particular address" + }, + "IdentityKeyList": { + "fields": { + "address": { + "type": "JsonAddress", + "version": "v1" + }, + "identities": { + "list": true, + "type": "IdentityKey", + "version": "v1" + } + }, + "doc": "a list of identity keys associated with a particular address" + }, + "TrustRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "address": { + "type": "JsonAddress", + "version": "v1", + "doc": "The user to query identity keys for", + "required": true + }, + "safety_number": { + "type": "String", + "doc": "required if qr_code_data is absent", + "example": "\"373453558586758076680580548714989751943247272727416091564451\"" + }, + "qr_code_data": { + "type": "String", + "doc": "base64-encoded QR code data. required if safety_number is absent" + }, + "trust_level": { + "type": "String", + "doc": "One of TRUSTED_UNVERIFIED, TRUSTED_VERIFIED or UNTRUSTED. Default is TRUSTED_VERIFIED", + "example": "\"TRUSTED_VERIFIED\"" + } + }, + "doc": "Trust another user's safety number using either the QR code data or the safety number text" + }, + "FingerprintVersionMismatchError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "UnknownIdentityKeyError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "InvalidFingerprintError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "DeleteAccountRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to delete", + "example": "\"+12024561414\"", + "required": true + }, + "server": { + "type": "boolean", + "doc": "delete account information from the server as well (default false)" + } + }, + "doc": "delete all account data signald has on disk, and optionally delete the account from the server as well. Note that this is not \"unlink\" and will delete the entire account, even from a linked device." + }, + "TypingRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to use", + "example": "\"+12024561414\"", + "required": true + }, + "address": { + "type": "JsonAddress", + "version": "v1" + }, + "group": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"" + }, + "typing": { + "type": "boolean", + "example": "true", + "required": true + }, + "when": { + "type": "long" + } + }, + "doc": "send a typing started or stopped message" + }, + "InvalidGroupError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "ResetSessionRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to use", + "example": "\"+12024561414\"", + "required": true + }, + "address": { + "type": "JsonAddress", + "version": "v1", + "doc": "the user to reset session with", + "required": true + }, + "timestamp": { + "type": "Long" + } + }, + "doc": "reset a session with a particular user" + }, + "RequestSyncRequest": { + "fields": { + "groups": { + "type": "boolean", + "doc": "request group sync (default true)" + }, + "configuration": { + "type": "boolean", + "doc": "request configuration sync (default true)" + }, + "contacts": { + "type": "boolean", + "doc": "request contact sync (default true)" + }, + "blocked": { + "type": "boolean", + "doc": "request block list sync (default true)" + }, + "keys": { + "type": "boolean", + "doc": "request storage service keys" + }, + "account": { + "type": "String", + "doc": "The account to use", + "example": "\"+12024561414\"", + "required": true + } + }, + "doc": "Request other devices on the account send us their group list, syncable config and contact list." + }, + "ListAccountsRequest": { + "fields": {}, + "doc": "return all local accounts" + }, + "AccountList": { + "fields": { + "accounts": { + "list": true, + "type": "Account", + "version": "v1" + } + } + }, + "GroupLinkInfoRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to use", + "example": "\"+12024561414\"", + "required": true + }, + "uri": { + "type": "String", + "doc": "the signald.group link", + "example": "\"https://signal.group/#CjQKINH_GZhXhfifTcnBkaKTNRxW-hHKnGSq-cJNyPVqHRp8EhDUB7zjKNEl0NaULhsqJCX3\"", + "required": true + } + }, + "doc": "Get information about a group from a signal.group link" + }, + "GroupLinkNotActiveError": { + "fields": { + "message": { + "type": "String" + } + }, + "error": true + }, + "UpdateContactRequest": { + "fields": { + "account": { + "type": "String", + "required": true + }, + "address": { + "type": "JsonAddress", + "version": "v1", + "required": true + }, + "name": { + "type": "String" + }, + "color": { + "type": "String" + }, + "inbox_position": { + "type": "Integer" + } + }, + "doc": "update information about a local contact" + }, + "SetExpirationRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to use", + "example": "\"+12024561414\"", + "required": true + }, + "address": { + "type": "JsonAddress", + "version": "v1" + }, + "group": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"" + }, + "expiration": { + "type": "int", + "example": "604800", + "required": true + } + }, + "doc": "Set the message expiration timer for a thread. Expiration must be specified in seconds, set to 0 to disable timer" + }, + "SetDeviceNameRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to set the device name of", + "example": "\"+12024561414\"", + "required": true + }, + "device_name": { + "type": "String", + "doc": "The device name" + } + }, + "doc": "set this device's name. This will show up on the mobile device on the same account under settings -> linked devices" + }, + "GetAllIdentities": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + } + }, + "doc": "get all known identity keys" + }, + "AllIdentityKeyList": { + "fields": { + "identity_keys": { + "list": true, + "type": "IdentityKeyList", + "version": "v1" + } + } + }, + "SubscribeRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to subscribe to incoming message for", + "example": "\"+12024561414\"", + "required": true + } + }, + "doc": "receive incoming messages. After making a subscribe request, incoming messages will be sent to the client encoded as ClientMessageWrapper. Send an unsubscribe request or disconnect from the socket to stop receiving messages." + }, + "UnsubscribeRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to unsubscribe from", + "example": "\"+12024561414\"", + "required": true + } + }, + "doc": "See subscribe for more info" + }, + "RemoteDeleteRequest": { + "fields": { + "account": { + "type": "String", + "doc": "the account to use", + "example": "\"+12024561414\"", + "required": true + }, + "address": { + "type": "JsonAddress", + "version": "v1", + "doc": "the address to send the delete message to. should match address the message to be deleted was sent to. required if group is not set." + }, + "group": { + "type": "String", + "doc": "the group to send the delete message to. should match group the message to be deleted was sent to. required if address is not set.", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"" + }, + "timestamp": { + "type": "long", + "required": true + }, + "members": { + "list": true, + "type": "JsonAddress", + "version": "v1", + "doc": "Optionally set to a sub-set of group members. Ignored if group isn't specified" + } + }, + "doc": "delete a message previously sent" + }, + "AddServerRequest": { + "fields": { + "server": { + "type": "Server", + "version": "v1", + "required": true + } + }, + "doc": "add a new server to connect to. Returns the new server's UUID." + }, + "GetServersRequest": { + "fields": {} + }, + "ServerList": { + "fields": { + "servers": { + "list": true, + "type": "Server", + "version": "v1" + } + } + }, + "RemoveServerRequest": { + "fields": { + "uuid": { + "type": "String" + } + } + }, + "SendPaymentRequest": { + "fields": { + "account": { + "type": "String", + "doc": "the account to use", + "example": "\"+12024561414\"", + "required": true + }, + "address": { + "type": "JsonAddress", + "version": "v1", + "doc": "the address to send the payment message to", + "required": true + }, + "payment": { + "type": "Payment", + "version": "v1", + "required": true + }, + "when": { + "type": "Long" + } + }, + "doc": "send a mobilecoin payment" + }, + "RemoteConfigRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to use to retrieve the remote config", + "example": "\"+12024561414\"", + "required": true + } + }, + "doc": "Retrieves the remote config (feature flags) from the server." + }, + "RemoteConfigList": { + "fields": { + "config": { + "list": true, + "type": "RemoteConfig", + "version": "v1" + } + } + }, + "RefuseMembershipRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to interact with", + "example": "\"+12024561414\"", + "required": true + }, + "members": { + "list": true, + "type": "JsonAddress", + "version": "v1", + "doc": "list of requesting members to refuse", + "required": true + }, + "group_id": { + "type": "String", + "example": "\"EdSqI90cS0UomDpgUXOlCoObWvQOXlH5G3Z2d3f4ayE=\"", + "required": true + } + }, + "doc": "deny a request to join a group" + }, + "SubmitChallengeRequest": { + "fields": { + "account": { + "type": "String", + "required": true + }, + "challenge": { + "type": "String", + "required": true + }, + "captcha_token": { + "type": "String" + } + } + }, + "IsIdentifierRegisteredRequest": { + "fields": { + "account": { + "type": "String", + "doc": "The account to use to use", + "example": "\"+12024561414\"", + "required": true + }, + "identifier": { + "type": "String", + "doc": "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).", + "example": "\"aeed01f0-a234-478e-8cf7-261c283151e7\"", + "required": true + } + }, + "doc": "Determine whether an account identifier is registered on the Signal service." + }, + "BooleanMessage": { + "fields": { + "value": { + "type": "boolean" + } + }, + "doc": "A message containing a single boolean, usually as a response" + }, + "WaitForScanRequest": { + "fields": { + "session_id": { + "type": "String" + } + }, + "doc": "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" + }, + "JsonDataMessage": { + "fields": { + "timestamp": { + "type": "long", + "doc": "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.", + "example": "1615576442475" + }, + "attachments": { + "list": true, + "type": "JsonAttachment", + "version": "v1", + "doc": "files attached to the incoming message" + }, + "body": { + "type": "String", + "doc": "the text body of the incoming message.", + "example": "\"hello\"" + }, + "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": "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." + }, + "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": "v1", + "doc": "if the incoming message has a shared contact, the contact's information will be here" + }, + "previews": { + "list": true, + "type": "JsonPreview", + "version": "v1", + "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": "v1", + "doc": "if the inbound message is deleting a previously sent message, indicates which message should be deleted" + }, + "mentions": { + "list": true, + "type": "JsonMention", + "version": "v1", + "doc": "list of mentions in the message" + }, + "payment": { + "type": "Payment", + "version": "v1", + "doc": "details about the MobileCoin payment attached to the message, if present" + }, + "group_call_update": { + "type": "String", + "doc": "the eraId string from a group call message update" + } + } + }, + "JsonSyncMessage": { + "fields": { + "sent": { + "type": "JsonSentTranscriptMessage", + "version": "v1" + }, + "contacts": { + "type": "JsonAttachment", + "version": "v1" + }, + "contactsComplete": { + "type": "boolean" + }, + "groups": { + "type": "JsonAttachment", + "version": "v1" + }, + "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" + } + } + }, + "CallMessage": { + "fields": { + "offer_message": { + "type": "OfferMessage", + "version": "v1" + }, + "answer_message": { + "type": "AnswerMessage", + "version": "v1" + }, + "busy_message": { + "type": "BusyMessage", + "version": "v1" + }, + "hangup_message": { + "type": "HangupMessage", + "version": "v1" + }, + "ice_update_message": { + "list": true, + "type": "IceUpdateMessage", + "version": "v1" + }, + "destination_device_id": { + "type": "Integer" + }, + "multi_ring": { + "type": "boolean" + } + } + }, + "ReceiptMessage": { + "fields": { + "type": { + "type": "String", + "doc": "options: UNKNOWN, DELIVERY, READ, VIEWED" + }, + "timestamps": { + "list": true, + "type": "Long" + }, + "when": { + "type": "long" + } + } + }, + "TypingMessage": { + "fields": { + "action": { + "type": "String" + }, + "timestamp": { + "type": "long" + }, + "group_id": { + "type": "String" + } + } + }, + "IdentityKey": { + "fields": { + "added": { + "type": "long", + "doc": "the first time this identity key was seen" + }, + "safety_number": { + "type": "String", + "example": "\"373453558586758076680580548714989751943247272727416091564451\"" + }, + "qr_code_data": { + "type": "String", + "doc": "base64-encoded QR code data" + }, + "trust_level": { + "type": "String", + "doc": "One of TRUSTED_UNVERIFIED, TRUSTED_VERIFIED or UNTRUSTED" + } + } + }, + "JsonAttachment": { + "fields": { + "contentType": { + "type": "String" + }, + "id": { + "type": "String" + }, + "size": { + "type": "int" + }, + "storedFilename": { + "type": "String", + "doc": "when receiving, the path that file has been downloaded to" + }, + "filename": { + "type": "String", + "doc": "when sending, the path to the local file to upload" + }, + "customFilename": { + "type": "String", + "doc": "the original name of the file" + }, + "caption": { + "type": "String" + }, + "width": { + "type": "int" + }, + "height": { + "type": "int" + }, + "voiceNote": { + "type": "boolean" + }, + "key": { + "type": "String" + }, + "digest": { + "type": "String" + }, + "blurhash": { + "type": "String" + } + }, + "doc": "represents a file attached to a message. When sending, only `filename` is required." + }, + "JsonQuote": { + "fields": { + "id": { + "type": "long", + "doc": "the client timestamp of the message being quoted", + "example": "1615576442475" + }, + "author": { + "type": "JsonAddress", + "version": "v1", + "doc": "the author of the message being quoted" + }, + "text": { + "type": "String", + "doc": "the body of the message being quoted", + "example": "\"hey ? what's up?\"" + }, + "attachments": { + "list": true, + "type": "JsonQuotedAttachment", + "version": "v0", + "doc": "list of files attached to the quoted message" + }, + "mentions": { + "list": true, + "type": "JsonMention", + "version": "v1", + "doc": "list of mentions in the quoted message" + } + }, + "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", + "doc": "The UUID of the account being mentioned", + "example": "\"aeed01f0-a234-478e-8cf7-261c283151e7\"" + }, + "start": { + "type": "int", + "doc": "The number of characters in that the mention starts at. Note that due to a quirk of how signald encodes JSON, if this value is 0 (for example if the first character in the message is the mention) the field won't show up.", + "example": "4" + }, + "length": { + "type": "int", + "doc": "The length of the mention represented in the message. Seems to always be 1 but included here in case that changes.", + "example": "1" + } + } + }, + "JsonPreview": { + "fields": { + "url": { + "type": "String" + }, + "title": { + "type": "String" + }, + "description": { + "type": "String" + }, + "date": { + "type": "long" + }, + "attachment": { + "type": "JsonAttachment", + "version": "v1", + "doc": "an optional image file attached to the preview" + } + }, + "doc": "metadata about one of the links in a message" + }, + "JsonSendMessageResult": { + "fields": { + "address": { + "type": "JsonAddress", + "version": "v1" + }, + "success": { + "type": "SendSuccess", + "version": "v1" + }, + "networkFailure": { + "type": "boolean", + "example": "false" + }, + "unregisteredFailure": { + "type": "boolean", + "example": "false" + }, + "identityFailure": { + "type": "String" + }, + "proof_required_failure": { + "type": "ProofRequiredError", + "version": "v1" + } + } + }, + "JsonReaction": { + "fields": { + "emoji": { + "type": "String", + "doc": "the emoji to react with", + "example": "\"?\"" + }, + "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", + "example": "1615576442475" + } + } + }, + "GroupAccessControl": { + "fields": { + "link": { + "type": "String", + "doc": "UNSATISFIABLE when the group link is disabled, ADMINISTRATOR when the group link is enabled but an administrator must approve new members, ANY when the group link is enabled and no approval is required", + "example": "\"ANY\"" + }, + "attributes": { + "type": "String", + "doc": "who can edit group info" + }, + "members": { + "type": "String", + "doc": "who can add members" + } + }, + "doc": "group access control settings. Options for each controlled action are: UNKNOWN, ANY, MEMBER, ADMINISTRATOR, UNSATISFIABLE and UNRECOGNIZED" + }, + "GroupMember": { + "fields": { + "uuid": { + "type": "String", + "example": "\"aeed01f0-a234-478e-8cf7-261c283151e7\"" + }, + "role": { + "type": "String", + "doc": "possible values are: UNKNOWN, DEFAULT, ADMINISTRATOR and UNRECOGNIZED", + "example": "\"DEFAULT\"" + }, + "joined_revision": { + "type": "int" + } + } + }, + "DeviceInfo": { + "fields": { + "id": { + "type": "long" + }, + "name": { + "type": "String" + }, + "created": { + "type": "long" + }, + "lastSeen": { + "type": "long" + } + } + }, + "JsonGroupInfo": { + "fields": { + "groupId": { + "type": "String" + }, + "members": { + "list": true, + "type": "JsonAddress", + "version": "v1" + }, + "name": { + "type": "String" + }, + "type": { + "type": "String" + }, + "avatarId": { + "type": "long" + } + }, + "doc": "information about a legacy group" + }, + "Capabilities": { + "fields": { + "gv2": { + "type": "boolean" + }, + "storage": { + "type": "boolean" + }, + "gv1-migration": { + "type": "boolean" + }, + "sender_key": { + "type": "boolean" + }, + "announcement_group": { + "type": "boolean" + }, + "change_number": { + "type": "boolean" + } + } + }, + "Server": { + "fields": { + "uuid": { + "type": "UUID", + "doc": "A unique identifier for the server, referenced when adding accounts. Must be a valid UUID. Will be generated if not specified when creating." + }, + "proxy": { + "type": "String" + }, + "ca": { + "type": "String", + "doc": "base64 encoded trust store, password must be 'whisper'" + }, + "service_url": { + "type": "String" + }, + "cdn_urls": { + "list": true, + "type": "ServerCDN", + "version": "v1" + }, + "contact_discovery_url": { + "type": "String" + }, + "key_backup_url": { + "type": "String" + }, + "storage_url": { + "type": "String" + }, + "zk_param": { + "type": "String", + "doc": "base64 encoded ZKGROUP_SERVER_PUBLIC_PARAMS value" + }, + "unidentified_sender_root": { + "type": "String", + "doc": "base64 encoded" + }, + "key_backup_service_name": { + "type": "String" + }, + "key_backup_service_id": { + "type": "String", + "doc": "base64 encoded" + }, + "key_backup_mrenclave": { + "type": "String" + }, + "cds_mrenclave": { + "type": "String" + }, + "ias_ca": { + "type": "String", + "doc": "base64 encoded trust store, password must be 'whisper'" + } + }, + "doc": "a Signal server" + }, + "Payment": { + "fields": { + "receipt": { + "type": "String", + "doc": "base64 encoded payment receipt data. This is a protobuf value which can be decoded as the Receipt object described in https://github.com/mobilecoinfoundation/mobilecoin/blob/master/api/proto/external.proto" + }, + "note": { + "type": "String", + "doc": "note attached to the payment" + } + }, + "doc": "details about a MobileCoin payment" + }, + "RemoteConfig": { + "fields": { + "name": { + "type": "String", + "doc": "The name of this remote config entry. These names may be prefixed with the platform type (\"android.\", \"ios.\", \"desktop.\", etc.) Typically, clients only handle the relevant configs for its platform, hardcoding the names it cares about handling and ignoring the rest.", + "example": "desktop.mediaQuality.levels" + }, + "value": { + "type": "String", + "doc": "The value for this remote config entry. Even though this is a string, it could be a boolean as a string, an integer/long value, a comma-delimited list, etc. Clients usually consume this by hardcoding the feature flagsit should track in the app and assuming that the server will send the type that the client expects. If an unexpected type occurs, it falls back to a default value.", + "example": "1:2,61:2,81:2,82:2,65:2,31:2,47:2,41:2,32:2,385:2,971:2,974:2,49:2,33:2,*:1" + } + }, + "doc": "A remote config (feature flag) entry." + }, + "SharedContact": { + "fields": { + "name": { + "type": "SharedContactName", + "version": "v1", + "doc": "the name of the shared contact" + }, + "email": { + "list": true, + "type": "SharedContactEmail", + "version": "v1", + "doc": "the email addresses of the shared contact" + }, + "phone": { + "list": true, + "type": "SharedContactPhone", + "version": "v1", + "doc": "the phone numbers of the shared contact" + }, + "address": { + "list": true, + "type": "SharedContactAddress", + "version": "v1", + "doc": "the physical addresses of the shared contact" + }, + "avatar": { + "type": "SharedContactAvatar", + "version": "v1", + "doc": "the profile picture/avatar of the shared contact" + }, + "organization": { + "type": "String", + "doc": "the organization (e.g. workplace) of the shared contact" + } + } + }, + "RemoteDelete": { + "fields": { + "target_sent_timestamp": { + "type": "long" + } + } + }, + "JsonSentTranscriptMessage": { + "fields": { + "destination": { + "type": "JsonAddress", + "version": "v1" + }, + "timestamp": { + "type": "long", + "example": "1615576442475" + }, + "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", + "example": "1615576442475" + } + } + }, + "JsonViewOnceOpenMessage": { + "fields": { + "sender": { + "type": "JsonAddress", + "version": "v1" + }, + "timestamp": { + "type": "long", + "example": "1615576442475" + } + } + }, + "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" + } + } + }, + "OfferMessage": { + "fields": { + "id": { + "type": "long" + }, + "sdp": { + "type": "String" + }, + "type": { + "type": "String" + }, + "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": "String" + }, + "legacy": { + "type": "boolean" + }, + "device_id": { + "type": "int" + } + } + }, + "IceUpdateMessage": { + "fields": { + "id": { + "type": "long" + }, + "opaque": { + "type": "String" + }, + "sdp": { + "type": "String" + } + } + }, + "SendSuccess": { + "fields": { + "unidentified": { + "type": "boolean" + }, + "needsSync": { + "type": "boolean" + }, + "duration": { + "type": "long" + }, + "devices": { + "list": true, + "type": "Integer" + } + } + }, + "ProofRequiredError": { + "fields": { + "token": { + "type": "String" + }, + "options": { + "list": true, + "type": "String", + "doc": "possible list values are RECAPTCHA and PUSH_CHALLENGE" + }, + "message": { + "type": "String" + }, + "retry_after": { + "type": "long", + "doc": "value in seconds" + } + }, + "error": true + }, + "ServerCDN": { + "fields": { + "number": { + "type": "int" + }, + "url": { + "type": "String" + } + } + }, + "SharedContactName": { + "fields": { + "display": { + "type": "String", + "doc": "the full name that should be displayed" + }, + "given": { + "type": "String", + "doc": "given name" + }, + "middle": { + "type": "String", + "doc": "middle name" + }, + "family": { + "type": "String", + "doc": "family name (surname)" + }, + "prefix": { + "type": "String" + }, + "suffix": { + "type": "String" + } + } + }, + "SharedContactEmail": { + "fields": { + "type": { + "type": "String", + "doc": "the type of email (options: HOME, WORK, MOBILE, CUSTOM)" + }, + "value": { + "type": "String", + "doc": "the email address" + }, + "label": { + "type": "String", + "doc": "the type label when type is CUSTOM" + } + } + }, + "SharedContactPhone": { + "fields": { + "type": { + "type": "String", + "doc": "the type of phone (options: HOME, WORK, MOBILE, CUSTOM)" + }, + "value": { + "type": "String", + "doc": "the phone number" + }, + "label": { + "type": "String", + "doc": "the type label when type is CUSTOM" + } + } + }, + "SharedContactAddress": { + "fields": { + "type": { + "type": "String", + "doc": "the type of address (options: HOME, WORK, CUSTOM)" + }, + "label": { + "type": "String" + }, + "street": { + "type": "String" + }, + "pobox": { + "type": "String" + }, + "neighborhood": { + "type": "String" + }, + "city": { + "type": "String" + }, + "region": { + "type": "String" + }, + "postcode": { + "type": "String" + }, + "country": { + "type": "String" + } + } + }, + "SharedContactAvatar": { + "fields": { + "attachment": { + "type": "JsonAttachment", + "version": "v1" + }, + "is_profile": { + "type": "boolean" + } + } + } + } + }, + "actions": { + "v1": { + "send": { + "request": "SendRequest", + "response": "SendResponse", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "NoSendPermissionError" + }, + { + "name": "InvalidAttachmentError" + }, + { + "name": "InternalError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "RateLimitError" + }, + { + "name": "InvalidRecipientError" + }, + { + "name": "AttachmentTooLargeError" + } + ] + }, + "react": { + "request": "ReactRequest", + "response": "SendResponse", + "doc": "react to a previous message", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "NoSendPermissionError" + }, + { + "name": "InternalError" + }, + { + "name": "InvalidRecipientError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "RateLimitError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "version": { + "request": "VersionRequest", + "response": "JsonVersionMessage" + }, + "accept_invitation": { + "request": "AcceptInvitationRequest", + "response": "JsonGroupV2Info", + "doc": "Accept a v2 group invitation. Note that you must have a profile name set to join groups.", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "OwnProfileKeyDoesNotExistError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "InternalError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "AuthorizationFailedError" + } + ] + }, + "approve_membership": { + "request": "ApproveMembershipRequest", + "response": "JsonGroupV2Info", + "doc": "approve a request to join a group", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "InternalError" + }, + { + "name": "GroupVerificationError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "AuthorizationFailedError" + } + ] + }, + "get_group": { + "request": "GetGroupRequest", + "response": "JsonGroupV2Info", + "doc": "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.", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "InternalError" + }, + { + "name": "GroupVerificationError" + }, + { + "name": "InvalidGroupStateError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "AuthorizationFailedError" + } + ] + }, + "get_linked_devices": { + "request": "GetLinkedDevicesRequest", + "response": "LinkedDevices", + "doc": "list all linked devices on a Signal account", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "InvalidRequestError" + } + ] + }, + "join_group": { + "request": "JoinGroupRequest", + "response": "JsonGroupJoinInfo", + "doc": "Join a group using the a signal.group URL. Note that you must have a profile name set to join groups.", + "errors": [ + { + "name": "InvalidRequestError" + }, + { + "name": "InvalidInviteURIError" + }, + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "OwnProfileKeyDoesNotExistError" + }, + { + "name": "GroupVerificationError" + }, + { + "name": "GroupNotActiveError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "InvalidGroupStateError" + } + ] + }, + "remove_linked_device": { + "request": "RemoveLinkedDeviceRequest", + "doc": "Remove a linked device from the Signal account. Only allowed when the local device id is 1", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "AuthorizationFailedError" + } + ] + }, + "update_group": { + "request": "UpdateGroupRequest", + "response": "GroupInfo", + "doc": "modify a group. Note that only one modification action may be performed at once", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "GroupVerificationError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "AuthorizationFailedError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "set_profile": { + "request": "SetProfile", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "InvalidBase64Error" + }, + { + "name": "InvalidRequestError" + } + ] + }, + "resolve_address": { + "request": "ResolveAddressRequest", + "response": "JsonAddress", + "doc": "Resolve a partial JsonAddress with only a number or UUID to one with both. Anywhere that signald accepts a JsonAddress will except a partial, this is a convenience function for client authors, mostly because signald doesn't resolve all the partials it returns.", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "mark_read": { + "request": "MarkReadRequest", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "InternalError" + }, + { + "name": "UntrustedIdentityError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "get_profile": { + "request": "GetProfileRequest", + "response": "Profile", + "doc": "Get all information available about a user", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "ProfileUnavailableError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "list_groups": { + "request": "ListGroupsRequest", + "response": "GroupList", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "InvalidRequestError" + } + ] + }, + "list_contacts": { + "request": "ListContactsRequest", + "response": "ProfileList", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + } + ] + }, + "create_group": { + "request": "CreateGroupRequest", + "response": "JsonGroupV2Info", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "OwnProfileKeyDoesNotExistError" + }, + { + "name": "NoKnownUUIDError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "GroupVerificationError" + }, + { + "name": "InvalidGroupStateError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "leave_group": { + "request": "LeaveGroupRequest", + "response": "GroupInfo", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "InternalError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "GroupVerificationError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "AuthorizationFailedError" + } + ] + }, + "generate_linking_uri": { + "request": "GenerateLinkingURIRequest", + "response": "LinkingURI", + "doc": "Generate a linking URI. Typically this is QR encoded and scanned by the primary device. Submit the returned session_id with a finish_link request.", + "errors": [ + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + } + ] + }, + "finish_link": { + "request": "FinishLinkRequest", + "response": "Account", + "doc": "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.", + "errors": [ + { + "name": "NoSuchSessionError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "InternalError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "UserAlreadyExistsError" + }, + { + "name": "ScanTimeoutError" + } + ] + }, + "add_device": { + "request": "AddLinkedDeviceRequest", + "doc": "Link a new device to a local Signal account", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "InvalidRequestError", + "doc": "caused by syntax errors with the provided linking URI" + }, + { + "name": "InternalError" + } + ] + }, + "register": { + "request": "RegisterRequest", + "response": "Account", + "doc": "begin the account registration process by requesting a phone number verification code. when the code is received, submit it with a verify request", + "errors": [ + { + "name": "CaptchaRequiredError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + } + ] + }, + "verify": { + "request": "VerifyRequest", + "response": "Account", + "doc": "verify an account's phone number with a code after registering, completing the account creation process", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "AccountHasNoKeysError" + }, + { + "name": "AccountAlreadyVerifiedError" + }, + { + "name": "AccountLockedError" + }, + { + "name": "NoSuchAccountError" + } + ] + }, + "get_identities": { + "request": "GetIdentitiesRequest", + "response": "IdentityKeyList", + "doc": "Get information about a known keys for a particular address", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "trust": { + "request": "TrustRequest", + "doc": "Trust another user's safety number using either the QR code data or the safety number text", + "errors": [ + { + "name": "InvalidRequestError" + }, + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "FingerprintVersionMismatchError" + }, + { + "name": "InvalidBase64Error" + }, + { + "name": "UnknownIdentityKeyError" + }, + { + "name": "InvalidFingerprintError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "delete_account": { + "request": "DeleteAccountRequest", + "doc": "delete all account data signald has on disk, and optionally delete the account from the server as well. Note that this is not \"unlink\" and will delete the entire account, even from a linked device.", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + } + ] + }, + "typing": { + "request": "TypingRequest", + "doc": "send a typing started or stopped message", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "InvalidRecipientError" + }, + { + "name": "InvalidGroupError" + }, + { + "name": "UntrustedIdentityError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "reset_session": { + "request": "ResetSessionRequest", + "response": "SendResponse", + "doc": "reset a session with a particular user", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "NoSendPermissionError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "RateLimitError" + }, + { + "name": "InvalidRecipientError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "request_sync": { + "request": "RequestSyncRequest", + "doc": "Request other devices on the account send us their group list, syncable config and contact list.", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "UntrustedIdentityError" + }, + { + "name": "InvalidRequestError" + } + ] + }, + "list_accounts": { + "request": "ListAccountsRequest", + "response": "AccountList", + "doc": "return all local accounts", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "InternalError" + } + ] + }, + "group_link_info": { + "request": "GroupLinkInfoRequest", + "response": "JsonGroupJoinInfo", + "doc": "Get information about a group from a signal.group link", + "errors": [ + { + "name": "GroupLinkNotActiveError" + }, + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "GroupVerificationError" + } + ] + }, + "update_contact": { + "request": "UpdateContactRequest", + "response": "Profile", + "doc": "update information about a local contact", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "InternalError" + } + ] + }, + "set_expiration": { + "request": "SetExpirationRequest", + "response": "SendResponse", + "doc": "Set the message expiration timer for a thread. Expiration must be specified in seconds, set to 0 to disable timer", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "GroupVerificationError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "AuthorizationFailedError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "set_device_name": { + "request": "SetDeviceNameRequest", + "doc": "set this device's name. This will show up on the mobile device on the same account under settings -> linked devices", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + } + ] + }, + "get_all_identities": { + "request": "GetAllIdentities", + "response": "AllIdentityKeyList", + "doc": "get all known identity keys", + "errors": [ + { + "name": "InvalidProxyError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InternalError" + } + ] + }, + "subscribe": { + "request": "SubscribeRequest", + "doc": "receive incoming messages. After making a subscribe request, incoming messages will be sent to the client encoded as ClientMessageWrapper. Send an unsubscribe request or disconnect from the socket to stop receiving messages.", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "InternalError" + }, + { + "name": "AuthorizationFailedError" + } + ] + }, + "unsubscribe": { + "request": "UnsubscribeRequest", + "doc": "See subscribe for more info", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "InternalError" + } + ] + }, + "remote_delete": { + "request": "RemoteDeleteRequest", + "response": "SendResponse", + "doc": "delete a message previously sent", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "InvalidRecipientError" + }, + { + "name": "NoSendPermissionError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "RateLimitError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "add_server": { + "request": "AddServerRequest", + "response": "String", + "doc": "add a new server to connect to. Returns the new server's UUID.", + "errors": [ + { + "name": "InvalidProxyError" + }, + { + "name": "InternalError" + } + ] + }, + "get_servers": { + "request": "GetServersRequest", + "response": "ServerList", + "errors": [ + { + "name": "InternalError" + } + ] + }, + "delete_server": { + "request": "RemoveServerRequest", + "errors": [ + { + "name": "InternalError" + } + ] + }, + "send_payment": { + "request": "SendPaymentRequest", + "response": "SendResponse", + "doc": "send a mobilecoin payment", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + }, + { + "name": "InvalidBase64Error" + }, + { + "name": "InvalidRecipientError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "NoSendPermissionError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "RateLimitError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "get_remote_config": { + "request": "RemoteConfigRequest", + "response": "RemoteConfigList", + "doc": "Retrieves the remote config (feature flags) from the server.", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + } + ] + }, + "refuse_membership": { + "request": "RefuseMembershipRequest", + "response": "JsonGroupV2Info", + "doc": "deny a request to join a group", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "UnknownGroupError" + }, + { + "name": "GroupVerificationError" + }, + { + "name": "InternalError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "AuthorizationFailedError" + }, + { + "name": "UnregisteredUserError" + } + ] + }, + "submit_challenge": { + "request": "SubmitChallengeRequest", + "errors": [ + { + "name": "NoSuchAccountError" + }, + { + "name": "InvalidRequestError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "InternalError" + } + ] + }, + "is_identifier_registered": { + "request": "IsIdentifierRegisteredRequest", + "response": "BooleanMessage", + "doc": "Determine whether an account identifier is registered on the Signal service.", + "errors": [ + { + "name": "InternalError" + }, + { + "name": "InvalidProxyError" + }, + { + "name": "ServerNotFoundError" + }, + { + "name": "NoSuchAccountError" + } + ] + }, + "wait_for_scan": { + "request": "WaitForScanRequest", + "doc": "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", + "errors": [ + { + "name": "NoSuchSessionError" + }, + { + "name": "ScanTimeoutError" + }, + { + "name": "InternalError" + } + ] + } + } + } +} diff --git a/signald/client-protocol/protocol.go b/signald/client-protocol/protocol.go index c0cb562..1403b18 100644 --- a/signald/client-protocol/protocol.go +++ b/signald/client-protocol/protocol.go @@ -5,10 +5,10 @@ import ( ) type BasicResponse struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - ErrorType string `json:"error_type,omitempty"` - Error json.RawMessage `json:"error,omitempty"` - Data json.RawMessage `json:"data,omitempty"` - Account string `json:"account,omitempty"` + ID string + Type string + ErrorType string + Error json.RawMessage + Data json.RawMessage + Account string } diff --git a/signald/client-protocol/v0/structs.go b/signald/client-protocol/v0/structs.go index 1afd428..92de9ec 100644 --- a/signald/client-protocol/v0/structs.go +++ b/signald/client-protocol/v0/structs.go @@ -291,7 +291,6 @@ type OfferMessage struct { } type Optional struct { - Empty bool `json:"empty,omitempty" yaml:"empty,omitempty"` Present bool `json:"present,omitempty" yaml:"present,omitempty"` } diff --git a/signald/client-protocol/v1/errors.go b/signald/client-protocol/v1/errors.go index 0ddb670..0b3662c 100644 --- a/signald/client-protocol/v1/errors.go +++ b/signald/client-protocol/v1/errors.go @@ -81,13 +81,6 @@ func mkerr(response client_protocol.BasicResponse) error { return err } return result - case "GroupPatchNotAcceptedError": - result := GroupPatchNotAcceptedError{} - err := json.Unmarshal(response.Error, &result) - if err != nil { - return err - } - return result case "GroupVerificationError": result := GroupVerificationError{} err := json.Unmarshal(response.Error, &result) @@ -214,13 +207,6 @@ func mkerr(response client_protocol.BasicResponse) error { return err } return result - case "ProtocolInvalidKeyIdError": - result := ProtocolInvalidKeyIdError{} - err := json.Unmarshal(response.Error, &result) - if err != nil { - return err - } - return result case "ProtocolInvalidMessageError": result := ProtocolInvalidMessageError{} err := json.Unmarshal(response.Error, &result) @@ -228,13 +214,6 @@ func mkerr(response client_protocol.BasicResponse) error { return err } return result - case "ProtocolNoSessionError": - result := ProtocolNoSessionError{} - err := json.Unmarshal(response.Error, &result) - if err != nil { - return err - } - return result case "RateLimitError": result := RateLimitError{} err := json.Unmarshal(response.Error, &result) @@ -242,13 +221,6 @@ func mkerr(response client_protocol.BasicResponse) error { return err } return result - case "SQLError": - result := SQLError{} - err := json.Unmarshal(response.Error, &result) - if err != nil { - return err - } - return result case "ScanTimeoutError": result := ScanTimeoutError{} err := json.Unmarshal(response.Error, &result) @@ -284,13 +256,6 @@ func mkerr(response client_protocol.BasicResponse) error { return err } return result - case "UnsupportedGroupError": - result := UnsupportedGroupError{} - err := json.Unmarshal(response.Error, &result) - if err != nil { - return err - } - return result case "UntrustedIdentityError": result := UntrustedIdentityError{} err := json.Unmarshal(response.Error, &result) @@ -344,7 +309,7 @@ func (e AttachmentTooLargeError) Error() string { return e.Message } -// AuthorizationFailedError: Indicates the server rejected our credentials or a failed group update. Typically means the linked device was removed by the primary device, or that the account was re-registered. For group updates, this can indicate that we lack permissions. +// 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"` } @@ -395,15 +360,6 @@ func (e GroupNotActiveError) Error() string { return e.Message } -// GroupPatchNotAcceptedError: Indicates the server rejected our group update. This can be due to errors such as trying to add a user that's already in the group. -type GroupPatchNotAcceptedError struct { - Message string `json:"message,omitempty" yaml:"message,omitempty"` -} - -func (e GroupPatchNotAcceptedError) Error() string { - return e.Message -} - type GroupVerificationError struct { Message string `json:"message,omitempty" yaml:"message,omitempty"` } @@ -555,19 +511,6 @@ func (e ProofRequiredError) Error() string { return e.Message } -type ProtocolInvalidKeyIdError struct { - ContentHint int32 `json:"content_hint,omitempty" yaml:"content_hint,omitempty"` - GroupId string `json:"group_id,omitempty" yaml:"group_id,omitempty"` - Message string `json:"message,omitempty" yaml:"message,omitempty"` - Sender string `json:"sender,omitempty" yaml:"sender,omitempty"` - SenderDevice int32 `json:"sender_device,omitempty" yaml:"sender_device,omitempty"` - Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` -} - -func (e ProtocolInvalidKeyIdError) Error() string { - return e.Message -} - type ProtocolInvalidMessageError struct { ContentHint int32 `json:"content_hint,omitempty" yaml:"content_hint,omitempty"` GroupId string `json:"group_id,omitempty" yaml:"group_id,omitempty"` @@ -581,19 +524,6 @@ func (e ProtocolInvalidMessageError) Error() string { return e.Message } -type ProtocolNoSessionError struct { - ContentHint int32 `json:"content_hint,omitempty" yaml:"content_hint,omitempty"` - GroupId string `json:"group_id,omitempty" yaml:"group_id,omitempty"` - Message string `json:"message,omitempty" yaml:"message,omitempty"` - Sender string `json:"sender,omitempty" yaml:"sender,omitempty"` - SenderDevice int32 `json:"sender_device,omitempty" yaml:"sender_device,omitempty"` - Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` -} - -func (e ProtocolNoSessionError) Error() string { - return e.Message -} - type RateLimitError struct { Message string `json:"message,omitempty" yaml:"message,omitempty"` } @@ -602,14 +532,6 @@ func (e RateLimitError) Error() string { return e.Message } -type SQLError struct { - Message string `json:"message,omitempty" yaml:"message,omitempty"` -} - -func (e SQLError) Error() string { - return e.Message -} - type ScanTimeoutError struct { Message string `json:"message,omitempty" yaml:"message,omitempty"` } @@ -652,15 +574,6 @@ func (e UnregisteredUserError) Error() string { return e.Message } -// UnsupportedGroupError: returned in response to use v1 groups, which are no longer supported -type UnsupportedGroupError struct { - Message string `json:"message,omitempty" yaml:"message,omitempty"` -} - -func (e UnsupportedGroupError) Error() string { - return e.Message -} - type UntrustedIdentityError struct { Identifier string `json:"identifier,omitempty" yaml:"identifier,omitempty"` IdentityKey **IdentityKey `json:"identity_key,omitempty" yaml:"identity_key,omitempty"` diff --git a/signald/client-protocol/v1/requests.go b/signald/client-protocol/v1/requests.go index ac5d93b..a59691b 100644 --- a/signald/client-protocol/v1/requests.go +++ b/signald/client-protocol/v1/requests.go @@ -16,14 +16,15 @@ func (r *AcceptInvitationRequest) Submit(conn *signald.Signald) (response JsonGr if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -48,14 +49,15 @@ func (r *AddLinkedDeviceRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -73,14 +75,15 @@ func (r *AddServerRequest) Submit(conn *signald.Signald) (response string, err e if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -105,45 +108,14 @@ func (r *ApproveMembershipRequest) Submit(conn *signald.Signald) (response JsonG if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) err = conn.RawRequest(r) if err != nil { log.Println("signald-go: error submitting request to signald") return } - 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: Bans users from a group. This works even if the users aren't in the group. If they are currently in the group, they will also be removed. -func (r *BanUserRequest) Submit(conn *signald.Signald) (response JsonGroupV2Info, err error) { - r.Version = "v1" - r.Type = "ban_user" - if r.ID == "" { - r.ID = signald.GenerateID() - } responseChannel := conn.GetResponseListener(r.ID) defer conn.CloseResponseListener(r.ID) - err = conn.RawRequest(r) - if err != nil { - log.Println("signald-go: error submitting request to signald") - return - } rawResponse := <-responseChannel if rawResponse.Error != nil { @@ -168,14 +140,15 @@ func (r *CreateGroupRequest) Submit(conn *signald.Signald) (response JsonGroupV2 if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -200,14 +173,15 @@ func (r *DeleteAccountRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -224,14 +198,15 @@ func (r *RemoveServerRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -249,14 +224,15 @@ func (r *FinishLinkRequest) Submit(conn *signald.Signald) (response Account, err if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -281,14 +257,15 @@ func (r *GenerateLinkingURIRequest) Submit(conn *signald.Signald) (response Link if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -313,14 +290,15 @@ func (r *GetAllIdentities) Submit(conn *signald.Signald) (response AllIdentityKe if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -345,45 +323,14 @@ func (r *GetGroupRequest) Submit(conn *signald.Signald) (response JsonGroupV2Inf if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) err = conn.RawRequest(r) if err != nil { log.Println("signald-go: error submitting request to signald") return } - 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: Query the server for group revision history. The history contains information about the changes between each revision and the user that made the change. -func (r *GetGroupRevisionPagesRequest) Submit(conn *signald.Signald) (response GroupHistoryPage, err error) { - r.Version = "v1" - r.Type = "get_group_revision_pages" - if r.ID == "" { - r.ID = signald.GenerateID() - } responseChannel := conn.GetResponseListener(r.ID) defer conn.CloseResponseListener(r.ID) - err = conn.RawRequest(r) - if err != nil { - log.Println("signald-go: error submitting request to signald") - return - } rawResponse := <-responseChannel if rawResponse.Error != nil { @@ -409,14 +356,15 @@ func (r *GetIdentitiesRequest) Submit(conn *signald.Signald) (response IdentityK if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -441,14 +389,15 @@ func (r *GetLinkedDevicesRequest) Submit(conn *signald.Signald) (response Linked if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -473,14 +422,15 @@ func (r *GetProfileRequest) Submit(conn *signald.Signald) (response Profile, err if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -505,14 +455,15 @@ func (r *RemoteConfigRequest) Submit(conn *signald.Signald) (response RemoteConf if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -536,14 +487,15 @@ func (r *GetServersRequest) Submit(conn *signald.Signald) (response ServerList, if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -568,14 +520,15 @@ func (r *GroupLinkInfoRequest) Submit(conn *signald.Signald) (response JsonGroup if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -600,14 +553,15 @@ func (r *IsIdentifierRegisteredRequest) Submit(conn *signald.Signald) (response if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -632,14 +586,15 @@ func (r *JoinGroupRequest) Submit(conn *signald.Signald) (response JsonGroupJoin if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -663,14 +618,15 @@ func (r *LeaveGroupRequest) Submit(conn *signald.Signald) (response GroupInfo, e if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -695,14 +651,15 @@ func (r *ListAccountsRequest) Submit(conn *signald.Signald) (response AccountLis if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -726,14 +683,15 @@ func (r *ListContactsRequest) Submit(conn *signald.Signald) (response ProfileLis if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -757,14 +715,15 @@ func (r *ListGroupsRequest) Submit(conn *signald.Signald) (response GroupList, e if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -788,14 +747,15 @@ func (r *MarkReadRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -813,14 +773,15 @@ func (r *ReactRequest) Submit(conn *signald.Signald) (response SendResponse, err if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -845,14 +806,15 @@ func (r *RefuseMembershipRequest) Submit(conn *signald.Signald) (response JsonGr if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -877,14 +839,15 @@ func (r *RegisterRequest) Submit(conn *signald.Signald) (response Account, err e if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -909,14 +872,15 @@ func (r *RemoteDeleteRequest) Submit(conn *signald.Signald) (response SendRespon if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -941,14 +905,15 @@ func (r *RemoveLinkedDeviceRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -966,14 +931,15 @@ func (r *RequestSyncRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -991,14 +957,15 @@ func (r *ResetSessionRequest) Submit(conn *signald.Signald) (response SendRespon if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1023,14 +990,15 @@ func (r *ResolveAddressRequest) Submit(conn *signald.Signald) (response JsonAddr if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1054,14 +1022,15 @@ func (r *SendRequest) Submit(conn *signald.Signald) (response SendResponse, err if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1086,45 +1055,14 @@ func (r *SendPaymentRequest) Submit(conn *signald.Signald) (response SendRespons if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) err = conn.RawRequest(r) if err != nil { log.Println("signald-go: error submitting request to signald") return } - 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: Sends a sync message to the account's devices -func (r *SendSyncMessageRequest) Submit(conn *signald.Signald) (response JsonSendMessageResult, err error) { - r.Version = "v1" - r.Type = "send_sync_message" - if r.ID == "" { - r.ID = signald.GenerateID() - } responseChannel := conn.GetResponseListener(r.ID) defer conn.CloseResponseListener(r.ID) - err = conn.RawRequest(r) - if err != nil { - log.Println("signald-go: error submitting request to signald") - return - } rawResponse := <-responseChannel if rawResponse.Error != nil { @@ -1150,14 +1088,15 @@ func (r *SetDeviceNameRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1175,14 +1114,15 @@ func (r *SetExpirationRequest) Submit(conn *signald.Signald) (response SendRespo if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1206,14 +1146,15 @@ func (r *SetProfile) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1230,14 +1171,15 @@ func (r *SubmitChallengeRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1255,14 +1197,15 @@ func (r *SubscribeRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1280,14 +1223,15 @@ func (r *TrustRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1305,14 +1249,15 @@ func (r *TypingRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1323,38 +1268,6 @@ func (r *TypingRequest) Submit(conn *signald.Signald) (err error) { } -// Submit: Unbans users from a group. -func (r *UnbanUserRequest) Submit(conn *signald.Signald) (response JsonGroupV2Info, err error) { - r.Version = "v1" - r.Type = "unban_user" - if r.ID == "" { - r.ID = signald.GenerateID() - } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) - err = conn.RawRequest(r) - if err != nil { - log.Println("signald-go: error submitting request to signald") - return - } - - 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: See subscribe for more info func (r *UnsubscribeRequest) Submit(conn *signald.Signald) (err error) { r.Version = "v1" @@ -1362,14 +1275,15 @@ func (r *UnsubscribeRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1387,14 +1301,15 @@ func (r *UpdateContactRequest) Submit(conn *signald.Signald) (response Profile, if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1419,14 +1334,15 @@ func (r *UpdateGroupRequest) Submit(conn *signald.Signald) (response GroupInfo, if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1451,14 +1367,15 @@ func (r *VerifyRequest) Submit(conn *signald.Signald) (response Account, err err if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1482,14 +1399,15 @@ func (r *VersionRequest) Submit(conn *signald.Signald) (response JsonVersionMess if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) @@ -1514,14 +1432,15 @@ func (r *WaitForScanRequest) Submit(conn *signald.Signald) (err error) { if r.ID == "" { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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) diff --git a/signald/client-protocol/v1/structs.go b/signald/client-protocol/v1/structs.go index 8cfcd97..e589b8e 100644 --- a/signald/client-protocol/v1/structs.go +++ b/signald/client-protocol/v1/structs.go @@ -25,7 +25,6 @@ type Account struct { Address *JsonAddress `json:"address,omitempty" yaml:"address,omitempty"` // The address of this account DeviceId int32 `json:"device_id,omitempty" yaml:"device_id,omitempty"` // The Signal device ID. Official Signal mobile clients (iPhone and Android) have device ID = 1, while linked devices such as Signal Desktop or Signal iPad have higher device IDs. Pending bool `json:"pending,omitempty" yaml:"pending,omitempty"` // indicates the account has not completed registration - Pni string `json:"pni,omitempty" yaml:"pni,omitempty"` } type AccountList struct { @@ -63,19 +62,6 @@ type ApproveMembershipRequest struct { Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` // list of requesting members to approve } -// BanUserRequest: Bans users from a group. This works even if the users aren't in the group. If they are currently in the group, they will also be removed. -type BanUserRequest struct { - Request - Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with - GroupId string `json:"group_id,omitempty" yaml:"group_id,omitempty"` - Users []*JsonAddress `json:"users,omitempty" yaml:"users,omitempty"` // List of users to ban -} - -type BannedGroupMember struct { - Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` // Timestamp as milliseconds since Unix epoch of when the user was banned. This field is set by the server. - UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` -} - // BooleanMessage: A message containing a single boolean, usually as a response type BooleanMessage struct { Value bool `json:"value,omitempty" yaml:"value,omitempty"` @@ -99,10 +85,9 @@ type Capabilities struct { AnnouncementGroup bool `json:"announcement_group,omitempty" yaml:"announcement_group,omitempty"` ChangeNumber bool `json:"change_number,omitempty" yaml:"change_number,omitempty"` Gv1Migration bool `json:"gv1-migration,omitempty" yaml:"gv1-migration,omitempty"` - Gv2 bool `json:"gv2,omitempty" yaml:"gv2,omitempty"` // this capability is deprecated and will always be true + 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"` - Stories bool `json:"stories,omitempty" yaml:"stories,omitempty"` } // ClientMessageWrapper: Wraps all incoming messages sent to the client after a v1 subscribe request is issued @@ -142,7 +127,6 @@ type DeviceInfo struct { type FinishLinkRequest struct { Request DeviceName string `json:"device_name,omitempty" yaml:"device_name,omitempty"` - Overwrite bool `json:"overwrite,omitempty" yaml:"overwrite,omitempty"` // overwrite existing account data if the phone number conflicts. false by default SessionId string `json:"session_id,omitempty" yaml:"session_id,omitempty"` } @@ -166,15 +150,6 @@ type GetGroupRequest struct { Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` // the latest known revision, default value (-1) forces fetch from server } -// GetGroupRevisionPagesRequest: Query the server for group revision history. The history contains information about the changes between each revision and the user that made the change. -type GetGroupRevisionPagesRequest struct { - Request - Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with - FromRevision int32 `json:"from_revision,omitempty" yaml:"from_revision,omitempty"` // The revision to start the pages from. Note that if this is lower than the revision you joined the group, an AuthorizationFailedError is returned. - GroupId string `json:"group_id,omitempty" yaml:"group_id,omitempty"` - IncludeFirstRevision bool `json:"include_first_revision,omitempty" yaml:"include_first_revision,omitempty"` // Whether to include the first state in the returned pages (default false) -} - // GetIdentitiesRequest: Get information about a known keys for a particular address type GetIdentitiesRequest struct { Request @@ -200,11 +175,6 @@ type GetServersRequest struct { Request } -type Gradient struct { - EndColor string `json:"end_color,omitempty" yaml:"end_color,omitempty"` - StartColor string `json:"start_color,omitempty" yaml:"start_color,omitempty"` -} - // GroupAccessControl: group access control settings. Options for each controlled action are: UNKNOWN, ANY, MEMBER, ADMINISTRATOR, UNSATISFIABLE and UNRECOGNIZED type GroupAccessControl struct { Attributes string `json:"attributes,omitempty" yaml:"attributes,omitempty"` // who can edit group info @@ -212,42 +182,6 @@ type GroupAccessControl struct { Members string `json:"members,omitempty" yaml:"members,omitempty"` // who can add members } -// GroupChange: Represents a group change made by a user. This can also represent request link invites. Only the fields relevant to the group change performed will be set. Note that in signald, group changes are currently only received from incoming messages from a message subscription. -type GroupChange struct { - DeleteMembers []*JsonAddress `json:"delete_members,omitempty" yaml:"delete_members,omitempty"` // Represents users that have been removed from the group. This can be from admins removing users, or users choosing to leave the group - DeletePendingMembers []*JsonAddress `json:"delete_pending_members,omitempty" yaml:"delete_pending_members,omitempty"` - DeleteRequestingMembers []*JsonAddress `json:"delete_requesting_members,omitempty" yaml:"delete_requesting_members,omitempty"` - Editor *JsonAddress `json:"editor,omitempty" yaml:"editor,omitempty"` // The user that made the change. - ModifiedProfileKeys []*GroupMember `json:"modified_profile_keys,omitempty" yaml:"modified_profile_keys,omitempty"` // Represents users that have rotated their profile key. Note that signald currently does not expose profile keys to clients. The joined revision property will always be 0 in this list. - ModifyMemberRoles []*GroupMember `json:"modify_member_roles,omitempty" yaml:"modify_member_roles,omitempty"` // Represents users with their new, modified role. - NewAccessControl *GroupAccessControl `json:"new_access_control,omitempty" yaml:"new_access_control,omitempty"` // If not null, then this group change modified one of the access controls. Some of the properties in here will be null. - NewAvatar bool `json:"new_avatar,omitempty" yaml:"new_avatar,omitempty"` // Whether this group change changed the avatar. - NewBannedMembers []*BannedGroupMember `json:"new_banned_members,omitempty" yaml:"new_banned_members,omitempty"` - NewDescription string `json:"new_description,omitempty" yaml:"new_description,omitempty"` - NewInviteLinkPassword bool `json:"new_invite_link_password,omitempty" yaml:"new_invite_link_password,omitempty"` // Whether this group change involved resetting the group invite link. - NewIsAnnouncementGroup string `json:"new_is_announcement_group,omitempty" yaml:"new_is_announcement_group,omitempty"` // Whether this change affected the announcement group setting. Possible values are UNKNOWN, ENABLED or DISABLED - NewMembers []*GroupMember `json:"new_members,omitempty" yaml:"new_members,omitempty"` // Represents users have been added to the group. This can be from group members adding users, or a users joining via a group link that required no approval. - NewPendingMembers []*GroupPendingMember `json:"new_pending_members,omitempty" yaml:"new_pending_members,omitempty"` // Represents a user that has been invited to the group by another user. - NewRequestingMembers []*GroupRequestingMember `json:"new_requesting_members,omitempty" yaml:"new_requesting_members,omitempty"` // Represents users that have requested to join the group via the group link. Note that members requesting to join might not necessarily have the list of users in the group, so they won't be able to send a peer-to-peer group update message to inform users of their request to join. Other users in the group may inform us that the revision has increased, but the members requesting access will have to be obtained from the server instead (which signald will handle). For now, a get_group request has to be made to get the users that have requested to join the group. - NewTimer int32 `json:"new_timer,omitempty" yaml:"new_timer,omitempty"` // New disappearing messages timer value. - NewTitle string `json:"new_title,omitempty" yaml:"new_title,omitempty"` - NewUnbannedMembers []*BannedGroupMember `json:"new_unbanned_members,omitempty" yaml:"new_unbanned_members,omitempty"` - PromotePendingMembers []*GroupMember `json:"promote_pending_members,omitempty" yaml:"promote_pending_members,omitempty"` - PromoteRequestingMembers []*GroupMember `json:"promote_requesting_members,omitempty" yaml:"promote_requesting_members,omitempty"` - Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` // The group revision that this change brings the group to. -} - -type GroupHistoryEntry struct { - Change *GroupChange `json:"change,omitempty" yaml:"change,omitempty"` - Group *JsonGroupV2Info `json:"group,omitempty" yaml:"group,omitempty"` -} - -// GroupHistoryPage: The result of fetching a group's history along with paging data. -type GroupHistoryPage struct { - PagingData *PagingData `json:"paging_data,omitempty" yaml:"paging_data,omitempty"` - Results []*GroupHistoryEntry `json:"results,omitempty" yaml:"results,omitempty"` -} - // GroupInfo: A generic type that is used when the group version is not known type GroupInfo struct { V1 *JsonGroupInfo `json:"v1,omitempty" yaml:"v1,omitempty"` @@ -263,7 +197,7 @@ type GroupLinkInfoRequest struct { type GroupList struct { Groups []*JsonGroupV2Info `json:"groups,omitempty" yaml:"groups,omitempty"` - LegacyGroups []*JsonGroupInfo `json:"legacyGroups,omitempty" yaml:"legacyGroups,omitempty"` // list of legacy (v1) groups, no longer supported (will always be empty) + LegacyGroups []*JsonGroupInfo `json:"legacyGroups,omitempty" yaml:"legacyGroups,omitempty"` } type GroupMember struct { @@ -272,18 +206,6 @@ type GroupMember struct { UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` } -type GroupPendingMember struct { - AddedByUuid string `json:"added_by_uuid,omitempty" yaml:"added_by_uuid,omitempty"` - Role string `json:"role,omitempty" yaml:"role,omitempty"` // possible values are: UNKNOWN, DEFAULT, ADMINISTRATOR and UNRECOGNIZED - Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` - UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` -} - -type GroupRequestingMember struct { - Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` - UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` -} - type HangupMessage struct { DeviceId int32 `json:"device_id,omitempty" yaml:"device_id,omitempty"` ID int64 `json:"id,omitempty" yaml:"id,omitempty"` @@ -322,7 +244,6 @@ type IncomingMessage struct { ServerReceiverTimestamp int64 `json:"server_receiver_timestamp,omitempty" yaml:"server_receiver_timestamp,omitempty"` Source *JsonAddress `json:"source,omitempty" yaml:"source,omitempty"` SourceDevice int32 `json:"source_device,omitempty" yaml:"source_device,omitempty"` - StoryMessage *StoryMessage `json:"story_message,omitempty" yaml:"story_message,omitempty"` SyncMessage *JsonSyncMessage `json:"sync_message,omitempty" yaml:"sync_message,omitempty"` Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` @@ -373,26 +294,24 @@ type JsonBlockedListMessage struct { } type JsonDataMessage struct { - 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. - 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"` - 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 - 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 - IsExpirationUpdate bool `json:"is_expiration_update,omitempty" yaml:"is_expiration_update,omitempty"` // whether or not this message changes the expiresInSeconds value for the whole chat. Some messages (remote deletes, reactions, etc) will have expiresInSeconds=0 even though the chat has disappearing messages enabled. - 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 - 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"` - 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 - 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 - StoryContext *StoryContext `json:"story_context,omitempty" yaml:"story_context,omitempty"` - 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. + 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. + 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"` + 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 + 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 + 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 + 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"` + 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 + 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 + 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. } // JsonGroupInfo: information about a legacy group @@ -416,23 +335,21 @@ type JsonGroupJoinInfo struct { // JsonGroupV2Info: Information about a Signal group type JsonGroupV2Info struct { - AccessControl *GroupAccessControl `json:"accessControl,omitempty" yaml:"accessControl,omitempty"` // current access control settings for this group - Announcements string `json:"announcements,omitempty" yaml:"announcements,omitempty"` // indicates if the group is an announcements group. Only admins are allowed to send messages to announcements groups. Options are UNKNOWN, ENABLED or DISABLED - Avatar string `json:"avatar,omitempty" yaml:"avatar,omitempty"` // path to the group's avatar on local disk, if available - BannedMembers []*BannedGroupMember `json:"banned_members,omitempty" yaml:"banned_members,omitempty"` - Description string `json:"description,omitempty" yaml:"description,omitempty"` - GroupChange *GroupChange `json:"group_change,omitempty" yaml:"group_change,omitempty"` // Represents a peer-to-peer group change done by a user. Will not be set if the group change signature fails verification. This is usually only set inside of incoming messages. - ID string `json:"id,omitempty" yaml:"id,omitempty"` - InviteLink string `json:"inviteLink,omitempty" yaml:"inviteLink,omitempty"` // the signal.group link, if applicable - MemberDetail []*GroupMember `json:"memberDetail,omitempty" yaml:"memberDetail,omitempty"` // detailed member list - Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` - PendingMemberDetail []*GroupMember `json:"pendingMemberDetail,omitempty" yaml:"pendingMemberDetail,omitempty"` // detailed pending member list - 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"` - Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` - Timer int32 `json:"timer,omitempty" yaml:"timer,omitempty"` - Title string `json:"title,omitempty" yaml:"title,omitempty"` + AccessControl *GroupAccessControl `json:"accessControl,omitempty" yaml:"accessControl,omitempty"` // current access control settings for this group + Announcements string `json:"announcements,omitempty" yaml:"announcements,omitempty"` // indicates if the group is an announcements group. Only admins are allowed to send messages to announcements groups. Options are UNKNOWN, ENABLED or DISABLED + Avatar string `json:"avatar,omitempty" yaml:"avatar,omitempty"` // path to the group's avatar on local disk, if available + Description string `json:"description,omitempty" yaml:"description,omitempty"` + ID string `json:"id,omitempty" yaml:"id,omitempty"` + InviteLink string `json:"inviteLink,omitempty" yaml:"inviteLink,omitempty"` // the signal.group link, if applicable + MemberDetail []*GroupMember `json:"memberDetail,omitempty" yaml:"memberDetail,omitempty"` // detailed member list + Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` + PendingMemberDetail []*GroupMember `json:"pendingMemberDetail,omitempty" yaml:"pendingMemberDetail,omitempty"` // detailed pending member list + 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"` + Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` + Timer int32 `json:"timer,omitempty" yaml:"timer,omitempty"` + Title string `json:"title,omitempty" yaml:"title,omitempty"` } type JsonMention struct { @@ -441,11 +358,31 @@ type JsonMention struct { UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` // The UUID of the account being mentioned } -// JsonMessageRequestResponseMessage: Responses to message requests from unknown users or groups +type JsonMessageEnvelope struct { + CallMessage *v0.JsonCallMessage `json:"callMessage,omitempty" yaml:"callMessage,omitempty"` + DataMessage *JsonDataMessage `json:"dataMessage,omitempty" yaml:"dataMessage,omitempty"` + HasContent bool `json:"hasContent,omitempty" yaml:"hasContent,omitempty"` + HasLegacyMessage bool `json:"hasLegacyMessage,omitempty" yaml:"hasLegacyMessage,omitempty"` + IsUnidentifiedSender bool `json:"isUnidentifiedSender,omitempty" yaml:"isUnidentifiedSender,omitempty"` + Receipt *v0.JsonReceiptMessage `json:"receipt,omitempty" yaml:"receipt,omitempty"` + Relay string `json:"relay,omitempty" yaml:"relay,omitempty"` + ServerDeliveredTimestamp int64 `json:"serverDeliveredTimestamp,omitempty" yaml:"serverDeliveredTimestamp,omitempty"` + ServerTimestamp int64 `json:"serverTimestamp,omitempty" yaml:"serverTimestamp,omitempty"` + Source *JsonAddress `json:"source,omitempty" yaml:"source,omitempty"` + SourceDevice int32 `json:"sourceDevice,omitempty" yaml:"sourceDevice,omitempty"` + SyncMessage *JsonSyncMessage `json:"syncMessage,omitempty" yaml:"syncMessage,omitempty"` + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` + TimestampISO string `json:"timestampISO,omitempty" yaml:"timestampISO,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` + Typing *v0.JsonTypingMessage `json:"typing,omitempty" yaml:"typing,omitempty"` + Username string `json:"username,omitempty" yaml:"username,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + type JsonMessageRequestResponseMessage struct { GroupId string `json:"groupId,omitempty" yaml:"groupId,omitempty"` Person *JsonAddress `json:"person,omitempty" yaml:"person,omitempty"` - Type string `json:"type,omitempty" yaml:"type,omitempty"` // One of UNKNOWN, ACCEPT, DELETE, BLOCK, BLOCK_AND_DELETE, UNBLOCK_AND_ACCEPT + Type string `json:"type,omitempty" yaml:"type,omitempty"` } // JsonPreview: metadata about one of the links in a message @@ -492,7 +429,6 @@ type JsonSentTranscriptMessage struct { ExpirationStartTimestamp int64 `json:"expirationStartTimestamp,omitempty" yaml:"expirationStartTimestamp,omitempty"` IsRecipientUpdate bool `json:"isRecipientUpdate,omitempty" yaml:"isRecipientUpdate,omitempty"` Message *JsonDataMessage `json:"message,omitempty" yaml:"message,omitempty"` - Story *StoryMessage `json:"story,omitempty" yaml:"story,omitempty"` Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` UnidentifiedStatus map[string]string `json:"unidentifiedStatus,omitempty" yaml:"unidentifiedStatus,omitempty"` } @@ -583,11 +519,6 @@ type OfferMessage struct { Type string `json:"type,omitempty" yaml:"type,omitempty"` } -type PagingData struct { - HasMorePages bool `json:"has_more_pages,omitempty" yaml:"has_more_pages,omitempty"` - NextPageRevision int32 `json:"next_page_revision,omitempty" yaml:"next_page_revision,omitempty"` -} - // Payment: details about a MobileCoin payment type Payment struct { Note string `json:"note,omitempty" yaml:"note,omitempty"` // note attached to the payment @@ -600,8 +531,7 @@ type Profile struct { Address *JsonAddress `json:"address,omitempty" yaml:"address,omitempty"` Avatar string `json:"avatar,omitempty" yaml:"avatar,omitempty"` // path to avatar on local disk Capabilities *Capabilities `json:"capabilities,omitempty" yaml:"capabilities,omitempty"` - Color string `json:"color,omitempty" yaml:"color,omitempty"` // color of the chat with this user - ContactName string `json:"contact_name,omitempty" yaml:"contact_name,omitempty"` // The user's name from local contact names + Color string `json:"color,omitempty" yaml:"color,omitempty"` // color of the chat with this user Emoji string `json:"emoji,omitempty" yaml:"emoji,omitempty"` ExpirationTime int32 `json:"expiration_time,omitempty" yaml:"expiration_time,omitempty"` InboxPosition int32 `json:"inbox_position,omitempty" yaml:"inbox_position,omitempty"` @@ -636,7 +566,6 @@ type ReceiptMessage struct { type RefuseMembershipRequest struct { Request Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with - AlsoBan bool `json:"also_ban,omitempty" yaml:"also_ban,omitempty"` GroupId string `json:"group_id,omitempty" yaml:"group_id,omitempty"` Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` // list of requesting members to refuse } @@ -729,7 +658,6 @@ type SendPaymentRequest struct { type SendRequest struct { Request - Account string `json:"account,omitempty" yaml:"account,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 Mentions []*JsonMention `json:"mentions,omitempty" yaml:"mentions,omitempty"` @@ -754,14 +682,6 @@ type SendSuccess struct { Unidentified bool `json:"unidentified,omitempty" yaml:"unidentified,omitempty"` } -// SendSyncMessageRequest: Sends a sync message to the account's devices -type SendSyncMessageRequest struct { - Request - Account string `json:"account,omitempty" yaml:"account,omitempty"` - MessageRequestResponse *JsonMessageRequestResponseMessage `json:"message_request_response,omitempty" yaml:"message_request_response,omitempty"` // This can be set to indicate to other devices about a response to an incoming message request from an unknown user or group. Warning: Using the BLOCK and BLOCK_AND_DELETE options relies on other devices to do the blocking, and it does not make you leave the group! - ViewOnceOpenMessage *JsonViewOnceOpenMessage `json:"view_once_open_message,omitempty" yaml:"view_once_open_message,omitempty"` // This can be set to indicate to other devices about having viewed a view-once message. -} - // Server: a Signal server type Server struct { Ca string `json:"ca,omitempty" yaml:"ca,omitempty"` // base64 encoded trust store, password must be 'whisper' @@ -864,23 +784,6 @@ type SharedContactPhone struct { Value string `json:"value,omitempty" yaml:"value,omitempty"` // the phone number } -// StorageChange: Broadcast to subscribed clients when there is a state change from the storage service -type StorageChange struct { - Version int64 `json:"version,omitempty" yaml:"version,omitempty"` // Seems to behave like the group version numbers and increments every time the state changes -} - -type StoryContext struct { - Author string `json:"author,omitempty" yaml:"author,omitempty"` - SentTimestamp int64 `json:"sent_timestamp,omitempty" yaml:"sent_timestamp,omitempty"` -} - -type StoryMessage struct { - AllowReplies bool `json:"allow_replies,omitempty" yaml:"allow_replies,omitempty"` - File *JsonAttachment `json:"file,omitempty" yaml:"file,omitempty"` - Group *JsonGroupV2Info `json:"group,omitempty" yaml:"group,omitempty"` - Text *TextAttachment `json:"text,omitempty" yaml:"text,omitempty"` -} - type SubmitChallengeRequest struct { Request Account string `json:"account,omitempty" yaml:"account,omitempty"` @@ -894,16 +797,6 @@ type SubscribeRequest struct { Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to subscribe to incoming message for } -type TextAttachment struct { - BackgroundColor string `json:"background_color,omitempty" yaml:"background_color,omitempty"` - BackgroundGradient *Gradient `json:"background_gradient,omitempty" yaml:"background_gradient,omitempty"` - Preview *JsonPreview `json:"preview,omitempty" yaml:"preview,omitempty"` - Style string `json:"style,omitempty" yaml:"style,omitempty"` - Text string `json:"text,omitempty" yaml:"text,omitempty"` - TextBackgroundColor string `json:"text_background_color,omitempty" yaml:"text_background_color,omitempty"` - TextForegroundColor string `json:"text_foreground_color,omitempty" yaml:"text_foreground_color,omitempty"` -} - // TrustRequest: Trust another user's safety number using either the QR code data or the safety number text type TrustRequest struct { Request @@ -930,14 +823,6 @@ type TypingRequest struct { When int64 `json:"when,omitempty" yaml:"when,omitempty"` } -// UnbanUserRequest: Unbans users from a group. -type UnbanUserRequest struct { - Request - Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with - GroupId string `json:"group_id,omitempty" yaml:"group_id,omitempty"` - Users []*JsonAddress `json:"users,omitempty" yaml:"users,omitempty"` // List of users to unban -} - // UnsubscribeRequest: See subscribe for more info type UnsubscribeRequest struct { Request diff --git a/signald/signald.go b/signald/signald.go index e82ccca..5a0f9d8 100644 --- a/signald/signald.go +++ b/signald/signald.go @@ -99,12 +99,8 @@ func (s *Signald) connect() error { return nil } -func (s *Signald) Close() error { - return s.socket.Close() -} - // Listen listens for events from signald -func (s *Signald) Listen(c chan client_protocol.BasicResponse) error { +func (s *Signald) Listen(c chan client_protocol.BasicResponse) { for { msg, err := s.readNext() if err == io.EOF { @@ -112,11 +108,7 @@ func (s *Signald) Listen(c chan client_protocol.BasicResponse) error { if c != nil { close(c) } - return nil - } - - if err != nil { - return err + return } if msg.Type == "unexpected_error" { @@ -133,7 +125,7 @@ func (s *Signald) Listen(c chan client_protocol.BasicResponse) error { subscribers <- msg } - if c != nil && !(msg.ID == "" && msg.Type == "version") { + if c != nil { c <- msg } } @@ -178,6 +170,9 @@ func (s *Signald) readNext() (b client_protocol.BasicResponse, err error) { } else { err = json.NewDecoder(s.socket).Decode(&b) } - + if err != nil { + log.Println("signald-go: error decoding message from signald:", err) + return + } return } diff --git a/tools/generator/requests.go.tmpl b/tools/generator/requests.go.tmpl index 6be8d72..fe08ac1 100644 --- a/tools/generator/requests.go.tmpl +++ b/tools/generator/requests.go.tmpl @@ -22,14 +22,15 @@ func {{$action.FnName}}(conn *signald.Signald) ({{if ne $action.Response ""}}res if(r.ID == "") { r.ID = signald.GenerateID() } - responseChannel := conn.GetResponseListener(r.ID) - defer conn.CloseResponseListener(r.ID) 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)