mirror of
https://github.com/mautrix/signal.git
synced 2026-09-16 15:52:04 -04:00
524 lines
23 KiB
Go
Generated
524 lines
23 KiB
Go
Generated
//
|
|
// Copyright 2023 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/keys.proto
|
|
|
|
package keys
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// 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 (
|
|
Keys_GetPreKeyCount_FullMethodName = "/org.signal.chat.keys.Keys/GetPreKeyCount"
|
|
Keys_GetPreKeys_FullMethodName = "/org.signal.chat.keys.Keys/GetPreKeys"
|
|
Keys_SetOneTimeEcPreKeys_FullMethodName = "/org.signal.chat.keys.Keys/SetOneTimeEcPreKeys"
|
|
Keys_SetOneTimeKemSignedPreKeys_FullMethodName = "/org.signal.chat.keys.Keys/SetOneTimeKemSignedPreKeys"
|
|
Keys_SetEcSignedPreKey_FullMethodName = "/org.signal.chat.keys.Keys/SetEcSignedPreKey"
|
|
Keys_SetKemLastResortPreKey_FullMethodName = "/org.signal.chat.keys.Keys/SetKemLastResortPreKey"
|
|
)
|
|
|
|
// KeysClient is the client API for Keys 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.
|
|
//
|
|
// Provides methods for working with pre-keys.
|
|
type KeysClient interface {
|
|
// Retrieves an approximate count of the number of the various kinds of
|
|
// pre-keys stored for the authenticated device.
|
|
GetPreKeyCount(ctx context.Context, in *GetPreKeyCountRequest, opts ...grpc.CallOption) (*GetPreKeyCountResponse, error)
|
|
// Retrieves a set of pre-keys for establishing a session with the targeted
|
|
// device or devices. Note that callers with an unidentified access key for
|
|
// the targeted account should use the version of this method in
|
|
// `KeysAnonymous` instead.
|
|
GetPreKeys(ctx context.Context, in *GetPreKeysRequest, opts ...grpc.CallOption) (*GetPreKeysResponse, error)
|
|
// Uploads a new set of one-time EC pre-keys for the authenticated device,
|
|
// clearing any previously-stored pre-keys. Note that all keys submitted via
|
|
// a single call to this method _must_ have the same identity type (i.e. if
|
|
// the first key has an ACI identity type, then all other keys in the same
|
|
// stream must also have an ACI identity type). The provided list of pre-keys
|
|
// must be non-empty.
|
|
SetOneTimeEcPreKeys(ctx context.Context, in *SetOneTimeEcPreKeysRequest, opts ...grpc.CallOption) (*SetPreKeyResponse, error)
|
|
// Uploads a new set of one-time KEM pre-keys for the authenticated device,
|
|
// clearing any previously-stored pre-keys. Note that all keys submitted via
|
|
// a single call to this method _must_ have the same identity type (i.e. if
|
|
// the first key has an ACI identity type, then all other keys in the same
|
|
// stream must also have an ACI identity type). The provided list of pre-keys
|
|
// must be non-empty.
|
|
SetOneTimeKemSignedPreKeys(ctx context.Context, in *SetOneTimeKemSignedPreKeysRequest, opts ...grpc.CallOption) (*SetPreKeyResponse, error)
|
|
// Sets the signed EC pre-key for one identity (i.e. ACI or PNI) associated
|
|
// with the authenticated device.
|
|
SetEcSignedPreKey(ctx context.Context, in *SetEcSignedPreKeyRequest, opts ...grpc.CallOption) (*SetPreKeyResponse, error)
|
|
// Sets the last-resort KEM pre-key for one identity (i.e. ACI or PNI)
|
|
// associated with the authenticated device.
|
|
SetKemLastResortPreKey(ctx context.Context, in *SetKemLastResortPreKeyRequest, opts ...grpc.CallOption) (*SetPreKeyResponse, error)
|
|
}
|
|
|
|
type keysClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewKeysClient(cc grpc.ClientConnInterface) KeysClient {
|
|
return &keysClient{cc}
|
|
}
|
|
|
|
func (c *keysClient) GetPreKeyCount(ctx context.Context, in *GetPreKeyCountRequest, opts ...grpc.CallOption) (*GetPreKeyCountResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(GetPreKeyCountResponse)
|
|
err := c.cc.Invoke(ctx, Keys_GetPreKeyCount_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *keysClient) GetPreKeys(ctx context.Context, in *GetPreKeysRequest, opts ...grpc.CallOption) (*GetPreKeysResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(GetPreKeysResponse)
|
|
err := c.cc.Invoke(ctx, Keys_GetPreKeys_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *keysClient) SetOneTimeEcPreKeys(ctx context.Context, in *SetOneTimeEcPreKeysRequest, opts ...grpc.CallOption) (*SetPreKeyResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(SetPreKeyResponse)
|
|
err := c.cc.Invoke(ctx, Keys_SetOneTimeEcPreKeys_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *keysClient) SetOneTimeKemSignedPreKeys(ctx context.Context, in *SetOneTimeKemSignedPreKeysRequest, opts ...grpc.CallOption) (*SetPreKeyResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(SetPreKeyResponse)
|
|
err := c.cc.Invoke(ctx, Keys_SetOneTimeKemSignedPreKeys_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *keysClient) SetEcSignedPreKey(ctx context.Context, in *SetEcSignedPreKeyRequest, opts ...grpc.CallOption) (*SetPreKeyResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(SetPreKeyResponse)
|
|
err := c.cc.Invoke(ctx, Keys_SetEcSignedPreKey_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *keysClient) SetKemLastResortPreKey(ctx context.Context, in *SetKemLastResortPreKeyRequest, opts ...grpc.CallOption) (*SetPreKeyResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(SetPreKeyResponse)
|
|
err := c.cc.Invoke(ctx, Keys_SetKemLastResortPreKey_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// KeysServer is the server API for Keys service.
|
|
// All implementations must embed UnimplementedKeysServer
|
|
// for forward compatibility.
|
|
//
|
|
// Provides methods for working with pre-keys.
|
|
type KeysServer interface {
|
|
// Retrieves an approximate count of the number of the various kinds of
|
|
// pre-keys stored for the authenticated device.
|
|
GetPreKeyCount(context.Context, *GetPreKeyCountRequest) (*GetPreKeyCountResponse, error)
|
|
// Retrieves a set of pre-keys for establishing a session with the targeted
|
|
// device or devices. Note that callers with an unidentified access key for
|
|
// the targeted account should use the version of this method in
|
|
// `KeysAnonymous` instead.
|
|
GetPreKeys(context.Context, *GetPreKeysRequest) (*GetPreKeysResponse, error)
|
|
// Uploads a new set of one-time EC pre-keys for the authenticated device,
|
|
// clearing any previously-stored pre-keys. Note that all keys submitted via
|
|
// a single call to this method _must_ have the same identity type (i.e. if
|
|
// the first key has an ACI identity type, then all other keys in the same
|
|
// stream must also have an ACI identity type). The provided list of pre-keys
|
|
// must be non-empty.
|
|
SetOneTimeEcPreKeys(context.Context, *SetOneTimeEcPreKeysRequest) (*SetPreKeyResponse, error)
|
|
// Uploads a new set of one-time KEM pre-keys for the authenticated device,
|
|
// clearing any previously-stored pre-keys. Note that all keys submitted via
|
|
// a single call to this method _must_ have the same identity type (i.e. if
|
|
// the first key has an ACI identity type, then all other keys in the same
|
|
// stream must also have an ACI identity type). The provided list of pre-keys
|
|
// must be non-empty.
|
|
SetOneTimeKemSignedPreKeys(context.Context, *SetOneTimeKemSignedPreKeysRequest) (*SetPreKeyResponse, error)
|
|
// Sets the signed EC pre-key for one identity (i.e. ACI or PNI) associated
|
|
// with the authenticated device.
|
|
SetEcSignedPreKey(context.Context, *SetEcSignedPreKeyRequest) (*SetPreKeyResponse, error)
|
|
// Sets the last-resort KEM pre-key for one identity (i.e. ACI or PNI)
|
|
// associated with the authenticated device.
|
|
SetKemLastResortPreKey(context.Context, *SetKemLastResortPreKeyRequest) (*SetPreKeyResponse, error)
|
|
mustEmbedUnimplementedKeysServer()
|
|
}
|
|
|
|
// UnimplementedKeysServer 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 UnimplementedKeysServer struct{}
|
|
|
|
func (UnimplementedKeysServer) GetPreKeyCount(context.Context, *GetPreKeyCountRequest) (*GetPreKeyCountResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GetPreKeyCount not implemented")
|
|
}
|
|
func (UnimplementedKeysServer) GetPreKeys(context.Context, *GetPreKeysRequest) (*GetPreKeysResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GetPreKeys not implemented")
|
|
}
|
|
func (UnimplementedKeysServer) SetOneTimeEcPreKeys(context.Context, *SetOneTimeEcPreKeysRequest) (*SetPreKeyResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method SetOneTimeEcPreKeys not implemented")
|
|
}
|
|
func (UnimplementedKeysServer) SetOneTimeKemSignedPreKeys(context.Context, *SetOneTimeKemSignedPreKeysRequest) (*SetPreKeyResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method SetOneTimeKemSignedPreKeys not implemented")
|
|
}
|
|
func (UnimplementedKeysServer) SetEcSignedPreKey(context.Context, *SetEcSignedPreKeyRequest) (*SetPreKeyResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method SetEcSignedPreKey not implemented")
|
|
}
|
|
func (UnimplementedKeysServer) SetKemLastResortPreKey(context.Context, *SetKemLastResortPreKeyRequest) (*SetPreKeyResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method SetKemLastResortPreKey not implemented")
|
|
}
|
|
func (UnimplementedKeysServer) mustEmbedUnimplementedKeysServer() {}
|
|
func (UnimplementedKeysServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeKeysServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to KeysServer will
|
|
// result in compilation errors.
|
|
type UnsafeKeysServer interface {
|
|
mustEmbedUnimplementedKeysServer()
|
|
}
|
|
|
|
func RegisterKeysServer(s grpc.ServiceRegistrar, srv KeysServer) {
|
|
// If the following call panics, it indicates UnimplementedKeysServer 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(&Keys_ServiceDesc, srv)
|
|
}
|
|
|
|
func _Keys_GetPreKeyCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GetPreKeyCountRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(KeysServer).GetPreKeyCount(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Keys_GetPreKeyCount_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(KeysServer).GetPreKeyCount(ctx, req.(*GetPreKeyCountRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Keys_GetPreKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GetPreKeysRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(KeysServer).GetPreKeys(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Keys_GetPreKeys_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(KeysServer).GetPreKeys(ctx, req.(*GetPreKeysRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Keys_SetOneTimeEcPreKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(SetOneTimeEcPreKeysRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(KeysServer).SetOneTimeEcPreKeys(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Keys_SetOneTimeEcPreKeys_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(KeysServer).SetOneTimeEcPreKeys(ctx, req.(*SetOneTimeEcPreKeysRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Keys_SetOneTimeKemSignedPreKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(SetOneTimeKemSignedPreKeysRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(KeysServer).SetOneTimeKemSignedPreKeys(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Keys_SetOneTimeKemSignedPreKeys_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(KeysServer).SetOneTimeKemSignedPreKeys(ctx, req.(*SetOneTimeKemSignedPreKeysRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Keys_SetEcSignedPreKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(SetEcSignedPreKeyRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(KeysServer).SetEcSignedPreKey(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Keys_SetEcSignedPreKey_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(KeysServer).SetEcSignedPreKey(ctx, req.(*SetEcSignedPreKeyRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Keys_SetKemLastResortPreKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(SetKemLastResortPreKeyRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(KeysServer).SetKemLastResortPreKey(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Keys_SetKemLastResortPreKey_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(KeysServer).SetKemLastResortPreKey(ctx, req.(*SetKemLastResortPreKeyRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// Keys_ServiceDesc is the grpc.ServiceDesc for Keys service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var Keys_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "org.signal.chat.keys.Keys",
|
|
HandlerType: (*KeysServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "GetPreKeyCount",
|
|
Handler: _Keys_GetPreKeyCount_Handler,
|
|
},
|
|
{
|
|
MethodName: "GetPreKeys",
|
|
Handler: _Keys_GetPreKeys_Handler,
|
|
},
|
|
{
|
|
MethodName: "SetOneTimeEcPreKeys",
|
|
Handler: _Keys_SetOneTimeEcPreKeys_Handler,
|
|
},
|
|
{
|
|
MethodName: "SetOneTimeKemSignedPreKeys",
|
|
Handler: _Keys_SetOneTimeKemSignedPreKeys_Handler,
|
|
},
|
|
{
|
|
MethodName: "SetEcSignedPreKey",
|
|
Handler: _Keys_SetEcSignedPreKey_Handler,
|
|
},
|
|
{
|
|
MethodName: "SetKemLastResortPreKey",
|
|
Handler: _Keys_SetKemLastResortPreKey_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "org/signal/chat/keys.proto",
|
|
}
|
|
|
|
const (
|
|
KeysAnonymous_GetPreKeys_FullMethodName = "/org.signal.chat.keys.KeysAnonymous/GetPreKeys"
|
|
KeysAnonymous_CheckIdentityKeys_FullMethodName = "/org.signal.chat.keys.KeysAnonymous/CheckIdentityKeys"
|
|
)
|
|
|
|
// KeysAnonymousClient is the client API for KeysAnonymous 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.
|
|
//
|
|
// Provides methods for working with pre-keys using "unidentified access"
|
|
// credentials.
|
|
type KeysAnonymousClient interface {
|
|
// Retrieves a set of pre-keys for establishing a session with the targeted
|
|
// device or devices. Callers must not submit any self-identifying credentials
|
|
// when calling this method and must instead present the targeted account's
|
|
// unidentified access key as an anonymous authentication mechanism. Callers
|
|
// without an unidentified access key should use the equivalent, authenticated
|
|
// method in `Keys` instead.
|
|
GetPreKeys(ctx context.Context, in *GetPreKeysAnonymousRequest, opts ...grpc.CallOption) (*GetPreKeysAnonymousResponse, error)
|
|
// Checks identity key fingerprints of the target accounts.
|
|
//
|
|
// Returns a stream of elements, each one representing an account that had a mismatched
|
|
// identity key fingerprint with the server and the corresponding identity key stored by the server.
|
|
CheckIdentityKeys(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[CheckIdentityKeyRequest, CheckIdentityKeyResponse], error)
|
|
}
|
|
|
|
type keysAnonymousClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewKeysAnonymousClient(cc grpc.ClientConnInterface) KeysAnonymousClient {
|
|
return &keysAnonymousClient{cc}
|
|
}
|
|
|
|
func (c *keysAnonymousClient) GetPreKeys(ctx context.Context, in *GetPreKeysAnonymousRequest, opts ...grpc.CallOption) (*GetPreKeysAnonymousResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(GetPreKeysAnonymousResponse)
|
|
err := c.cc.Invoke(ctx, KeysAnonymous_GetPreKeys_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *keysAnonymousClient) CheckIdentityKeys(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[CheckIdentityKeyRequest, CheckIdentityKeyResponse], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &KeysAnonymous_ServiceDesc.Streams[0], KeysAnonymous_CheckIdentityKeys_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[CheckIdentityKeyRequest, CheckIdentityKeyResponse]{ClientStream: stream}
|
|
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 KeysAnonymous_CheckIdentityKeysClient = grpc.BidiStreamingClient[CheckIdentityKeyRequest, CheckIdentityKeyResponse]
|
|
|
|
// KeysAnonymousServer is the server API for KeysAnonymous service.
|
|
// All implementations must embed UnimplementedKeysAnonymousServer
|
|
// for forward compatibility.
|
|
//
|
|
// Provides methods for working with pre-keys using "unidentified access"
|
|
// credentials.
|
|
type KeysAnonymousServer interface {
|
|
// Retrieves a set of pre-keys for establishing a session with the targeted
|
|
// device or devices. Callers must not submit any self-identifying credentials
|
|
// when calling this method and must instead present the targeted account's
|
|
// unidentified access key as an anonymous authentication mechanism. Callers
|
|
// without an unidentified access key should use the equivalent, authenticated
|
|
// method in `Keys` instead.
|
|
GetPreKeys(context.Context, *GetPreKeysAnonymousRequest) (*GetPreKeysAnonymousResponse, error)
|
|
// Checks identity key fingerprints of the target accounts.
|
|
//
|
|
// Returns a stream of elements, each one representing an account that had a mismatched
|
|
// identity key fingerprint with the server and the corresponding identity key stored by the server.
|
|
CheckIdentityKeys(grpc.BidiStreamingServer[CheckIdentityKeyRequest, CheckIdentityKeyResponse]) error
|
|
mustEmbedUnimplementedKeysAnonymousServer()
|
|
}
|
|
|
|
// UnimplementedKeysAnonymousServer 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 UnimplementedKeysAnonymousServer struct{}
|
|
|
|
func (UnimplementedKeysAnonymousServer) GetPreKeys(context.Context, *GetPreKeysAnonymousRequest) (*GetPreKeysAnonymousResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GetPreKeys not implemented")
|
|
}
|
|
func (UnimplementedKeysAnonymousServer) CheckIdentityKeys(grpc.BidiStreamingServer[CheckIdentityKeyRequest, CheckIdentityKeyResponse]) error {
|
|
return status.Error(codes.Unimplemented, "method CheckIdentityKeys not implemented")
|
|
}
|
|
func (UnimplementedKeysAnonymousServer) mustEmbedUnimplementedKeysAnonymousServer() {}
|
|
func (UnimplementedKeysAnonymousServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeKeysAnonymousServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to KeysAnonymousServer will
|
|
// result in compilation errors.
|
|
type UnsafeKeysAnonymousServer interface {
|
|
mustEmbedUnimplementedKeysAnonymousServer()
|
|
}
|
|
|
|
func RegisterKeysAnonymousServer(s grpc.ServiceRegistrar, srv KeysAnonymousServer) {
|
|
// If the following call panics, it indicates UnimplementedKeysAnonymousServer 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(&KeysAnonymous_ServiceDesc, srv)
|
|
}
|
|
|
|
func _KeysAnonymous_GetPreKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GetPreKeysAnonymousRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(KeysAnonymousServer).GetPreKeys(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: KeysAnonymous_GetPreKeys_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(KeysAnonymousServer).GetPreKeys(ctx, req.(*GetPreKeysAnonymousRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _KeysAnonymous_CheckIdentityKeys_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
return srv.(KeysAnonymousServer).CheckIdentityKeys(&grpc.GenericServerStream[CheckIdentityKeyRequest, CheckIdentityKeyResponse]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type KeysAnonymous_CheckIdentityKeysServer = grpc.BidiStreamingServer[CheckIdentityKeyRequest, CheckIdentityKeyResponse]
|
|
|
|
// KeysAnonymous_ServiceDesc is the grpc.ServiceDesc for KeysAnonymous service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var KeysAnonymous_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "org.signal.chat.keys.KeysAnonymous",
|
|
HandlerType: (*KeysAnonymousServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "GetPreKeys",
|
|
Handler: _KeysAnonymous_GetPreKeys_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "CheckIdentityKeys",
|
|
Handler: _KeysAnonymous_CheckIdentityKeys_Handler,
|
|
ServerStreams: true,
|
|
ClientStreams: true,
|
|
},
|
|
},
|
|
Metadata: "org/signal/chat/keys.proto",
|
|
}
|