← Back to packages

Package org.signal.chat.backup

Service Backups

Service BackupsAnonymous

Message BackupStreamClosed

Message CdnCredentials

Message CopyMediaItem

Message CopyMediaRequest

Message CopyMediaResponse

Message CopySuccess

Message Credentials

Message DeleteAllRequest

Message DeleteAllResponse

Message DeleteMediaItem

Message DeleteMediaRequest

Message DeleteMediaResponse

Message GetBackupAuthCredentialsRequest

Message GetBackupAuthCredentialsResponse

Message GetBackupIdLimitsResponse

Message GetBackupInfoRequest

Message GetCdnCredentialsRequest

Message GetCdnCredentialsResponse

Message GetMediaBackupInfoResponse

Message GetMessageBackupInfoResponse

Message GetSvrBCredentialsRequest

Message GetSvrBCredentialsResponse

Message GetUploadFormRequest

Message GetUploadFormResponse

Message ListEntry

Message ListMediaRequest

Message ListMediaResponse

Message ListResult

Message MediaBackupInfo

Message MediaUploadType

Message MessageBackupInfo

Message MessagesUploadType

Message OutOfSpace

Message RedeemReceiptRequest

Message RedeemReceiptResponse

Message RefreshRequest

Message RefreshResponse

Message SetBackupIdRequest

Message SetBackupIdResponse

Message SetPublicKeyRequest

Message SetPublicKeyResponse

Message SignedPresentation

Message SourceNotFound

Message SvrBCredentials

Message WrongSourceLength

Services

service Backups

Service for backup operations that require account authentication.

Most actual backup operations operate on the backup-id and cannot be linked to the caller's account, but setting up anonymous credentials and changing backup tier requires account authentication.

Set (blinded) backup-id(s) for the account.

Each account may have a single active backup-id for each credential type that can be used to store and retrieve backups. Once the backup-id is set, BackupAuthCredentials can be generated using GetBackupAuthCredentials.

The blinded backup-id and the key-pair used to blind it must be derived from a recoverable secret.

At least one of the credential types must be set on the request. Only the primary device can set a blinded backup-id.

Redeem a receipt acquired from /v1/subscription/{subscriberId}/receipt_credentials to mark the account as eligible for the paid backup tier.

After successful redemption, subsequent requests to GetBackupAuthCredentials will return credentials with the level on the provided receipt until the expiration time on the receipt.

After setting a blinded backup-id with PUT /v1/archives/, this fetches credentials that can be used to perform operations against that backup-id. Clients may (and should) request up to 7 days of credentials at a time.

The redemption_start and redemption_end seconds must be UTC day aligned, and must not span more than 7 days.

Each credential contains a receipt level which indicates the backup level the credential is good for. If the account has paid backup access that expires at some point in the provided redemption window, credentials with redemption times after the expiration may be on a lower backup level.

Clients must validate the receipt level on the credential matches a known receipt level before using it.

Retrieve backup ID rotation limits

service BackupsAnonymous

Service for backup operations with anonymous credentials

This service never requires account authentication. It instead requires a backup-id authenticated with an anonymous credential that cannot be linked to the account.

To register an anonymous credential:

  1. Set a backup-id on the authenticated channel via Backups::SetBackupId
  2. Retrieve BackupAuthCredentials via Backups::GetBackupAuthCredentials
  3. Generate a key pair and set the public key via BackupsAnonymous::SetPublicKey

Unless otherwise noted, requests for this service require a SignedPresentation, which includes:

  • a presentation generated from a BackupAuthCredential issued by GetBackupAuthCredentials
  • a signature of that presentation using the private key of a key pair previously set with SetPublicKey.

Retrieve credentials used to read objects stored on the backup cdn

Retrieve credentials used to interact with the SecureValueRecoveryB service

Retrieve information about the currently stored message backup

Retrieve information about the currently stored media backup

Permanently set the public key of an ED25519 key-pair for the backup-id. All requests (including this one!) must sign their BackupAuthCredential presentations with the private key corresponding to the provided public key.

Refresh the backup, indicating that the backup is still active. Clients must periodically upload new backups or perform a refresh. If a backup has not been active for 30 days, it may be deleted.

Retrieve an upload form that can be used to perform a resumable upload

Copy and re-encrypt media from the attachments cdn into the backup cdn. The original, already encrypted, attachments will be encrypted with the provided key material before being copied.

The copy operation is not atomic and responses will be returned as copy operations complete with detailed information about the outcome. If an error is encountered, not all requests may be reflected in the responses.

On retries, a particular destination media id must not be reused with a different source media id or different encryption parameters.

The response stream may be closed with STREAM_CLOSED error reason. In this case, a BackupStreamClosed message will be present in the error details.

Retrieve a page of media objects stored for this backup-id. A client may have previously stored media objects that are no longer referenced in their current backup. To reclaim storage space used by these orphaned objects, perform a list operation and remove any unreferenced media objects via DeleteMedia.

Delete media objects stored with this backup-id. Streams the locations of media items back when the item has successfully been removed.

The response stream may be closed with STREAM_CLOSED error reason. In this case, a BackupStreamClosed message will be present in the error details.

Delete all backup metadata, objects, and stored public key. To use backups again, a public key must be resupplied.

Messages

message BackupStreamClosed

The reason why a media stream RPC is being prematurely closed by the server.

Field Type Description
oneof reason
1 failed_authentication org.signal.chat.errors.FailedZkAuthentication

The provided backup auth credential presentation could not be authenticated. Either, the presentation could not be verified, or the public key signature was invalid, or there is no backup associated with the backup-id in the presentation.

message CdnCredentials
(Nested in org.signal.chat.backup.GetCdnCredentialsResponse )

Field Type Description
1 headers map<string, string>

message CopyMediaItem

Field Type Description
1 source_attachment_cdn uint32

The attachment cdn of the object to copy into the backup

2 source_key string

The attachment key of the object to copy into the backup

3 object_length uint64

The length of the source attachment before the encryption applied by the copy operation

4 media_id bytes

media_id to copy on to the backup CDN

5 hmac_key bytes

A 32-byte key for the MAC

6 encryption_key bytes

A 32-byte encryption key for AES

message CopyMediaRequest

Field Type Description
1 signed_presentation org.signal.chat.backup.SignedPresentation
2 items repeated org.signal.chat.backup.CopyMediaItem

Items to copy

message CopyMediaResponse

Field Type Description
1 media_id bytes

The 15-byte media_id from the corresponding CopyMediaItem in the request

oneof response
2 success org.signal.chat.backup.CopyMediaResponse.CopySuccess

The media item was successfully copied into the backup

3 source_not_found org.signal.chat.backup.CopyMediaResponse.SourceNotFound

The source object was not found

4 wrong_source_length org.signal.chat.backup.CopyMediaResponse.WrongSourceLength

The provided object length was incorrect

5 out_of_space org.signal.chat.backup.CopyMediaResponse.OutOfSpace

All media capacity has been consumed. Free some space to continue.

message CopySuccess
(Nested in org.signal.chat.backup.CopyMediaResponse )

Field Type Description
1 cdn uint32

The backup cdn where this media object is stored

message Credentials
(Nested in org.signal.chat.backup.GetBackupAuthCredentialsResponse )

Field Type Description
1 message_credentials map<int64, ZkCredential>

The requested message backup ZkCredentials indexed by the start of their validity period. The smallest key should be for the requested redemption_start, the largest for the requested redemption_end.

2 media_credentials map<int64, ZkCredential>

The requested media backup ZkCredentials indexed by the start of their validity period. The smallest key should be for the requested redemption_start, the largest for the requested redemption_end.

message DeleteAllRequest

Field Type Description
1 signed_presentation org.signal.chat.backup.SignedPresentation

message DeleteAllResponse

Field Type Description
oneof response
1 success google.protobuf.Empty

The backup was successfully scheduled for deletion

2 failed_authentication org.signal.chat.errors.FailedZkAuthentication

The provided backup auth credential presentation could not be authenticated. Either, the presentation could not be verified, or the public key signature was invalid, or there is no backup associated with the backup-id in the presentation.

message DeleteMediaItem

Field Type Description
1 cdn uint32

The backup cdn where this media object is stored

2 media_id bytes

The media_id of the object to delete

message DeleteMediaRequest

Field Type Description
1 signed_presentation org.signal.chat.backup.SignedPresentation
2 items repeated org.signal.chat.backup.DeleteMediaItem

message DeleteMediaResponse

Field Type Description
1 deleted_item org.signal.chat.backup.DeleteMediaItem

message GetBackupAuthCredentialsRequest

Field Type Description
1 redemption_start int64

The redemption time for the first credential. This must be a day-aligned seconds since epoch in UTC.

2 redemption_stop int64

The redemption time for the last credential. This must be a day-aligned seconds since epoch in UTC. The span between redemptionStart and redemptionEnd must not exceed 7 days.

message GetBackupAuthCredentialsResponse

Field Type Description
1 credentials org.signal.chat.backup.GetBackupAuthCredentialsResponse.Credentials

The requested credentials. If absent, there was no existing blinded backup id associated with the provided account.

message GetBackupIdLimitsResponse

Field Type Description
1 hasPermitsRemaining bool

If true, a call to SetBackupId may succeed without waiting

2 retryAfterSeconds uint64

How long to wait before a permit becomes available, in seconds

message GetBackupInfoRequest

Field Type Description
1 signed_presentation org.signal.chat.backup.SignedPresentation

message GetCdnCredentialsRequest

Field Type Description
1 signed_presentation org.signal.chat.backup.SignedPresentation
2 cdn uint32

message GetCdnCredentialsResponse

Field Type Description
oneof response
1 cdn_credentials org.signal.chat.backup.GetCdnCredentialsResponse.CdnCredentials

Headers to include with requests to the read from the backup CDN. Includes time limited read-only credentials.

2 failed_authentication org.signal.chat.errors.FailedZkAuthentication

The provided backup auth credential presentation could not be authenticated. Either, the presentation could not be verified, or the public key signature was invalid, or there is no backup associated with the backup-id in the presentation.

message GetMediaBackupInfoResponse

Field Type Description
oneof response
1 backup_info org.signal.chat.backup.GetMediaBackupInfoResponse.MediaBackupInfo
2 failed_authentication org.signal.chat.errors.FailedZkAuthentication

The provided backup auth credential presentation could not be authenticated. Either, the presentation could not be verified, or the public key signature was invalid, or there is no backup associated with the backup-id in the presentation.

message GetMessageBackupInfoResponse

Field Type Description
oneof response
1 backup_info org.signal.chat.backup.GetMessageBackupInfoResponse.MessageBackupInfo
2 failed_authentication org.signal.chat.errors.FailedZkAuthentication

The provided backup auth credential presentation could not be authenticated. Either, the presentation could not be verified, or the public key signature was invalid, or there is no backup associated with the backup-id in the presentation.

message GetSvrBCredentialsRequest

Field Type Description
1 signed_presentation org.signal.chat.backup.SignedPresentation

message GetSvrBCredentialsResponse

Field Type Description
oneof response
1 svrb_credentials org.signal.chat.backup.GetSvrBCredentialsResponse.SvrBCredentials
2 failed_authentication org.signal.chat.errors.FailedZkAuthentication

The provided backup auth credential presentation could not be authenticated. Either, the presentation could not be verified, or the public key signature was invalid, or there is no backup associated with the backup-id in the presentation.

message GetUploadFormRequest

Field Type Description
1 signed_presentation org.signal.chat.backup.SignedPresentation
4 uploadLength uint64

The length of the attachment for the requested upload form. Uploads performed with this form will be limited to the provided length.

oneof upload_type
2 messages org.signal.chat.backup.GetUploadFormRequest.MessagesUploadType

Retrieve an upload form that can be used to perform a resumable upload of a message backup. The finished upload will be available on the backup cdn.

3 media org.signal.chat.backup.GetUploadFormRequest.MediaUploadType

Retrieve an upload form for a temporary location that can be used to perform a resumable upload of an attachment. After uploading, the attachment can be copied into the backup via CopyMedia.

Behaves identically to the account authenticated version at /attachments.

message GetUploadFormResponse

Field Type Description
oneof response
1 upload_form org.signal.chat.common.UploadForm
2 failed_authentication org.signal.chat.errors.FailedZkAuthentication

The provided backup auth credential presentation could not be authenticated. Either, the presentation could not be verified, or the public key signature was invalid, or there is no backup associated with the backup-id in the presentation.

3 exceeds_max_upload_length org.signal.chat.errors.FailedPrecondition

The request size was larger than the maximum supported upload size. The maximum upload size is subject to change and is governed by global.attachments.maxBytes

message ListEntry
(Nested in org.signal.chat.backup.ListMediaResponse )

Field Type Description
1 cdn uint32

The backup cdn where this media object is stored

2 media_id bytes

The media_id of the object

3 length uint64

The length of the object in bytes

message ListMediaRequest

Field Type Description
1 signed_presentation org.signal.chat.backup.SignedPresentation
2 cursor optional string

A cursor returned by a previous call to ListMedia, absent on the first call

3 limit optional uint32

If provided, the maximum number of entries to return in a page. If absent, a server-chosen default is used.

message ListMediaResponse

Field Type Description
oneof response
1 list_result org.signal.chat.backup.ListMediaResponse.ListResult
2 failed_authentication org.signal.chat.errors.FailedZkAuthentication

The provided backup auth credential presentation could not be authenticated. Either, the presentation could not be verified, or the public key signature was invalid, or there is no backup associated with the backup-id in the presentation.

message ListResult
(Nested in org.signal.chat.backup.ListMediaResponse )

Field Type Description
1 page repeated org.signal.chat.backup.ListMediaResponse.ListEntry

A page of media objects stored for this backup ID

2 backup_dir string

The base directory of the backup data on the cdn. The stored media can be found at /backup_dir/media_dir/media_id, where the media_id is encoded with unpadded url-safe base64.

3 media_dir string

The prefix path component for the media objects. The stored media for media_id can be found at /backup_dir/media_dir/media_id, where the media_id is encoded with unpadded url-safe base64.

4 cursor optional string

If set, the cursor value to pass to the next list request to continue listing. If absent, all objects have been listed

message MediaBackupInfo
(Nested in org.signal.chat.backup.GetMediaBackupInfoResponse )

Field Type Description
1 backup_dir string

The base directory of your backup data on the cdn. Always non-empty, even if no media has been stored to the cdn or the credential is for a tier that does not support media.

2 media_dir string

The prefix path component for media objects on a cdn. Stored media for a media_id can be found at /backup_dir/media_dir/media_id, where the media_id is encoded in unpadded url-safe base64. Always non-empty, even if no media has been stored to the cdn or the credential is for a tier that does not support media.

3 used_space uint64

The amount of space used to store media

message MediaUploadType
(Nested in org.signal.chat.backup.GetUploadFormRequest )

Field Type Description

message MessageBackupInfo
(Nested in org.signal.chat.backup.GetMessageBackupInfoResponse )

Field Type Description
1 backup_dir string

The base directory of your backup data on the cdn. Always non-empty, even if a backup has not actually been stored to the cdn. If a backup was previously uploaded and has not expired, it can be found in the returned cdn at /backup_dir/backup_name.

2 cdn uint32

The CDN type where the message backup is stored. Media may be stored elsewhere.

3 backup_name string

The location of the message backup on the cdn. Always non-empty, even if a backup has not actually been stored to the cdn. If a backup was previously uploaded and has not expired, it can be found in the returned cdn at /backup_dir/backup_name.

message MessagesUploadType
(Nested in org.signal.chat.backup.GetUploadFormRequest )

Field Type Description

message OutOfSpace
(Nested in org.signal.chat.backup.CopyMediaResponse )

Field Type Description

message RedeemReceiptRequest

Field Type Description
1 presentation bytes

Presentation for a previously acquired receipt, serialized with libsignal

message RedeemReceiptResponse

Field Type Description
oneof response
1 success google.protobuf.Empty

The receipt was successfully redeemed

2 account_missing_commitment org.signal.chat.errors.FailedPrecondition

The target account does not have a backup-id commitment

3 invalid_receipt org.signal.chat.errors.FailedPrecondition

The provided receipt presentation was malformed or expired

message RefreshRequest

Field Type Description
1 signed_presentation org.signal.chat.backup.SignedPresentation

message RefreshResponse

Field Type Description
oneof response
1 success google.protobuf.Empty

The backup was successfully refreshed

2 failed_authentication org.signal.chat.errors.FailedZkAuthentication

The provided backup auth credential presentation could not be authenticated. Either, the presentation could not be verified, or the public key signature was invalid, or there is no backup associated with the backup-id in the presentation.

message SetBackupIdRequest

Field Type Description
1 messages_backup_auth_credential_request bytes

A BackupAuthCredentialRequest containing a blinded encrypted backup-id, encoded in standard padded base64. This backup-id should be used for message backups only, and must have the message backup type set on the credential. If absent, the message credential request will not be updated.

2 media_backup_auth_credential_request bytes

A BackupAuthCredentialRequest containing a blinded encrypted backup-id, encoded in standard padded base64. This backup-id should be used for media only, and must have the media type set on the credential. If absent, the media credential request will not be updated.

message SetBackupIdResponse

Field Type Description

message SetPublicKeyRequest

Field Type Description
1 signed_presentation org.signal.chat.backup.SignedPresentation
2 public_key bytes

The public key, serialized in libsignal's elliptic-curve public key format.

message SetPublicKeyResponse

Field Type Description
oneof response
1 success google.protobuf.Empty

The public key was successfully set

2 failed_authentication org.signal.chat.errors.FailedZkAuthentication

The provided backup auth credential presentation could not be authenticated. Either, the presentation could not be verified, or the public key signature was invalid, or there is no backup associated with the backup-id in the presentation.

This may also be returned if there was an existing public key and the provided public key did not match.

message SignedPresentation

Field Type Description
1 presentation bytes

Presentation of a BackupAuthCredential previously retrieved from GetBackupAuthCredentials on the authenticated channel

2 presentation_signature bytes

The presentation signed with the private key corresponding to the public key set with SetPublicKey

message SourceNotFound
(Nested in org.signal.chat.backup.CopyMediaResponse )

Field Type Description

message SvrBCredentials
(Nested in org.signal.chat.backup.GetSvrBCredentialsResponse )

Field Type Description
1 username string

A username that can be presented to authenticate with SVRB

2 password string

A password that can be presented to authenticate with SVRB

message WrongSourceLength
(Nested in org.signal.chat.backup.CopyMediaResponse )

Field Type Description