Documentation ¶
Overview ¶
Package bertyprotocol contains code for integrating the Berty protocol in your project.
See https://berty.tech/protocol for more information.
Index ¶
- Constants
- Variables
- func ConnectAll(t testing.TB, m libp2p_mocknet.Mocknet)
- func ConnectInLine(t testing.TB, m libp2p_mocknet.Mocknet)
- func CreatePeersWithGroupTest(ctx context.Context, t testing.TB, pathBase string, memberCount int, ...) ([]*mockedPeer, crypto.PrivKey, func())
- func DefaultOrbitDBOptions(g *protocoltypes.Group, options *orbitdb.CreateDBOptions, ...) (*orbitdb.CreateDBOptions, error)
- func FilterGroupForReplication(m *protocoltypes.Group) (*protocoltypes.Group, error)
- func MetadataStoreAddDeviceToGroup(ctx context.Context, m *MetadataStore, g *protocoltypes.Group, ...) (operation.Operation, error)
- func MetadataStoreSendSecret(ctx context.Context, m *MetadataStore, g *protocoltypes.Group, ...) (operation.Operation, 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 PushSealTokenForServer(receiver *protocoltypes.PushServiceReceiver, server *protocoltypes.PushServer) (*protocoltypes.PushMemberTokenUpdate, error)
- func RestoreAccountExport(ctx context.Context, reader io.Reader, coreAPI ipfs_interface.CoreAPI, ...) error
- func SealOutOfStoreMessageEnvelope(id cid.Cid, env *protocoltypes.MessageEnvelope, ...) (*pushtypes.OutOfStoreMessageEnvelope, error)
- type AccountContact
- type AccountKeys
- type BertyOrbitDB
- func (s *BertyOrbitDB) GetDevicePKForPeerID(id peer.ID) (pdg *PeerDeviceGroup, ok bool)
- func (s *BertyOrbitDB) IsGroupLoaded(groupID string) bool
- func (s *BertyOrbitDB) OpenGroup(ctx context.Context, g *protocoltypes.Group, options *orbitdb.CreateDBOptions) (*GroupContext, error)
- func (s *BertyOrbitDB) OpenGroupReplication(ctx context.Context, g *protocoltypes.Group, options *orbitdb.CreateDBOptions) (iface.Store, iface.Store, error)
- func (s *BertyOrbitDB) SetGroupSigPubKey(groupID string, pubKey crypto.PubKey) error
- type BertySignedKeyStore
- func (s *BertySignedKeyStore) CreateKey(ctx context.Context, id string) (crypto.PrivKey, error)
- func (s *BertySignedKeyStore) GetKey(ctx context.Context, id string) (crypto.PrivKey, error)
- func (s *BertySignedKeyStore) HasKey(ctx context.Context, 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.TB, svc Service, clientOpts []grpc.DialOption, ...) (client Client, cleanup func())
- func TestingClientFromServer(ctx context.Context, t testing.TB, s *grpc.Server, svc Service, ...) (client Client, cleanup func())
- type ConnectTestingProtocolFunc
- type ConnectednessManager
- type ConnectednessType
- type ConnectednessUpdate
- type EventMetadataReceived
- type GroupContext
- func (gc *GroupContext) ActivateGroupContext(contact crypto.PubKey) error
- func (gc *GroupContext) Close() error
- func (gc *GroupContext) DevicePubKey() crypto.PubKey
- func (gc *GroupContext) FillMessageKeysHolderUsingNewData() <-chan crypto.PubKey
- func (gc *GroupContext) FillMessageKeysHolderUsingPreviousData() <-chan crypto.PubKey
- func (gc *GroupContext) Group() *protocoltypes.Group
- func (gc *GroupContext) IsClosed() bool
- func (gc *GroupContext) MemberPubKey() crypto.PubKey
- func (gc *GroupContext) MessageKeystore() *cryptoutil.MessageKeystore
- func (gc *GroupContext) MessageStore() *MessageStore
- func (gc *GroupContext) MetadataStore() *MetadataStore
- func (gc *GroupContext) SendSecretsToExistingMembers(contact crypto.PubKey) <-chan crypto.PubKey
- func (gc *GroupContext) TagGroupContextPeers(ipfsCoreAPI ipfsutil.ExtendedCoreAPI, weight int)
- func (gc *GroupContext) WatchNewMembersAndSendSecrets() <-chan crypto.PubKey
- type GroupContextMap
- type GroupMap
- type GroupOpenMode
- type GroupStatus
- type GroupsSigPubKeyMap
- type MemberDevice
- type MessageStore
- func (m *MessageStore) AddMessage(ctx context.Context, payload []byte) (operation.Operation, error)
- func (m *MessageStore) CacheSizeForDevicePK(devicePK []byte) (size int, ok bool)
- func (m *MessageStore) Close() error
- func (m *MessageStore) GetMessageByCID(c cid.Cid) (*protocoltypes.MessageEnvelope, *protocoltypes.MessageHeaders, error)
- func (m *MessageStore) GetOutOfStoreMessageEnvelope(ctx context.Context, c cid.Cid) (*pushtypes.OutOfStoreMessageEnvelope, error)
- func (m *MessageStore) ListEvents(ctx context.Context, since, until []byte, reverse bool) (<-chan *protocoltypes.GroupMessageEvent, error)
- func (m *MessageStore) ProcessMessageQueueForDevicePK(ctx context.Context, devicePK []byte)
- type MetadataStore
- func (m *MetadataStore) AddDeviceToGroup(ctx context.Context) (operation.Operation, error)
- func (m *MetadataStore) ClaimGroupOwnership(ctx context.Context, groupSK crypto.PrivKey) (operation.Operation, error)
- func (m *MetadataStore) Close() error
- func (m *MetadataStore) ContactBlock(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
- func (m *MetadataStore) ContactRequestDisable(ctx context.Context) (operation.Operation, error)
- func (m *MetadataStore) ContactRequestEnable(ctx context.Context) (operation.Operation, error)
- func (m *MetadataStore) ContactRequestIncomingAccept(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
- func (m *MetadataStore) ContactRequestIncomingDiscard(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
- func (m *MetadataStore) ContactRequestIncomingReceived(ctx context.Context, contact *protocoltypes.ShareableContact) (operation.Operation, error)
- func (m *MetadataStore) ContactRequestOutgoingEnqueue(ctx context.Context, contact *protocoltypes.ShareableContact, ...) (operation.Operation, error)
- func (m *MetadataStore) ContactRequestOutgoingSent(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
- func (m *MetadataStore) ContactRequestReferenceReset(ctx context.Context) (operation.Operation, error)
- func (m *MetadataStore) ContactSendAliasKey(ctx context.Context) (operation.Operation, error)
- func (m *MetadataStore) ContactUnblock(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
- func (m *MetadataStore) DevicePK() (crypto.PubKey, error)
- func (m *MetadataStore) GetContactFromGroupPK(groupPK []byte) *protocoltypes.ShareableContact
- func (m *MetadataStore) GetDevicesForMember(pk crypto.PubKey) ([]crypto.PubKey, error)
- func (m *MetadataStore) GetIncomingContactRequestsStatus() (bool, *protocoltypes.ShareableContact)
- func (m *MetadataStore) GetMemberByDevice(pk crypto.PubKey) (crypto.PubKey, error)
- func (m *MetadataStore) GetPushTokenForDevice(d crypto.PubKey) (*protocoltypes.PushMemberTokenUpdate, error)
- func (m *MetadataStore) GetRequestOwnMetadataForContact(pk []byte) ([]byte, error)
- func (m *MetadataStore) Group() *protocoltypes.Group
- func (m *MetadataStore) GroupJoin(ctx context.Context, g *protocoltypes.Group) (operation.Operation, error)
- func (m *MetadataStore) GroupLeave(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
- func (m *MetadataStore) ListAdmins() []crypto.PubKey
- func (m *MetadataStore) ListContacts() map[string]*AccountContact
- func (m *MetadataStore) ListContactsByStatus(states ...protocoltypes.ContactState) []*protocoltypes.ShareableContact
- func (m *MetadataStore) ListDevices() []crypto.PubKey
- func (m *MetadataStore) ListEvents(ctx context.Context, since, until []byte, reverse bool) (<-chan *protocoltypes.GroupMetadataEvent, error)
- func (m *MetadataStore) ListMembers() []crypto.PubKey
- func (m *MetadataStore) ListMultiMemberGroups() []*protocoltypes.Group
- func (m *MetadataStore) ListOtherMembersDevices() []crypto.PubKey
- func (m *MetadataStore) ListVerifiedCredentials() []*protocoltypes.AccountVerifiedCredentialRegistered
- func (m *MetadataStore) MemberPK() (crypto.PubKey, error)
- func (m *MetadataStore) RegisterDevicePushServer(ctx context.Context, server *protocoltypes.PushServer) (operation.Operation, error)
- func (m *MetadataStore) RegisterDevicePushToken(ctx context.Context, token *protocoltypes.PushServiceReceiver) (operation.Operation, error)
- func (m *MetadataStore) SendAccountServiceTokenAdded(ctx context.Context, token *protocoltypes.ServiceToken) (operation.Operation, error)
- func (m *MetadataStore) SendAccountServiceTokenRemoved(ctx context.Context, tokenID string) (operation.Operation, error)
- func (m *MetadataStore) SendAccountVerifiedCredentialAdded(ctx context.Context, token *protocoltypes.AccountVerifiedCredentialRegistered) (operation.Operation, error)
- func (m *MetadataStore) SendAliasProof(ctx context.Context) (operation.Operation, error)
- func (m *MetadataStore) SendAppMetadata(ctx context.Context, message []byte) (operation.Operation, error)
- func (m *MetadataStore) SendGroupReplicating(ctx context.Context, t *protocoltypes.ServiceToken, endpoint string) (operation.Operation, error)
- func (m *MetadataStore) SendPushToken(ctx context.Context, t *protocoltypes.PushMemberTokenUpdate) (operation.Operation, error)
- func (m *MetadataStore) SendSecret(ctx context.Context, memberPK crypto.PubKey) (operation.Operation, error)
- type NewOrbitDBOptions
- type Opts
- type OrbitDBMessageMarshaler
- func (m *OrbitDBMessageMarshaler) GetDevicePKForPeerID(id peer.ID) (pdg *PeerDeviceGroup, ok bool)
- func (m *OrbitDBMessageMarshaler) Marshal(msg *iface.MessageExchangeHeads) ([]byte, error)
- func (m *OrbitDBMessageMarshaler) RegisterGroup(sid string, group *protocoltypes.Group)
- func (m *OrbitDBMessageMarshaler) RegisterSharedKeyForTopic(topic string, sk enc.SharedKey)
- func (m *OrbitDBMessageMarshaler) Unmarshal(payload []byte, msg *iface.MessageExchangeHeads) error
- type PeerDeviceGroup
- type PeerStatus
- type PeersConnectedness
- type RestoreAccountHandler
- type Service
- type Status
- type Swiper
- type TestingOpts
- type TestingProtocol
Examples ¶
Constants ¶
const ( NamespaceDeviceKeystore = "device_keystore" NamespaceOrbitDBDatastore = "orbitdb_datastore" NamespaceOrbitDBDirectory = "orbitdb" NamespaceIPFSDatastore = "ipfs_datastore" )
const ( TyberEventTinderPeerFound = "Tinder peer found" TyberEventTinderPeerJoined = "Tinder peer joined" TyberEventTinderPeerLeft = "Tinder peer left" )
const ClientBufferSize = 4 * 1024 * 1024
const CurrentGroupVersion = 1
Variables ¶
var InMemoryDirectory = cacheleveldown.InMemoryDirectory
Functions ¶
func ConnectAll ¶ added in v2.39.0
func ConnectAll(t testing.TB, m libp2p_mocknet.Mocknet)
ConnectAll peers between themselves
func ConnectInLine ¶ added in v2.39.0
func ConnectInLine(t testing.TB, m libp2p_mocknet.Mocknet)
func CreatePeersWithGroupTest ¶ added in v2.308.0
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 FilterGroupForReplication ¶ added in v2.318.0
func FilterGroupForReplication(m *protocoltypes.Group) (*protocoltypes.Group, error)
func MetadataStoreAddDeviceToGroup ¶ added in v2.308.0
func MetadataStoreAddDeviceToGroup(ctx context.Context, m *MetadataStore, g *protocoltypes.Group, md *cryptoutil.OwnMemberDevice) (operation.Operation, error)
func MetadataStoreSendSecret ¶ added in v2.308.0
func MetadataStoreSendSecret(ctx context.Context, m *MetadataStore, g *protocoltypes.Group, md *cryptoutil.OwnMemberDevice, memberPK crypto.PubKey, ds *protocoltypes.DeviceSecret) (operation.Operation, 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 PushSealTokenForServer ¶ added in v2.308.0
func PushSealTokenForServer(receiver *protocoltypes.PushServiceReceiver, server *protocoltypes.PushServer) (*protocoltypes.PushMemberTokenUpdate, error)
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 SealOutOfStoreMessageEnvelope ¶ added in v2.311.2
func SealOutOfStoreMessageEnvelope(id cid.Cid, env *protocoltypes.MessageEnvelope, headers *protocoltypes.MessageHeaders, g *protocoltypes.Group) (*pushtypes.OutOfStoreMessageEnvelope, error)
Types ¶
type AccountContact ¶ added in v2.308.0
type AccountContact struct {
// contains filtered or unexported fields
}
type AccountKeys ¶
type AccountKeys interface { AccountPrivKey() (crypto.PrivKey, error) AccountProofPrivKey() (crypto.PrivKey, error) DevicePrivKey() (crypto.PrivKey, error) ContactGroupPrivKey(pk crypto.PubKey) (crypto.PrivKey, error) MemberDeviceForGroup(g *protocoltypes.Group) (*cryptoutil.OwnMemberDevice, 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 NewTestOrbitDB ¶ added in v2.311.2
func (*BertyOrbitDB) GetDevicePKForPeerID ¶ added in v2.424.0
func (s *BertyOrbitDB) GetDevicePKForPeerID(id peer.ID) (pdg *PeerDeviceGroup, ok bool)
func (*BertyOrbitDB) IsGroupLoaded ¶ added in v2.311.2
func (s *BertyOrbitDB) IsGroupLoaded(groupID string) bool
func (*BertyOrbitDB) OpenGroup ¶
func (s *BertyOrbitDB) OpenGroup(ctx context.Context, g *protocoltypes.Group, options *orbitdb.CreateDBOptions) (*GroupContext, error)
func (*BertyOrbitDB) OpenGroupReplication ¶ added in v2.311.2
func (s *BertyOrbitDB) OpenGroupReplication(ctx context.Context, g *protocoltypes.Group, options *orbitdb.CreateDBOptions) (iface.Store, iface.Store, 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) 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.TB, svc Service, clientOpts []grpc.DialOption, serverOpts []grpc.ServerOption) (client Client, cleanup func())
type ConnectTestingProtocolFunc ¶ added in v2.266.2
type ConnectTestingProtocolFunc func(testing.TB, libp2p_mocknet.Mocknet)
Connect Peers Helper
type ConnectednessManager ¶ added in v2.429.0
type ConnectednessManager struct {
// contains filtered or unexported fields
}
func NewConnectednessManager ¶ added in v2.429.0
func NewConnectednessManager() *ConnectednessManager
func (*ConnectednessManager) AssociatePeer ¶ added in v2.429.0
func (m *ConnectednessManager) AssociatePeer(group string, peer peer.ID)
AssociatePeer associate a peer to a group
func (*ConnectednessManager) UpdateState ¶ added in v2.429.0
func (m *ConnectednessManager) UpdateState(peer peer.ID, update ConnectednessType)
UpdateState update peer current connectedness state
func (*ConnectednessManager) WaitForConnectednessChange ¶ added in v2.429.0
func (m *ConnectednessManager) WaitForConnectednessChange(ctx context.Context, gkey string, current PeersConnectedness) ([]peer.ID, bool)
WaitForConnectednessChange wait until the given `current` peers status differ from `local` peers state
type ConnectednessType ¶ added in v2.429.0
type ConnectednessType int
const ( ConnectednessTypeDisconnected ConnectednessType = iota ConnectednessTypeReconnecting ConnectednessTypeConnected )
type ConnectednessUpdate ¶ added in v2.429.0
type ConnectednessUpdate struct { Peer peer.ID Status ConnectednessType }
type EventMetadataReceived ¶ added in v2.66.1
type EventMetadataReceived struct { MetaEvent *protocoltypes.GroupMetadataEvent Event proto.Message }
type GroupContext ¶ added in v2.308.0
type GroupContext struct {
// contains filtered or unexported fields
}
func NewContextGroup ¶ added in v2.308.0
func NewContextGroup(group *protocoltypes.Group, metadataStore *MetadataStore, messageStore *MessageStore, messageKeystore *cryptoutil.MessageKeystore, memberDevice *cryptoutil.OwnMemberDevice, logger *zap.Logger) *GroupContext
func (*GroupContext) ActivateGroupContext ¶ added in v2.441.0
func (gc *GroupContext) ActivateGroupContext(contact crypto.PubKey) error
func (*GroupContext) Close ¶ added in v2.308.0
func (gc *GroupContext) Close() error
func (*GroupContext) DevicePubKey ¶ added in v2.308.0
func (gc *GroupContext) DevicePubKey() crypto.PubKey
func (*GroupContext) FillMessageKeysHolderUsingNewData ¶ added in v2.441.0
func (gc *GroupContext) FillMessageKeysHolderUsingNewData() <-chan crypto.PubKey
func (*GroupContext) FillMessageKeysHolderUsingPreviousData ¶ added in v2.441.0
func (gc *GroupContext) FillMessageKeysHolderUsingPreviousData() <-chan crypto.PubKey
func (*GroupContext) Group ¶ added in v2.308.0
func (gc *GroupContext) Group() *protocoltypes.Group
func (*GroupContext) IsClosed ¶ added in v2.431.1
func (gc *GroupContext) IsClosed() bool
func (*GroupContext) MemberPubKey ¶ added in v2.308.0
func (gc *GroupContext) MemberPubKey() crypto.PubKey
func (*GroupContext) MessageKeystore ¶ added in v2.308.0
func (gc *GroupContext) MessageKeystore() *cryptoutil.MessageKeystore
func (*GroupContext) MessageStore ¶ added in v2.308.0
func (gc *GroupContext) MessageStore() *MessageStore
func (*GroupContext) MetadataStore ¶ added in v2.308.0
func (gc *GroupContext) MetadataStore() *MetadataStore
func (*GroupContext) SendSecretsToExistingMembers ¶ added in v2.441.0
func (gc *GroupContext) SendSecretsToExistingMembers(contact crypto.PubKey) <-chan crypto.PubKey
func (*GroupContext) TagGroupContextPeers ¶ added in v2.441.0
func (gc *GroupContext) TagGroupContextPeers(ipfsCoreAPI ipfsutil.ExtendedCoreAPI, weight int)
func (*GroupContext) WatchNewMembersAndSendSecrets ¶ added in v2.441.0
func (gc *GroupContext) WatchNewMembersAndSendSecrets() <-chan crypto.PubKey
type GroupContextMap ¶ added in v2.423.0
type GroupOpenMode ¶ added in v2.146.0
type GroupOpenMode uint64
const ( GroupOpenModeUndefined GroupOpenMode = iota GroupOpenModeReplicate GroupOpenModeWrite )
type GroupStatus ¶ added in v2.429.0
type GroupStatus struct {
// contains filtered or unexported fields
}
type GroupsSigPubKeyMap ¶ added in v2.423.0
type MemberDevice ¶
type MemberDevice struct { Member crypto.PubKey Device crypto.PubKey Secret *protocoltypes.DeviceSecret }
MemberDevice is a remote device part of a group
type MessageStore ¶
FIXME: replace cache by a circular buffer to avoid an attack by RAM saturation
func (*MessageStore) AddMessage ¶
func (*MessageStore) CacheSizeForDevicePK ¶ added in v2.369.0
func (m *MessageStore) CacheSizeForDevicePK(devicePK []byte) (size int, ok bool)
func (*MessageStore) Close ¶ added in v2.441.0
func (m *MessageStore) Close() error
func (*MessageStore) GetMessageByCID ¶ added in v2.308.0
func (m *MessageStore) GetMessageByCID(c cid.Cid) (*protocoltypes.MessageEnvelope, *protocoltypes.MessageHeaders, error)
func (*MessageStore) GetOutOfStoreMessageEnvelope ¶ added in v2.308.0
func (m *MessageStore) GetOutOfStoreMessageEnvelope(ctx context.Context, c cid.Cid) (*pushtypes.OutOfStoreMessageEnvelope, error)
func (*MessageStore) ListEvents ¶ added in v2.308.0
func (m *MessageStore) ListEvents(ctx context.Context, since, until []byte, reverse bool) (<-chan *protocoltypes.GroupMessageEvent, error)
FIXME: use iterator instead to reduce resource usage (require go-ipfs-log improvements)
func (*MessageStore) ProcessMessageQueueForDevicePK ¶ added in v2.369.0
func (m *MessageStore) ProcessMessageQueueForDevicePK(ctx context.Context, devicePK []byte)
type MetadataStore ¶
func (*MetadataStore) AddDeviceToGroup ¶
func (*MetadataStore) ClaimGroupOwnership ¶
func (*MetadataStore) Close ¶ added in v2.441.0
func (m *MetadataStore) Close() error
func (*MetadataStore) ContactBlock ¶
func (m *MetadataStore) ContactBlock(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
ContactBlock indicates the payload includes that the deviceKeystore has blocked a contact
func (*MetadataStore) ContactRequestDisable ¶
ContactRequestDisable indicates the payload includes that the deviceKeystore has disabled incoming contact requests
func (*MetadataStore) ContactRequestEnable ¶
ContactRequestEnable indicates the payload includes that the deviceKeystore has enabled incoming contact requests
func (*MetadataStore) ContactRequestIncomingAccept ¶
func (m *MetadataStore) ContactRequestIncomingAccept(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
ContactRequestIncomingAccept indicates the payload includes that the deviceKeystore has accepted a contact request
func (*MetadataStore) ContactRequestIncomingDiscard ¶
func (m *MetadataStore) ContactRequestIncomingDiscard(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
ContactRequestIncomingDiscard indicates the payload includes that the deviceKeystore has ignored a contact request
func (*MetadataStore) ContactRequestIncomingReceived ¶
func (m *MetadataStore) ContactRequestIncomingReceived(ctx context.Context, contact *protocoltypes.ShareableContact) (operation.Operation, error)
ContactRequestIncomingReceived indicates the payload includes that the deviceKeystore has received a contact request
func (*MetadataStore) ContactRequestOutgoingEnqueue ¶
func (m *MetadataStore) ContactRequestOutgoingEnqueue(ctx context.Context, contact *protocoltypes.ShareableContact, ownMetadata []byte) (operation.Operation, error)
ContactRequestOutgoingEnqueue indicates the payload includes that the deviceKeystore will attempt to send a new contact request
func (*MetadataStore) ContactRequestOutgoingSent ¶
func (m *MetadataStore) ContactRequestOutgoingSent(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
ContactRequestOutgoingSent indicates the payload includes that the deviceKeystore has sent a contact request
func (*MetadataStore) ContactRequestReferenceReset ¶
func (m *MetadataStore) ContactRequestReferenceReset(ctx context.Context) (operation.Operation, error)
ContactRequestReferenceReset indicates the payload includes that the deviceKeystore has a new contact request reference
func (*MetadataStore) ContactSendAliasKey ¶
func (*MetadataStore) ContactUnblock ¶
func (m *MetadataStore) ContactUnblock(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
ContactUnblock indicates the payload includes that the deviceKeystore has unblocked a contact
func (*MetadataStore) DevicePK ¶ added in v2.311.2
func (m *MetadataStore) DevicePK() (crypto.PubKey, error)
func (*MetadataStore) GetContactFromGroupPK ¶ added in v2.308.0
func (m *MetadataStore) GetContactFromGroupPK(groupPK []byte) *protocoltypes.ShareableContact
func (*MetadataStore) GetDevicesForMember ¶
func (*MetadataStore) GetIncomingContactRequestsStatus ¶
func (m *MetadataStore) GetIncomingContactRequestsStatus() (bool, *protocoltypes.ShareableContact)
func (*MetadataStore) GetMemberByDevice ¶
func (*MetadataStore) GetPushTokenForDevice ¶ added in v2.311.2
func (m *MetadataStore) GetPushTokenForDevice(d crypto.PubKey) (*protocoltypes.PushMemberTokenUpdate, error)
func (*MetadataStore) GetRequestOwnMetadataForContact ¶ added in v2.308.0
func (m *MetadataStore) GetRequestOwnMetadataForContact(pk []byte) ([]byte, error)
func (*MetadataStore) Group ¶ added in v2.311.2
func (m *MetadataStore) Group() *protocoltypes.Group
func (*MetadataStore) GroupJoin ¶
func (m *MetadataStore) GroupJoin(ctx context.Context, g *protocoltypes.Group) (operation.Operation, error)
GroupJoin indicates the payload includes that the deviceKeystore has joined a group
func (*MetadataStore) GroupLeave ¶
func (m *MetadataStore) GroupLeave(ctx context.Context, pk crypto.PubKey) (operation.Operation, error)
GroupLeave indicates the payload includes that the deviceKeystore has left a group
func (*MetadataStore) ListAdmins ¶
func (m *MetadataStore) ListAdmins() []crypto.PubKey
func (*MetadataStore) ListContacts ¶ added in v2.308.0
func (m *MetadataStore) ListContacts() map[string]*AccountContact
func (*MetadataStore) ListContactsByStatus ¶
func (m *MetadataStore) ListContactsByStatus(states ...protocoltypes.ContactState) []*protocoltypes.ShareableContact
func (*MetadataStore) ListDevices ¶
func (m *MetadataStore) ListDevices() []crypto.PubKey
func (*MetadataStore) ListEvents ¶
func (m *MetadataStore) ListEvents(ctx context.Context, since, until []byte, reverse bool) (<-chan *protocoltypes.GroupMetadataEvent, error)
FIXME: use iterator instead to reduce resource usage (require go-ipfs-log improvements)
func (*MetadataStore) ListMembers ¶
func (m *MetadataStore) ListMembers() []crypto.PubKey
func (*MetadataStore) ListMultiMemberGroups ¶
func (m *MetadataStore) ListMultiMemberGroups() []*protocoltypes.Group
func (*MetadataStore) ListOtherMembersDevices ¶ added in v2.308.0
func (m *MetadataStore) ListOtherMembersDevices() []crypto.PubKey
func (*MetadataStore) ListVerifiedCredentials ¶ added in v2.443.0
func (m *MetadataStore) ListVerifiedCredentials() []*protocoltypes.AccountVerifiedCredentialRegistered
func (*MetadataStore) MemberPK ¶ added in v2.311.2
func (m *MetadataStore) MemberPK() (crypto.PubKey, error)
func (*MetadataStore) RegisterDevicePushServer ¶ added in v2.308.0
func (m *MetadataStore) RegisterDevicePushServer(ctx context.Context, server *protocoltypes.PushServer) (operation.Operation, error)
func (*MetadataStore) RegisterDevicePushToken ¶ added in v2.308.0
func (m *MetadataStore) RegisterDevicePushToken(ctx context.Context, token *protocoltypes.PushServiceReceiver) (operation.Operation, error)
func (*MetadataStore) SendAccountServiceTokenAdded ¶ added in v2.308.0
func (m *MetadataStore) SendAccountServiceTokenAdded(ctx context.Context, token *protocoltypes.ServiceToken) (operation.Operation, error)
func (*MetadataStore) SendAccountServiceTokenRemoved ¶ added in v2.308.0
func (*MetadataStore) SendAccountVerifiedCredentialAdded ¶ added in v2.443.0
func (m *MetadataStore) SendAccountVerifiedCredentialAdded(ctx context.Context, token *protocoltypes.AccountVerifiedCredentialRegistered) (operation.Operation, error)
func (*MetadataStore) SendAliasProof ¶
func (*MetadataStore) SendAppMetadata ¶
func (*MetadataStore) SendGroupReplicating ¶ added in v2.308.0
func (m *MetadataStore) SendGroupReplicating(ctx context.Context, t *protocoltypes.ServiceToken, endpoint string) (operation.Operation, error)
func (*MetadataStore) SendPushToken ¶ added in v2.308.0
func (m *MetadataStore) SendPushToken(ctx context.Context, t *protocoltypes.PushMemberTokenUpdate) (operation.Operation, error)
func (*MetadataStore) SendSecret ¶
type NewOrbitDBOptions ¶ added in v2.141.0
type NewOrbitDBOptions struct { baseorbitdb.NewOrbitDBOptions Datastore datastore.Batching MessageKeystore *cryptoutil.MessageKeystore DeviceKeystore cryptoutil.DeviceKeystore RotationInterval *rendezvous.RotationInterval }
type Opts ¶
type Opts struct { Logger *zap.Logger IpfsCoreAPI ipfsutil.ExtendedCoreAPI DeviceKeystore cryptoutil.DeviceKeystore DatastoreDir string RootDatastore ds.Batching GroupDatastore *cryptoutil.GroupDatastore AccountCache ds.Batching MessageKeystore *cryptoutil.MessageKeystore OrbitDB *BertyOrbitDB TinderService *tinder.Service Host host.Host PubSub *pubsub.PubSub GRPCInsecureMode bool LocalOnly bool PushKey *[cryptoutil.KeySize]byte // contains filtered or unexported fields }
Opts contains optional configuration flags for building a new Client
type OrbitDBMessageMarshaler ¶ added in v2.423.0
type OrbitDBMessageMarshaler struct {
// contains filtered or unexported fields
}
func NewOrbitDBMessageMarshaler ¶ added in v2.423.0
func NewOrbitDBMessageMarshaler(selfid peer.ID, dk cryptoutil.DeviceKeystore, rp *rendezvous.RotationInterval) *OrbitDBMessageMarshaler
func (*OrbitDBMessageMarshaler) GetDevicePKForPeerID ¶ added in v2.423.0
func (m *OrbitDBMessageMarshaler) GetDevicePKForPeerID(id peer.ID) (pdg *PeerDeviceGroup, ok bool)
func (*OrbitDBMessageMarshaler) Marshal ¶ added in v2.423.0
func (m *OrbitDBMessageMarshaler) Marshal(msg *iface.MessageExchangeHeads) ([]byte, error)
func (*OrbitDBMessageMarshaler) RegisterGroup ¶ added in v2.423.0
func (m *OrbitDBMessageMarshaler) RegisterGroup(sid string, group *protocoltypes.Group)
func (*OrbitDBMessageMarshaler) RegisterSharedKeyForTopic ¶ added in v2.423.0
func (m *OrbitDBMessageMarshaler) RegisterSharedKeyForTopic(topic string, sk enc.SharedKey)
func (*OrbitDBMessageMarshaler) Unmarshal ¶ added in v2.423.0
func (m *OrbitDBMessageMarshaler) Unmarshal(payload []byte, msg *iface.MessageExchangeHeads) error
type PeerDeviceGroup ¶ added in v2.423.0
type PeerDeviceGroup struct { Group *protocoltypes.Group DevicePK crypto.PubKey }
type PeerStatus ¶ added in v2.429.0
type PeerStatus struct {
// contains filtered or unexported fields
}
type PeersConnectedness ¶ added in v2.429.0
type PeersConnectedness map[peer.ID]ConnectednessType
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(bertyprotocol.Opts{}) if err != nil { panic(err) } defer client.Close() 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
}
func NewSwiper ¶ added in v2.109.0
func NewSwiper(logger *zap.Logger, tinder *tinder.Service, rp *rendezvous.RotationInterval) *Swiper
func (*Swiper) RefreshContactRequest ¶ added in v2.410.0
type TestingOpts ¶ added in v2.39.0
type TestingOpts struct { Logger *zap.Logger Mocknet libp2p_mocknet.Mocknet DiscoveryServer *tinder.MockDriverServer DeviceKeystore cryptoutil.DeviceKeystore CoreAPIMock ipfsutil.CoreAPIMock OrbitDB *BertyOrbitDB ConnectFunc ConnectTestingProtocolFunc PushSK *[32]byte }
type TestingProtocol ¶ added in v2.39.0
type TestingProtocol struct { Opts *Opts Service Service Client Client RootDatastore datastore.Batching DeviceKeystore cryptoutil.DeviceKeystore IpfsCoreAPI ipfsutil.ExtendedCoreAPI OrbitDB *BertyOrbitDB GroupDatastore *cryptoutil.GroupDatastore }
func NewTestingProtocol ¶ added in v2.39.0
func NewTestingProtocol(ctx context.Context, t testing.TB, opts *TestingOpts, ds datastore.Batching) (*TestingProtocol, func())
func NewTestingProtocolWithMockedPeers ¶ added in v2.122.0
func NewTestingProtocolWithMockedPeers(ctx context.Context, t testing.TB, opts *TestingOpts, ds datastore.Batching, amount int) ([]*TestingProtocol, func())
Source Files ¶
- account_export.go
- api_app.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
- api_verified_credentials.go
- client.go
- connectedness_manager.go
- consts.go
- contact_request_manager.go
- doc.go
- events.go
- events_sig_checkers.go
- group.go
- group_context.go
- iface_account.go
- message_marshaler.go
- orbitdb.go
- orbitdb_datastore_cache.go
- orbitdb_signed_entry_accesscontroller.go
- orbitdb_signed_entry_identity_provider.go
- orbitdb_signed_entry_keystore.go
- service.go
- service_group.go
- store_message.go
- store_message_queue.go
- store_metadata.go
- store_metadata_index.go
- store_options.go
- store_utils.go
- testing.go
- tinder_swiper.go
- tyber.go