2026-09-05 00:57:28 +03:00
//
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v7.34.1
// source: org/signal/chat/backups.proto
package backups
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
2026-10-01 18:12:17 +03:00
emptypb "google.golang.org/protobuf/types/known/emptypb"
2026-09-05 00:57:28 +03:00
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc . SupportPackageIsVersion9
const (
Backups_SetBackupId_FullMethodName = "/org.signal.chat.backup.Backups/SetBackupId"
Backups_RedeemReceipt_FullMethodName = "/org.signal.chat.backup.Backups/RedeemReceipt"
Backups_GetBackupAuthCredentials_FullMethodName = "/org.signal.chat.backup.Backups/GetBackupAuthCredentials"
2026-10-01 18:12:17 +03:00
Backups_GetBackupIdLimits_FullMethodName = "/org.signal.chat.backup.Backups/GetBackupIdLimits"
2026-09-05 00:57:28 +03:00
)
// BackupsClient is the client API for Backups service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// 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.
type BackupsClient interface {
// 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.
SetBackupId ( ctx context . Context , in * SetBackupIdRequest , opts ... grpc . CallOption ) ( * SetBackupIdResponse , error )
// 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.
RedeemReceipt ( ctx context . Context , in * RedeemReceiptRequest , opts ... grpc . CallOption ) ( * RedeemReceiptResponse , error )
// 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.
GetBackupAuthCredentials ( ctx context . Context , in * GetBackupAuthCredentialsRequest , opts ... grpc . CallOption ) ( * GetBackupAuthCredentialsResponse , error )
2026-10-01 18:12:17 +03:00
// Retrieve backup ID rotation limits
GetBackupIdLimits ( ctx context . Context , in * emptypb . Empty , opts ... grpc . CallOption ) ( * GetBackupIdLimitsResponse , error )
2026-09-05 00:57:28 +03:00
}
type backupsClient struct {
cc grpc . ClientConnInterface
}
func NewBackupsClient ( cc grpc . ClientConnInterface ) BackupsClient {
return & backupsClient { cc }
}
func ( c * backupsClient ) SetBackupId ( ctx context . Context , in * SetBackupIdRequest , opts ... grpc . CallOption ) ( * SetBackupIdResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( SetBackupIdResponse )
err := c . cc . Invoke ( ctx , Backups_SetBackupId_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
func ( c * backupsClient ) RedeemReceipt ( ctx context . Context , in * RedeemReceiptRequest , opts ... grpc . CallOption ) ( * RedeemReceiptResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( RedeemReceiptResponse )
err := c . cc . Invoke ( ctx , Backups_RedeemReceipt_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
func ( c * backupsClient ) GetBackupAuthCredentials ( ctx context . Context , in * GetBackupAuthCredentialsRequest , opts ... grpc . CallOption ) ( * GetBackupAuthCredentialsResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( GetBackupAuthCredentialsResponse )
err := c . cc . Invoke ( ctx , Backups_GetBackupAuthCredentials_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
2026-10-01 18:12:17 +03:00
func ( c * backupsClient ) GetBackupIdLimits ( ctx context . Context , in * emptypb . Empty , opts ... grpc . CallOption ) ( * GetBackupIdLimitsResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( GetBackupIdLimitsResponse )
err := c . cc . Invoke ( ctx , Backups_GetBackupIdLimits_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
2026-09-05 00:57:28 +03:00
// BackupsServer is the server API for Backups service.
// All implementations must embed UnimplementedBackupsServer
// for forward compatibility.
//
// 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.
type BackupsServer interface {
// 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.
SetBackupId ( context . Context , * SetBackupIdRequest ) ( * SetBackupIdResponse , error )
// 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.
RedeemReceipt ( context . Context , * RedeemReceiptRequest ) ( * RedeemReceiptResponse , error )
// 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.
GetBackupAuthCredentials ( context . Context , * GetBackupAuthCredentialsRequest ) ( * GetBackupAuthCredentialsResponse , error )
2026-10-01 18:12:17 +03:00
// Retrieve backup ID rotation limits
GetBackupIdLimits ( context . Context , * emptypb . Empty ) ( * GetBackupIdLimitsResponse , error )
2026-09-05 00:57:28 +03:00
mustEmbedUnimplementedBackupsServer ( )
}
// UnimplementedBackupsServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedBackupsServer struct { }
func ( UnimplementedBackupsServer ) SetBackupId ( context . Context , * SetBackupIdRequest ) ( * SetBackupIdResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method SetBackupId not implemented" )
}
func ( UnimplementedBackupsServer ) RedeemReceipt ( context . Context , * RedeemReceiptRequest ) ( * RedeemReceiptResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method RedeemReceipt not implemented" )
}
func ( UnimplementedBackupsServer ) GetBackupAuthCredentials ( context . Context , * GetBackupAuthCredentialsRequest ) ( * GetBackupAuthCredentialsResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method GetBackupAuthCredentials not implemented" )
}
2026-10-01 18:12:17 +03:00
func ( UnimplementedBackupsServer ) GetBackupIdLimits ( context . Context , * emptypb . Empty ) ( * GetBackupIdLimitsResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method GetBackupIdLimits not implemented" )
}
2026-09-05 00:57:28 +03:00
func ( UnimplementedBackupsServer ) mustEmbedUnimplementedBackupsServer ( ) { }
func ( UnimplementedBackupsServer ) testEmbeddedByValue ( ) { }
// UnsafeBackupsServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to BackupsServer will
// result in compilation errors.
type UnsafeBackupsServer interface {
mustEmbedUnimplementedBackupsServer ( )
}
func RegisterBackupsServer ( s grpc . ServiceRegistrar , srv BackupsServer ) {
// If the following call panics, it indicates UnimplementedBackupsServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t , ok := srv . ( interface { testEmbeddedByValue ( ) } ) ; ok {
t . testEmbeddedByValue ( )
}
s . RegisterService ( & Backups_ServiceDesc , srv )
}
func _Backups_SetBackupId_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( SetBackupIdRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsServer ) . SetBackupId ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : Backups_SetBackupId_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsServer ) . SetBackupId ( ctx , req . ( * SetBackupIdRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
func _Backups_RedeemReceipt_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( RedeemReceiptRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsServer ) . RedeemReceipt ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : Backups_RedeemReceipt_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsServer ) . RedeemReceipt ( ctx , req . ( * RedeemReceiptRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
func _Backups_GetBackupAuthCredentials_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( GetBackupAuthCredentialsRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsServer ) . GetBackupAuthCredentials ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : Backups_GetBackupAuthCredentials_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsServer ) . GetBackupAuthCredentials ( ctx , req . ( * GetBackupAuthCredentialsRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
2026-10-01 18:12:17 +03:00
func _Backups_GetBackupIdLimits_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( emptypb . Empty )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsServer ) . GetBackupIdLimits ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : Backups_GetBackupIdLimits_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsServer ) . GetBackupIdLimits ( ctx , req . ( * emptypb . Empty ) )
}
return interceptor ( ctx , in , info , handler )
}
2026-09-05 00:57:28 +03:00
// Backups_ServiceDesc is the grpc.ServiceDesc for Backups service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Backups_ServiceDesc = grpc . ServiceDesc {
ServiceName : "org.signal.chat.backup.Backups" ,
HandlerType : ( * BackupsServer ) ( nil ) ,
Methods : [ ] grpc . MethodDesc {
{
MethodName : "SetBackupId" ,
Handler : _Backups_SetBackupId_Handler ,
} ,
{
MethodName : "RedeemReceipt" ,
Handler : _Backups_RedeemReceipt_Handler ,
} ,
{
MethodName : "GetBackupAuthCredentials" ,
Handler : _Backups_GetBackupAuthCredentials_Handler ,
} ,
2026-10-01 18:12:17 +03:00
{
MethodName : "GetBackupIdLimits" ,
Handler : _Backups_GetBackupIdLimits_Handler ,
} ,
2026-09-05 00:57:28 +03:00
} ,
Streams : [ ] grpc . StreamDesc { } ,
Metadata : "org/signal/chat/backups.proto" ,
}
const (
BackupsAnonymous_GetCdnCredentials_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/GetCdnCredentials"
BackupsAnonymous_GetSvrBCredentials_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/GetSvrBCredentials"
BackupsAnonymous_GetMessageBackupInfo_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/GetMessageBackupInfo"
BackupsAnonymous_GetMediaBackupInfo_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/GetMediaBackupInfo"
BackupsAnonymous_SetPublicKey_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/SetPublicKey"
BackupsAnonymous_Refresh_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/Refresh"
BackupsAnonymous_GetUploadForm_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/GetUploadForm"
BackupsAnonymous_CopyMedia_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/CopyMedia"
BackupsAnonymous_ListMedia_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/ListMedia"
BackupsAnonymous_DeleteMedia_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/DeleteMedia"
BackupsAnonymous_DeleteAll_FullMethodName = "/org.signal.chat.backup.BackupsAnonymous/DeleteAll"
)
// BackupsAnonymousClient is the client API for BackupsAnonymous service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// # 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.
type BackupsAnonymousClient interface {
// Retrieve credentials used to read objects stored on the backup cdn
GetCdnCredentials ( ctx context . Context , in * GetCdnCredentialsRequest , opts ... grpc . CallOption ) ( * GetCdnCredentialsResponse , error )
// Retrieve credentials used to interact with the SecureValueRecoveryB service
GetSvrBCredentials ( ctx context . Context , in * GetSvrBCredentialsRequest , opts ... grpc . CallOption ) ( * GetSvrBCredentialsResponse , error )
// Retrieve information about the currently stored message backup
GetMessageBackupInfo ( ctx context . Context , in * GetBackupInfoRequest , opts ... grpc . CallOption ) ( * GetMessageBackupInfoResponse , error )
// Retrieve information about the currently stored media backup
GetMediaBackupInfo ( ctx context . Context , in * GetBackupInfoRequest , opts ... grpc . CallOption ) ( * GetMediaBackupInfoResponse , error )
// 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.
SetPublicKey ( ctx context . Context , in * SetPublicKeyRequest , opts ... grpc . CallOption ) ( * SetPublicKeyResponse , error )
// 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.
Refresh ( ctx context . Context , in * RefreshRequest , opts ... grpc . CallOption ) ( * RefreshResponse , error )
// Retrieve an upload form that can be used to perform a resumable upload
GetUploadForm ( ctx context . Context , in * GetUploadFormRequest , opts ... grpc . CallOption ) ( * GetUploadFormResponse , error )
// 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.
CopyMedia ( ctx context . Context , in * CopyMediaRequest , opts ... grpc . CallOption ) ( grpc . ServerStreamingClient [ CopyMediaResponse ] , error )
// 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.
ListMedia ( ctx context . Context , in * ListMediaRequest , opts ... grpc . CallOption ) ( * ListMediaResponse , error )
// 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.
DeleteMedia ( ctx context . Context , in * DeleteMediaRequest , opts ... grpc . CallOption ) ( grpc . ServerStreamingClient [ DeleteMediaResponse ] , error )
// Delete all backup metadata, objects, and stored public key. To use
// backups again, a public key must be resupplied.
DeleteAll ( ctx context . Context , in * DeleteAllRequest , opts ... grpc . CallOption ) ( * DeleteAllResponse , error )
}
type backupsAnonymousClient struct {
cc grpc . ClientConnInterface
}
func NewBackupsAnonymousClient ( cc grpc . ClientConnInterface ) BackupsAnonymousClient {
return & backupsAnonymousClient { cc }
}
func ( c * backupsAnonymousClient ) GetCdnCredentials ( ctx context . Context , in * GetCdnCredentialsRequest , opts ... grpc . CallOption ) ( * GetCdnCredentialsResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( GetCdnCredentialsResponse )
err := c . cc . Invoke ( ctx , BackupsAnonymous_GetCdnCredentials_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
func ( c * backupsAnonymousClient ) GetSvrBCredentials ( ctx context . Context , in * GetSvrBCredentialsRequest , opts ... grpc . CallOption ) ( * GetSvrBCredentialsResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( GetSvrBCredentialsResponse )
err := c . cc . Invoke ( ctx , BackupsAnonymous_GetSvrBCredentials_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
func ( c * backupsAnonymousClient ) GetMessageBackupInfo ( ctx context . Context , in * GetBackupInfoRequest , opts ... grpc . CallOption ) ( * GetMessageBackupInfoResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( GetMessageBackupInfoResponse )
err := c . cc . Invoke ( ctx , BackupsAnonymous_GetMessageBackupInfo_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
func ( c * backupsAnonymousClient ) GetMediaBackupInfo ( ctx context . Context , in * GetBackupInfoRequest , opts ... grpc . CallOption ) ( * GetMediaBackupInfoResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( GetMediaBackupInfoResponse )
err := c . cc . Invoke ( ctx , BackupsAnonymous_GetMediaBackupInfo_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
func ( c * backupsAnonymousClient ) SetPublicKey ( ctx context . Context , in * SetPublicKeyRequest , opts ... grpc . CallOption ) ( * SetPublicKeyResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( SetPublicKeyResponse )
err := c . cc . Invoke ( ctx , BackupsAnonymous_SetPublicKey_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
func ( c * backupsAnonymousClient ) Refresh ( ctx context . Context , in * RefreshRequest , opts ... grpc . CallOption ) ( * RefreshResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( RefreshResponse )
err := c . cc . Invoke ( ctx , BackupsAnonymous_Refresh_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
func ( c * backupsAnonymousClient ) GetUploadForm ( ctx context . Context , in * GetUploadFormRequest , opts ... grpc . CallOption ) ( * GetUploadFormResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( GetUploadFormResponse )
err := c . cc . Invoke ( ctx , BackupsAnonymous_GetUploadForm_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
func ( c * backupsAnonymousClient ) CopyMedia ( ctx context . Context , in * CopyMediaRequest , opts ... grpc . CallOption ) ( grpc . ServerStreamingClient [ CopyMediaResponse ] , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
stream , err := c . cc . NewStream ( ctx , & BackupsAnonymous_ServiceDesc . Streams [ 0 ] , BackupsAnonymous_CopyMedia_FullMethodName , cOpts ... )
if err != nil {
return nil , err
}
x := & grpc . GenericClientStream [ CopyMediaRequest , CopyMediaResponse ] { ClientStream : stream }
if err := x . ClientStream . SendMsg ( in ) ; err != nil {
return nil , err
}
if err := x . ClientStream . CloseSend ( ) ; err != nil {
return nil , err
}
return x , nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type BackupsAnonymous_CopyMediaClient = grpc . ServerStreamingClient [ CopyMediaResponse ]
func ( c * backupsAnonymousClient ) ListMedia ( ctx context . Context , in * ListMediaRequest , opts ... grpc . CallOption ) ( * ListMediaResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( ListMediaResponse )
err := c . cc . Invoke ( ctx , BackupsAnonymous_ListMedia_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
func ( c * backupsAnonymousClient ) DeleteMedia ( ctx context . Context , in * DeleteMediaRequest , opts ... grpc . CallOption ) ( grpc . ServerStreamingClient [ DeleteMediaResponse ] , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
stream , err := c . cc . NewStream ( ctx , & BackupsAnonymous_ServiceDesc . Streams [ 1 ] , BackupsAnonymous_DeleteMedia_FullMethodName , cOpts ... )
if err != nil {
return nil , err
}
x := & grpc . GenericClientStream [ DeleteMediaRequest , DeleteMediaResponse ] { ClientStream : stream }
if err := x . ClientStream . SendMsg ( in ) ; err != nil {
return nil , err
}
if err := x . ClientStream . CloseSend ( ) ; err != nil {
return nil , err
}
return x , nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type BackupsAnonymous_DeleteMediaClient = grpc . ServerStreamingClient [ DeleteMediaResponse ]
func ( c * backupsAnonymousClient ) DeleteAll ( ctx context . Context , in * DeleteAllRequest , opts ... grpc . CallOption ) ( * DeleteAllResponse , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
out := new ( DeleteAllResponse )
err := c . cc . Invoke ( ctx , BackupsAnonymous_DeleteAll_FullMethodName , in , out , cOpts ... )
if err != nil {
return nil , err
}
return out , nil
}
// BackupsAnonymousServer is the server API for BackupsAnonymous service.
// All implementations must embed UnimplementedBackupsAnonymousServer
// for forward compatibility.
//
// # 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.
type BackupsAnonymousServer interface {
// Retrieve credentials used to read objects stored on the backup cdn
GetCdnCredentials ( context . Context , * GetCdnCredentialsRequest ) ( * GetCdnCredentialsResponse , error )
// Retrieve credentials used to interact with the SecureValueRecoveryB service
GetSvrBCredentials ( context . Context , * GetSvrBCredentialsRequest ) ( * GetSvrBCredentialsResponse , error )
// Retrieve information about the currently stored message backup
GetMessageBackupInfo ( context . Context , * GetBackupInfoRequest ) ( * GetMessageBackupInfoResponse , error )
// Retrieve information about the currently stored media backup
GetMediaBackupInfo ( context . Context , * GetBackupInfoRequest ) ( * GetMediaBackupInfoResponse , error )
// 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.
SetPublicKey ( context . Context , * SetPublicKeyRequest ) ( * SetPublicKeyResponse , error )
// 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.
Refresh ( context . Context , * RefreshRequest ) ( * RefreshResponse , error )
// Retrieve an upload form that can be used to perform a resumable upload
GetUploadForm ( context . Context , * GetUploadFormRequest ) ( * GetUploadFormResponse , error )
// 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.
CopyMedia ( * CopyMediaRequest , grpc . ServerStreamingServer [ CopyMediaResponse ] ) error
// 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.
ListMedia ( context . Context , * ListMediaRequest ) ( * ListMediaResponse , error )
// 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.
DeleteMedia ( * DeleteMediaRequest , grpc . ServerStreamingServer [ DeleteMediaResponse ] ) error
// Delete all backup metadata, objects, and stored public key. To use
// backups again, a public key must be resupplied.
DeleteAll ( context . Context , * DeleteAllRequest ) ( * DeleteAllResponse , error )
mustEmbedUnimplementedBackupsAnonymousServer ( )
}
// UnimplementedBackupsAnonymousServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedBackupsAnonymousServer struct { }
func ( UnimplementedBackupsAnonymousServer ) GetCdnCredentials ( context . Context , * GetCdnCredentialsRequest ) ( * GetCdnCredentialsResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method GetCdnCredentials not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) GetSvrBCredentials ( context . Context , * GetSvrBCredentialsRequest ) ( * GetSvrBCredentialsResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method GetSvrBCredentials not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) GetMessageBackupInfo ( context . Context , * GetBackupInfoRequest ) ( * GetMessageBackupInfoResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method GetMessageBackupInfo not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) GetMediaBackupInfo ( context . Context , * GetBackupInfoRequest ) ( * GetMediaBackupInfoResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method GetMediaBackupInfo not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) SetPublicKey ( context . Context , * SetPublicKeyRequest ) ( * SetPublicKeyResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method SetPublicKey not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) Refresh ( context . Context , * RefreshRequest ) ( * RefreshResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method Refresh not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) GetUploadForm ( context . Context , * GetUploadFormRequest ) ( * GetUploadFormResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method GetUploadForm not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) CopyMedia ( * CopyMediaRequest , grpc . ServerStreamingServer [ CopyMediaResponse ] ) error {
return status . Error ( codes . Unimplemented , "method CopyMedia not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) ListMedia ( context . Context , * ListMediaRequest ) ( * ListMediaResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method ListMedia not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) DeleteMedia ( * DeleteMediaRequest , grpc . ServerStreamingServer [ DeleteMediaResponse ] ) error {
return status . Error ( codes . Unimplemented , "method DeleteMedia not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) DeleteAll ( context . Context , * DeleteAllRequest ) ( * DeleteAllResponse , error ) {
return nil , status . Error ( codes . Unimplemented , "method DeleteAll not implemented" )
}
func ( UnimplementedBackupsAnonymousServer ) mustEmbedUnimplementedBackupsAnonymousServer ( ) { }
func ( UnimplementedBackupsAnonymousServer ) testEmbeddedByValue ( ) { }
// UnsafeBackupsAnonymousServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to BackupsAnonymousServer will
// result in compilation errors.
type UnsafeBackupsAnonymousServer interface {
mustEmbedUnimplementedBackupsAnonymousServer ( )
}
func RegisterBackupsAnonymousServer ( s grpc . ServiceRegistrar , srv BackupsAnonymousServer ) {
// If the following call panics, it indicates UnimplementedBackupsAnonymousServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t , ok := srv . ( interface { testEmbeddedByValue ( ) } ) ; ok {
t . testEmbeddedByValue ( )
}
s . RegisterService ( & BackupsAnonymous_ServiceDesc , srv )
}
func _BackupsAnonymous_GetCdnCredentials_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( GetCdnCredentialsRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsAnonymousServer ) . GetCdnCredentials ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : BackupsAnonymous_GetCdnCredentials_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsAnonymousServer ) . GetCdnCredentials ( ctx , req . ( * GetCdnCredentialsRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
func _BackupsAnonymous_GetSvrBCredentials_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( GetSvrBCredentialsRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsAnonymousServer ) . GetSvrBCredentials ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : BackupsAnonymous_GetSvrBCredentials_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsAnonymousServer ) . GetSvrBCredentials ( ctx , req . ( * GetSvrBCredentialsRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
func _BackupsAnonymous_GetMessageBackupInfo_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( GetBackupInfoRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsAnonymousServer ) . GetMessageBackupInfo ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : BackupsAnonymous_GetMessageBackupInfo_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsAnonymousServer ) . GetMessageBackupInfo ( ctx , req . ( * GetBackupInfoRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
func _BackupsAnonymous_GetMediaBackupInfo_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( GetBackupInfoRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsAnonymousServer ) . GetMediaBackupInfo ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : BackupsAnonymous_GetMediaBackupInfo_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsAnonymousServer ) . GetMediaBackupInfo ( ctx , req . ( * GetBackupInfoRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
func _BackupsAnonymous_SetPublicKey_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( SetPublicKeyRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsAnonymousServer ) . SetPublicKey ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : BackupsAnonymous_SetPublicKey_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsAnonymousServer ) . SetPublicKey ( ctx , req . ( * SetPublicKeyRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
func _BackupsAnonymous_Refresh_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( RefreshRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsAnonymousServer ) . Refresh ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : BackupsAnonymous_Refresh_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsAnonymousServer ) . Refresh ( ctx , req . ( * RefreshRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
func _BackupsAnonymous_GetUploadForm_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( GetUploadFormRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsAnonymousServer ) . GetUploadForm ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : BackupsAnonymous_GetUploadForm_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsAnonymousServer ) . GetUploadForm ( ctx , req . ( * GetUploadFormRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
func _BackupsAnonymous_CopyMedia_Handler ( srv interface { } , stream grpc . ServerStream ) error {
m := new ( CopyMediaRequest )
if err := stream . RecvMsg ( m ) ; err != nil {
return err
}
return srv . ( BackupsAnonymousServer ) . CopyMedia ( m , & grpc . GenericServerStream [ CopyMediaRequest , CopyMediaResponse ] { ServerStream : stream } )
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type BackupsAnonymous_CopyMediaServer = grpc . ServerStreamingServer [ CopyMediaResponse ]
func _BackupsAnonymous_ListMedia_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( ListMediaRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsAnonymousServer ) . ListMedia ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : BackupsAnonymous_ListMedia_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsAnonymousServer ) . ListMedia ( ctx , req . ( * ListMediaRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
func _BackupsAnonymous_DeleteMedia_Handler ( srv interface { } , stream grpc . ServerStream ) error {
m := new ( DeleteMediaRequest )
if err := stream . RecvMsg ( m ) ; err != nil {
return err
}
return srv . ( BackupsAnonymousServer ) . DeleteMedia ( m , & grpc . GenericServerStream [ DeleteMediaRequest , DeleteMediaResponse ] { ServerStream : stream } )
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type BackupsAnonymous_DeleteMediaServer = grpc . ServerStreamingServer [ DeleteMediaResponse ]
func _BackupsAnonymous_DeleteAll_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( DeleteAllRequest )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( BackupsAnonymousServer ) . DeleteAll ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : BackupsAnonymous_DeleteAll_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( BackupsAnonymousServer ) . DeleteAll ( ctx , req . ( * DeleteAllRequest ) )
}
return interceptor ( ctx , in , info , handler )
}
// BackupsAnonymous_ServiceDesc is the grpc.ServiceDesc for BackupsAnonymous service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var BackupsAnonymous_ServiceDesc = grpc . ServiceDesc {
ServiceName : "org.signal.chat.backup.BackupsAnonymous" ,
HandlerType : ( * BackupsAnonymousServer ) ( nil ) ,
Methods : [ ] grpc . MethodDesc {
{
MethodName : "GetCdnCredentials" ,
Handler : _BackupsAnonymous_GetCdnCredentials_Handler ,
} ,
{
MethodName : "GetSvrBCredentials" ,
Handler : _BackupsAnonymous_GetSvrBCredentials_Handler ,
} ,
{
MethodName : "GetMessageBackupInfo" ,
Handler : _BackupsAnonymous_GetMessageBackupInfo_Handler ,
} ,
{
MethodName : "GetMediaBackupInfo" ,
Handler : _BackupsAnonymous_GetMediaBackupInfo_Handler ,
} ,
{
MethodName : "SetPublicKey" ,
Handler : _BackupsAnonymous_SetPublicKey_Handler ,
} ,
{
MethodName : "Refresh" ,
Handler : _BackupsAnonymous_Refresh_Handler ,
} ,
{
MethodName : "GetUploadForm" ,
Handler : _BackupsAnonymous_GetUploadForm_Handler ,
} ,
{
MethodName : "ListMedia" ,
Handler : _BackupsAnonymous_ListMedia_Handler ,
} ,
{
MethodName : "DeleteAll" ,
Handler : _BackupsAnonymous_DeleteAll_Handler ,
} ,
} ,
Streams : [ ] grpc . StreamDesc {
{
StreamName : "CopyMedia" ,
Handler : _BackupsAnonymous_CopyMedia_Handler ,
ServerStreams : true ,
} ,
{
StreamName : "DeleteMedia" ,
Handler : _BackupsAnonymous_DeleteMedia_Handler ,
ServerStreams : true ,
} ,
} ,
Metadata : "org/signal/chat/backups.proto" ,
}