Documentation ¶
Overview ¶
Package bertyprotocol is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Package bertyprotocol is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Package bertyprotocol contains code for integrating the Berty protocol in your project.
See https://berty.tech/protocol for more information.
Index ¶
- Constants
- Variables
- func ActivateGroupContext(ctx context.Context, gc *groupContext, contact crypto.PubKey) error
- func ConnectAll(t *testing.T, m libp2p_mocknet.Mocknet)
- func ConnectInLine(t *testing.T, m libp2p_mocknet.Mocknet)
- func DefaultOrbitDBOptions(g *protocoltypes.Group, options *orbitdb.CreateDBOptions, ...) (*orbitdb.CreateDBOptions, error)
- func FillMessageKeysHolderUsingNewData(ctx context.Context, gc *groupContext) <-chan crypto.PubKey
- func FillMessageKeysHolderUsingPreviousData(ctx context.Context, gc *groupContext) <-chan crypto.PubKey
- func IssueRandomToken(issuer *AuthTokenIssuer, services map[string]string) (string, error)
- func NewDeviceSecret() (*protocoltypes.DeviceSecret, error)
- func NewGroupMultiMember() (*protocoltypes.Group, crypto.PrivKey, error)
- func NewOrbitDatastoreCache(ds datastore.Batching) cache.Interface
- func NewSimpleAccessController(_ context.Context, _ iface.BaseOrbitDB, params accesscontroller.ManifestParams, ...) (accesscontroller.Interface, error)
- func RegisterPushServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterPushServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PushServiceClient) error
- func RegisterPushServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterPushServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PushServiceServer) error
- func RegisterPushServiceServer(s *grpc.Server, srv PushServiceServer)
- func RegisterReplicationServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterReplicationServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ReplicationServiceClient) error
- func RegisterReplicationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterReplicationServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ReplicationServiceServer) error
- func RegisterReplicationServiceServer(s *grpc.Server, srv ReplicationServiceServer)
- func RestoreAccountExport(ctx context.Context, reader io.Reader, coreAPI ipfs_interface.CoreAPI, ...) error
- func SendSecretsToExistingMembers(ctx context.Context, gctx *groupContext, contact crypto.PubKey) <-chan crypto.PubKey
- func TagGroupContextPeers(ctx context.Context, gc *groupContext, ipfsCoreAPI ipfsutil.ExtendedCoreAPI, ...)
- func WatchNewMembersAndSendSecrets(ctx context.Context, logger *zap.Logger, gctx *groupContext) <-chan crypto.PubKey
- type AccountKeys
- type AuthTokenIssuer
- type AuthTokenOptions
- type AuthTokenServer
- type AuthTokenVerifier
- func (r *AuthTokenVerifier) GRPCAuthInterceptor(serviceID string) func(ctx context.Context) (context.Context, error)
- func (r *AuthTokenVerifier) VerifyCode(code, codeVerifier string) (*protocoltypes.ServicesTokenCode, error)
- func (r *AuthTokenVerifier) VerifyToken(token, serviceID string) (*protocoltypes.ServicesTokenCode, error)
- type BertyOrbitDB
- type BertySignedKeyStore
- func (s *BertySignedKeyStore) CreateKey(id string) (crypto.PrivKey, error)
- func (s *BertySignedKeyStore) GetKey(id string) (crypto.PrivKey, error)
- func (s *BertySignedKeyStore) HasKey(id string) (bool, error)
- func (s *BertySignedKeyStore) SetKey(pk crypto.PrivKey) error
- func (s *BertySignedKeyStore) Sign(privKey crypto.PrivKey, bytes []byte) ([]byte, error)
- func (s *BertySignedKeyStore) Verify(signature []byte, publicKey crypto.PubKey, data []byte) error
- type Client
- func NewClient(ctx context.Context, svc Service, clientOpts []grpc.DialOption, ...) (Client, error)
- func NewClientFromServer(ctx context.Context, s *grpc.Server, svc Service, opts ...grpc.DialOption) (Client, error)
- func TestingClient(ctx context.Context, t *testing.T, svc Service, clientOpts []grpc.DialOption, ...) (client Client, cleanup func())
- func TestingClientFromServer(ctx context.Context, t *testing.T, s *grpc.Server, svc Service, ...) (client Client, cleanup func())
- type ConnectTestingProtocolFunc
- type ContextAuthValue
- type DeviceKeystore
- type EventMetadataReceived
- type GroupDatastore
- func (gd *GroupDatastore) Delete(pk crypto.PubKey) error
- func (gd *GroupDatastore) Get(key crypto.PubKey) (*protocoltypes.Group, error)
- func (gd *GroupDatastore) Has(key crypto.PubKey) (bool, error)
- func (gd *GroupDatastore) Put(g *protocoltypes.Group) error
- func (gd *GroupDatastore) PutForContactPK(pk crypto.PubKey, deviceKeystore DeviceKeystore) error
- type GroupDatastoreReadOnly
- type GroupOpenMode
- type MemberDevice
- type NewOrbitDBOptions
- type Opts
- type OwnMemberDevice
- type PushDispatcher
- type PushHandler
- type PushService
- type PushServiceClient
- type PushServiceServer
- type ReplicationClient
- type ReplicationService
- type ReplicationServiceClient
- type ReplicationServiceServer
- type RestoreAccountHandler
- type Service
- type Status
- type Swiper
- type TestingOpts
- type TestingProtocol
- type TestingReplicationPeer
- type UnimplementedPushServiceServer
- func (*UnimplementedPushServiceServer) Send(ctx context.Context, req *protocoltypes.PushServiceSend_Request) (*protocoltypes.PushServiceSend_Reply, error)
- func (*UnimplementedPushServiceServer) ServerInfo(ctx context.Context, req *protocoltypes.PushServiceServerInfo_Request) (*protocoltypes.PushServiceServerInfo_Reply, error)
- type UnimplementedReplicationServiceServer
Examples ¶
Constants ¶
const ( AuthResponseType = "code" AuthGrantType = "authorization_code" AuthRedirect = "berty://services-auth/" AuthClientID = "berty" AuthCodeChallengeMethod = "S256" )
const ( NamespaceMessageKeystore = "messages_keystore" NamespaceDeviceKeystore = "device_keystore" NamespaceOrbitDBDatastore = "orbitdb_datastore" NamespaceOrbitDBDirectory = "orbitdb" NamespaceIPFSDatastore = "ipfs_datastore" NamespaceGroupDatastore = "account_groups_datastore" NamespaceAccountCacheDatastore = "account_cache_datastore" AccountCacheDatastorePushServerPK = "push_server_public_key" )
const ( ContextTokenHashField ContextAuthValue = iota AuthHTTPPathTokenExchange = "/oauth/token" // nolint:gosec AuthHTTPPathAuthorize = "/authorize" )
const ( ServicePushID = "psh" ServicePushPayloadKey = "p" ServicePushPayloadMax = 4096 // FIXME: find an appropriate value )
const ( TyberEventTinderPeerFound = "Tinder peer found" TyberEventTinderPeerJoined = "Tinder peer joined" TyberEventTinderPeerLeft = "Tinder peer left" )
const ClientBufferSize = 4 * 1024 * 1024
const CurrentGroupVersion = 1
const (
ServiceReplicationID = "rpl"
)
Variables ¶
var InMemoryDirectory = cacheleveldown.InMemoryDirectory
Functions ¶
func ActivateGroupContext ¶
func ConnectAll ¶ added in v2.39.0
func ConnectAll(t *testing.T, m libp2p_mocknet.Mocknet)
ConnectAll peers between themselves
func ConnectInLine ¶ added in v2.39.0
func ConnectInLine(t *testing.T, m libp2p_mocknet.Mocknet)
func DefaultOrbitDBOptions ¶ added in v2.32.1
func DefaultOrbitDBOptions(g *protocoltypes.Group, options *orbitdb.CreateDBOptions, keystore *BertySignedKeyStore, storeType string, groupOpenMode GroupOpenMode) (*orbitdb.CreateDBOptions, error)
func IssueRandomToken ¶ added in v2.305.0
func IssueRandomToken(issuer *AuthTokenIssuer, services map[string]string) (string, error)
func NewDeviceSecret ¶
func NewDeviceSecret() (*protocoltypes.DeviceSecret, error)
func NewGroupMultiMember ¶
func NewGroupMultiMember() (*protocoltypes.Group, crypto.PrivKey, error)
NewGroupMultiMember creates a new Group object and an invitation to be used by the first member of the group
func NewOrbitDatastoreCache ¶ added in v2.32.1
func NewSimpleAccessController ¶ added in v2.32.1
func NewSimpleAccessController(_ context.Context, _ iface.BaseOrbitDB, params accesscontroller.ManifestParams, options ...accesscontroller.Option) (accesscontroller.Interface, error)
NewSimpleAccessController Returns a non configurable access controller
func RegisterPushServiceHandler ¶ added in v2.305.0
func RegisterPushServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterPushServiceHandler registers the http handlers for service PushService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterPushServiceHandlerClient ¶ added in v2.305.0
func RegisterPushServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PushServiceClient) error
RegisterPushServiceHandlerClient registers the http handlers for service PushService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PushServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PushServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "PushServiceClient" to call the correct interceptors.
func RegisterPushServiceHandlerFromEndpoint ¶ added in v2.305.0
func RegisterPushServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterPushServiceHandlerFromEndpoint is same as RegisterPushServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterPushServiceHandlerServer ¶ added in v2.305.0
func RegisterPushServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PushServiceServer) error
RegisterPushServiceHandlerServer registers the http handlers for service PushService to "mux". UnaryRPC :call PushServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPushServiceHandlerFromEndpoint instead.
func RegisterPushServiceServer ¶ added in v2.305.0
func RegisterPushServiceServer(s *grpc.Server, srv PushServiceServer)
func RegisterReplicationServiceHandler ¶ added in v2.146.0
func RegisterReplicationServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterReplicationServiceHandler registers the http handlers for service ReplicationService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterReplicationServiceHandlerClient ¶ added in v2.146.0
func RegisterReplicationServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ReplicationServiceClient) error
RegisterReplicationServiceHandlerClient registers the http handlers for service ReplicationService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ReplicationServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ReplicationServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ReplicationServiceClient" to call the correct interceptors.
func RegisterReplicationServiceHandlerFromEndpoint ¶ added in v2.146.0
func RegisterReplicationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterReplicationServiceHandlerFromEndpoint is same as RegisterReplicationServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterReplicationServiceHandlerServer ¶ added in v2.146.0
func RegisterReplicationServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ReplicationServiceServer) error
RegisterReplicationServiceHandlerServer registers the http handlers for service ReplicationService to "mux". UnaryRPC :call ReplicationServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterReplicationServiceHandlerFromEndpoint instead.
func RegisterReplicationServiceServer ¶ added in v2.146.0
func RegisterReplicationServiceServer(s *grpc.Server, srv ReplicationServiceServer)
func RestoreAccountExport ¶ added in v2.189.0
func RestoreAccountExport(ctx context.Context, reader io.Reader, coreAPI ipfs_interface.CoreAPI, odb *BertyOrbitDB, logger *zap.Logger, handlers ...RestoreAccountHandler) error
func TagGroupContextPeers ¶ added in v2.184.0
func TagGroupContextPeers(ctx context.Context, gc *groupContext, ipfsCoreAPI ipfsutil.ExtendedCoreAPI, weight int)
Types ¶
type AccountKeys ¶
type AuthTokenIssuer ¶ added in v2.136.0
type AuthTokenIssuer struct { *AuthTokenVerifier // contains filtered or unexported fields }
func NewAuthTokenIssuer ¶ added in v2.136.0
func NewAuthTokenIssuer(secret []byte, sk ed25519.PrivateKey) (*AuthTokenIssuer, error)
func (*AuthTokenIssuer) IssueCode ¶ added in v2.136.0
func (r *AuthTokenIssuer) IssueCode(codeChallenge string, services []string) (string, error)
func (*AuthTokenIssuer) IssueToken ¶ added in v2.136.0
func (r *AuthTokenIssuer) IssueToken(services []string) (string, error)
type AuthTokenOptions ¶ added in v2.274.0
type AuthTokenServer ¶ added in v2.136.0
type AuthTokenServer struct {
// contains filtered or unexported fields
}
func NewAuthTokenServer ¶ added in v2.136.0
func NewAuthTokenServer(secret []byte, sk ed25519.PrivateKey, services map[string]string, opts *AuthTokenOptions) (*AuthTokenServer, error)
func (*AuthTokenServer) IssueRandomTokenForServices ¶ added in v2.274.0
func (a *AuthTokenServer) IssueRandomTokenForServices() (string, error)
func (*AuthTokenServer) ServeHTTP ¶ added in v2.136.0
func (a *AuthTokenServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type AuthTokenVerifier ¶ added in v2.136.0
type AuthTokenVerifier struct {
// contains filtered or unexported fields
}
func NewAuthTokenVerifier ¶ added in v2.136.0
func NewAuthTokenVerifier(secret []byte, pk ed25519.PublicKey) (*AuthTokenVerifier, error)
func (*AuthTokenVerifier) GRPCAuthInterceptor ¶ added in v2.136.0
func (*AuthTokenVerifier) VerifyCode ¶ added in v2.136.0
func (r *AuthTokenVerifier) VerifyCode(code, codeVerifier string) (*protocoltypes.ServicesTokenCode, error)
func (*AuthTokenVerifier) VerifyToken ¶ added in v2.136.0
func (r *AuthTokenVerifier) VerifyToken(token, serviceID string) (*protocoltypes.ServicesTokenCode, error)
type BertyOrbitDB ¶
type BertyOrbitDB struct { baseorbitdb.BaseOrbitDB // contains filtered or unexported fields }
func NewBertyOrbitDB ¶ added in v2.141.0
func NewBertyOrbitDB(ctx context.Context, ipfs coreapi.CoreAPI, options *NewOrbitDBOptions) (*BertyOrbitDB, error)
func (*BertyOrbitDB) SetGroupSigPubKey ¶ added in v2.141.0
func (s *BertyOrbitDB) SetGroupSigPubKey(groupID string, pubKey crypto.PubKey) error
SetGroupSigPubKey registers a new group signature pubkey, mainly used to replicate a store data without needing to access to its content
type BertySignedKeyStore ¶ added in v2.32.1
func (*BertySignedKeyStore) CreateKey ¶ added in v2.32.1
func (s *BertySignedKeyStore) CreateKey(id string) (crypto.PrivKey, error)
func (*BertySignedKeyStore) GetKey ¶ added in v2.32.1
func (s *BertySignedKeyStore) GetKey(id string) (crypto.PrivKey, error)
func (*BertySignedKeyStore) HasKey ¶ added in v2.32.1
func (s *BertySignedKeyStore) HasKey(id string) (bool, error)
func (*BertySignedKeyStore) SetKey ¶ added in v2.32.1
func (s *BertySignedKeyStore) SetKey(pk crypto.PrivKey) error
type Client ¶
type Client interface { protocoltypes.ProtocolServiceClient Close() error }
func NewClient ¶ added in v2.39.0
func NewClient(ctx context.Context, svc Service, clientOpts []grpc.DialOption, serverOpts []grpc.ServerOption) (Client, error)
func NewClientFromServer ¶ added in v2.39.0
func TestingClient ¶
func TestingClient(ctx context.Context, t *testing.T, svc Service, clientOpts []grpc.DialOption, serverOpts []grpc.ServerOption) (client Client, cleanup func())
type ConnectTestingProtocolFunc ¶ added in v2.266.2
type ConnectTestingProtocolFunc func(*testing.T, libp2p_mocknet.Mocknet)
Connect Peers Helper
type ContextAuthValue ¶ added in v2.136.0
type ContextAuthValue uint32
type DeviceKeystore ¶ added in v2.32.1
type DeviceKeystore interface { AccountPrivKey() (crypto.PrivKey, error) AccountProofPrivKey() (crypto.PrivKey, error) DevicePrivKey() (crypto.PrivKey, error) ContactGroupPrivKey(pk crypto.PubKey) (crypto.PrivKey, error) MemberDeviceForGroup(g *protocoltypes.Group) (*ownMemberDevice, error) RestoreAccountKeys(accountKey crypto.PrivKey, accountProofKey crypto.PrivKey) error AttachmentPrivKey(cid []byte) (crypto.PrivKey, error) AttachmentPrivKeyPut(cid []byte, sk crypto.PrivKey) error AttachmentSecret(cid []byte) ([]byte, error) AttachmentSecretPut(cid []byte, secret []byte) error AttachmentSecretSlice(cids [][]byte) ([][]byte, error) AttachmentSecretSlicePut(cids, secrets [][]byte) error }
func NewDeviceKeystore ¶ added in v2.32.1
func NewDeviceKeystore(ks keystore.Keystore) DeviceKeystore
New creates a new deviceKeystore instance, if the keystore does not hold an deviceKeystore key, one will be created when required
func NewWithExistingKeys ¶ added in v2.32.1
func NewWithExistingKeys(ks keystore.Keystore, sk crypto.PrivKey, proofSK crypto.PrivKey) (DeviceKeystore, error)
NewWithExistingKeys creates a new deviceKeystore instance and registers the supplied secret key, useful when migrating deviceKeystore to another device
type EventMetadataReceived ¶ added in v2.66.1
type EventMetadataReceived struct { MetaEvent *protocoltypes.GroupMetadataEvent Event proto.Message }
type GroupDatastore ¶ added in v2.305.0
type GroupDatastore struct {
// contains filtered or unexported fields
}
func NewGroupDatastore ¶ added in v2.305.0
func NewGroupDatastore(ds datastore.Datastore) (*GroupDatastore, error)
func (*GroupDatastore) Delete ¶ added in v2.305.0
func (gd *GroupDatastore) Delete(pk crypto.PubKey) error
func (*GroupDatastore) Get ¶ added in v2.305.0
func (gd *GroupDatastore) Get(key crypto.PubKey) (*protocoltypes.Group, error)
func (*GroupDatastore) Has ¶ added in v2.305.0
func (gd *GroupDatastore) Has(key crypto.PubKey) (bool, error)
func (*GroupDatastore) Put ¶ added in v2.305.0
func (gd *GroupDatastore) Put(g *protocoltypes.Group) error
func (*GroupDatastore) PutForContactPK ¶ added in v2.305.0
func (gd *GroupDatastore) PutForContactPK(pk crypto.PubKey, deviceKeystore DeviceKeystore) error
type GroupDatastoreReadOnly ¶ added in v2.305.0
type GroupOpenMode ¶ added in v2.146.0
type GroupOpenMode uint64
const ( GroupOpenModeUndefined GroupOpenMode = iota GroupOpenModeReplicate GroupOpenModeWrite )
type MemberDevice ¶
type MemberDevice struct { Member crypto.PubKey Device crypto.PubKey Secret *protocoltypes.DeviceSecret }
MemberDevice is a remote device part of a group
type NewOrbitDBOptions ¶ added in v2.141.0
type NewOrbitDBOptions struct { baseorbitdb.NewOrbitDBOptions Datastore datastore.Batching MessageKeystore *messageKeystore DeviceKeystore DeviceKeystore }
type Opts ¶
type Opts struct { Logger *zap.Logger IpfsCoreAPI ipfsutil.ExtendedCoreAPI DeviceKeystore DeviceKeystore DatastoreDir string RootDatastore ds.Batching GroupDatastore *GroupDatastore AccountCache ds.Batching MessageKeystore *messageKeystore OrbitDB *BertyOrbitDB TinderDriver tinder.UnregisterDiscovery RendezvousRotationBase time.Duration Host host.Host PubSub *pubsub.PubSub LocalOnly bool PushKey *[cryptoutil.KeySize]byte // contains filtered or unexported fields }
Opts contains optional configuration flags for building a new Client
type OwnMemberDevice ¶
OwnMemberDevice is own local device part of a group
func (*OwnMemberDevice) Public ¶
func (d *OwnMemberDevice) Public() *MemberDevice
type PushDispatcher ¶ added in v2.305.0
type PushDispatcher interface { Dispatch(payload []byte, receiver *protocoltypes.PushServiceReceiver) error BundleID() string TokenType() protocoltypes.PushServiceTokenType }
func PushDispatcherLoadAPNSCertificates ¶ added in v2.305.0
func PushDispatcherLoadAPNSCertificates(input *string) ([]PushDispatcher, error)
func PushDispatcherLoadFirebaseAPIKey ¶ added in v2.305.0
func PushDispatcherLoadFirebaseAPIKey(input *string) ([]PushDispatcher, error)
type PushHandler ¶ added in v2.305.0
type PushHandler interface {
PushReceive(payload []byte) (*protocoltypes.PushReceive_Reply, error)
}
func NewPushHandler ¶ added in v2.305.0
func NewPushHandler(opts *Opts) (PushHandler, error)
type PushService ¶ added in v2.305.0
type PushService interface { PushServiceServer Close() error }
func NewPushService ¶ added in v2.305.0
func NewPushService(privateKey *[cryptoutil.KeySize]byte, dispatchers []PushDispatcher, logger *zap.Logger) (PushService, error)
func PushServerForTests ¶ added in v2.305.0
func PushServerForTests(ctx context.Context, t testing.TB, dispatchers []PushDispatcher, logger *zap.Logger) (PushService, *[32]byte, string, context.CancelFunc)
type PushServiceClient ¶ added in v2.305.0
type PushServiceClient interface { // ServerInfo retrieves metadata about the current push service ServerInfo(ctx context.Context, in *protocoltypes.PushServiceServerInfo_Request, opts ...grpc.CallOption) (*protocoltypes.PushServiceServerInfo_Reply, error) // Send dispatch a push payload to one or multiple recipients Send(ctx context.Context, in *protocoltypes.PushServiceSend_Request, opts ...grpc.CallOption) (*protocoltypes.PushServiceSend_Reply, error) }
PushServiceClient is the client API for PushService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewPushServiceClient ¶ added in v2.305.0
func NewPushServiceClient(cc *grpc.ClientConn) PushServiceClient
type PushServiceServer ¶ added in v2.305.0
type PushServiceServer interface { // ServerInfo retrieves metadata about the current push service ServerInfo(context.Context, *protocoltypes.PushServiceServerInfo_Request) (*protocoltypes.PushServiceServerInfo_Reply, error) // Send dispatch a push payload to one or multiple recipients Send(context.Context, *protocoltypes.PushServiceSend_Request) (*protocoltypes.PushServiceSend_Reply, error) }
PushServiceServer is the server API for PushService service.
type ReplicationClient ¶ added in v2.146.0
type ReplicationClient interface { ReplicationServiceClient Close() error }
type ReplicationService ¶ added in v2.146.0
type ReplicationService interface { ReplicationServiceServer Close() error }
Service is the main Berty Protocol interface
func NewReplicationService ¶ added in v2.146.0
func NewReplicationService(ctx context.Context, store ds.Datastore, odb *BertyOrbitDB, logger *zap.Logger) (ReplicationService, error)
type ReplicationServiceClient ¶ added in v2.146.0
type ReplicationServiceClient interface { // ReplicateGroup ReplicateGroup(ctx context.Context, in *protocoltypes.ReplicationServiceReplicateGroup_Request, opts ...grpc.CallOption) (*protocoltypes.ReplicationServiceReplicateGroup_Reply, error) }
ReplicationServiceClient is the client API for ReplicationService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewReplicationServiceClient ¶ added in v2.146.0
func NewReplicationServiceClient(cc *grpc.ClientConn) ReplicationServiceClient
type ReplicationServiceServer ¶ added in v2.146.0
type ReplicationServiceServer interface { // ReplicateGroup ReplicateGroup(context.Context, *protocoltypes.ReplicationServiceReplicateGroup_Request) (*protocoltypes.ReplicationServiceReplicateGroup_Reply, error) }
ReplicationServiceServer is the server API for ReplicationService service.
type RestoreAccountHandler ¶ added in v2.200.0
type Service ¶ added in v2.35.0
type Service interface { protocoltypes.ProtocolServiceServer Close() error Status() Status IpfsCoreAPI() ipfs_interface.CoreAPI }
Service is the main Berty Protocol interface
func New ¶
New initializes a new Service
Example (Basic) ¶
package main import ( "context" "fmt" "berty.tech/berty/v2/go/pkg/bertyprotocol" "berty.tech/berty/v2/go/pkg/protocoltypes" ) func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() client, err := bertyprotocol.New(ctx, bertyprotocol.Opts{}) if err != nil { panic(err) } ret, err := client.InstanceGetConfiguration(ctx, &protocoltypes.InstanceGetConfiguration_Request{}) if err != nil { panic(err) } for _, listener := range ret.Listeners { if listener == "/p2p-circuit" { fmt.Println(listener) } } }
Output: /p2p-circuit
type Swiper ¶ added in v2.109.0
type Swiper struct {
// contains filtered or unexported fields
}
type TestingOpts ¶ added in v2.39.0
type TestingOpts struct { Logger *zap.Logger Mocknet libp2p_mocknet.Mocknet RDVPeer peer.AddrInfo DeviceKeystore DeviceKeystore CoreAPIMock ipfsutil.CoreAPIMock OrbitDB *BertyOrbitDB ConnectFunc ConnectTestingProtocolFunc }
type TestingProtocol ¶ added in v2.39.0
func NewTestingProtocol ¶ added in v2.39.0
func NewTestingProtocol(ctx context.Context, t *testing.T, opts *TestingOpts, ds datastore.Batching) (*TestingProtocol, func())
func NewTestingProtocolWithMockedPeers ¶ added in v2.122.0
func NewTestingProtocolWithMockedPeers(ctx context.Context, t *testing.T, opts *TestingOpts, ds datastore.Batching, amount int) ([]*TestingProtocol, func())
type TestingReplicationPeer ¶ added in v2.146.0
type TestingReplicationPeer struct {
Service ReplicationService
}
func NewReplicationMockedPeer ¶ added in v2.146.0
func NewReplicationMockedPeer(ctx context.Context, t *testing.T, secret []byte, sk ed25519.PublicKey, opts *TestingOpts) (*TestingReplicationPeer, func())
type UnimplementedPushServiceServer ¶ added in v2.305.0
type UnimplementedPushServiceServer struct{}
UnimplementedPushServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedPushServiceServer) Send ¶ added in v2.305.0
func (*UnimplementedPushServiceServer) Send(ctx context.Context, req *protocoltypes.PushServiceSend_Request) (*protocoltypes.PushServiceSend_Reply, error)
func (*UnimplementedPushServiceServer) ServerInfo ¶ added in v2.305.0
func (*UnimplementedPushServiceServer) ServerInfo(ctx context.Context, req *protocoltypes.PushServiceServerInfo_Request) (*protocoltypes.PushServiceServerInfo_Reply, error)
type UnimplementedReplicationServiceServer ¶ added in v2.146.0
type UnimplementedReplicationServiceServer struct{}
UnimplementedReplicationServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedReplicationServiceServer) ReplicateGroup ¶ added in v2.146.0
func (*UnimplementedReplicationServiceServer) ReplicateGroup(ctx context.Context, req *protocoltypes.ReplicationServiceReplicateGroup_Request) (*protocoltypes.ReplicationServiceReplicateGroup_Reply, error)
Source Files ¶
- account_export.go
- api_app.go
- api_attachment.go
- api_client.go
- api_contact.go
- api_contactrequest.go
- api_debug.go
- api_event.go
- api_group.go
- api_multimember.go
- api_push.go
- api_replication.go
- api_services_auth.go
- attachment_crypto.go
- attachment_utils.go
- bertypush.pb.go
- bertypush.pb.gw.go
- bertyreplication.pb.go
- bertyreplication.pb.gw.go
- client.go
- consts.go
- contact_request_manager.go
- doc.go
- events.go
- events_sig_checkers.go
- group.go
- group_context.go
- group_store.go
- iface_account.go
- keystore_device.go
- keystore_message.go
- keystore_message_utils.go
- orbitdb.go
- orbitdb_datastore_cache.go
- orbitdb_signed_entry_accesscontroller.go
- orbitdb_signed_entry_identity_provider.go
- orbitdb_signed_entry_keystore.go
- push_handler.go
- service.go
- service_group.go
- services_auth.go
- services_auth_server.go
- services_auth_templates.go
- services_push.go
- services_push_apns.go
- services_push_fcm.go
- services_replication.go
- store_message.go
- store_metadata.go
- store_metadata_index.go
- store_options.go
- store_utils.go
- testing.go
- tinder_swiper.go
- tyber.go