Package 

Class BinderWrapperImpl

  • All Implemented Interfaces:
    net.ballmerlabs.scatterbrainsdk.BinderWrapper

    @Singleton() 
    public final class BinderWrapperImpl
     implements BinderWrapper
                        
    • Method Detail

      • startService

         Unit startService()

        Starts the scatterbrain router if stopped. Requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission

      • getIdentity

         Identity getIdentity(UUID fingerprint)

        Gets a single identity by fingerprint. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

      • sign

         ByteArray sign(Identity identity, ByteArray data)

        Cryptographically signs data using a stored identity. This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

        Parameters:
        identity - identity object
        data - bytes to sign
      • verify

         Boolean verify(Identity identity, ByteArray data, ByteArray sig)

        Cryptographically verifies a detached signature using a stored identity This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

        Parameters:
        identity - identity object to verify with
        data - data to verify
        sig - detached signature generated by sign()
      • getIdentities

         List<Identity> getIdentities()

        Gets a list of all known identities. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

      • stopService

         Unit stopService()

        Stops the scatterbrain router if started. Requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission

      • observeIdentities

        @ExperimentalCoroutinesApi() Flow<List<Identity>> observeIdentities()

        returns an asynchronous flow of identities received after this function is called in real time. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

      • getScatterMessages

         List<ScatterMessage> getScatterMessages(String application)

        returns a list of all stored message objects for a given application requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

        Parameters:
        application - application identifier
      • getScatterMessages

         List<ScatterMessage> getScatterMessages(String application, Date since)

        returns a list of all stored messages for a given application after a given date. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

        Parameters:
        application - application identifier
        since - restrict messages after this date
      • getScatterMessages

         List<ScatterMessage> getScatterMessages(String application, Date start, Date end)

        returns a list of all stored messages for a given application between two dates. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

        Parameters:
        application - application identifier
        start - start date
        end - end data
      • rescanPeers

         Unit rescanPeers()

        Attempts to reconnect to known local peers

      • observeMessages

        @ExperimentalCoroutinesApi() Flow<List<ScatterMessage>> observeMessages(String application)

        returns an asynchronous flow of all messages received after this functions is called filtered by a given application identifier. requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

        Parameters:
        application - application idenifier
      • generateIdentity

         Identity generateIdentity(String name)

        generates and returns a scatterbrain identity with ACLs matching the calling application only If additional applications need access to this identity they can be assigned via the Scatterbrain app. This requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

        Parameters:
        name - human readable name associated with identity
      • authorizeIdentity

         Unit authorizeIdentity(Identity identity, String packageName)

        Adds an ACL to an identity authorizing an app to use it. This function requires net.ballmerlabs.scatterroutingservice.permission.SUPERUSER and is currently not available to 3rd party applications

        Parameters:
        identity - identity object
        packageName - android app package name
      • deauthorizeIdentity

         Unit deauthorizeIdentity(Identity identity, String packageName)

        Removes an ACL authorizing an app to use an identity. This function requires net.ballmerlabs.scatterroutingservice.permission.SUPERUSER and is currently not available to 3rd party applications

        Parameters:
        identity - identity object
        packageName - android app package name
      • getPermissions

         List<NamePackage> getPermissions(Identity identity)

        Gets a list of ACLs associated with a given identity object. This function requires net.ballmerlabs.scatterroutingservice.permission.SUPERUSER permission and is currently not available to 3rd party applications

        Parameters:
        identity - identity object
      • sendMessage

         Unit sendMessage(ScatterMessage message)

        Enqueues a Scatterbrain message to the datastore. The messages will be sent as soon as a peer is available This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

        Parameters:
        message - message to send
      • sendMessage

         Unit sendMessage(List<ScatterMessage> messages)

        Enqueues multiple Scatterbrain messages to the datastore. The messages will be sent as soon as a peer is available This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission

        Parameters:
        messages - message to send
      • sendMessage

         Unit sendMessage(ScatterMessage message, UUID identity)

        Enqueues a message to the datastore and signs it with a given identity. This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission but the calling package must have accesss to the identity

        Parameters:
        message - message to send
        identity - identity to sign with
      • sendMessage

         Unit sendMessage(List<ScatterMessage> messages, UUID identity)

        Enqueues a list of messages to the datastore and signs it with a given identity. This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission but the calling package must have accesss to the identity

        Parameters:
        messages - messages to send
        identity - identity to sign with
      • sendMessage

         Unit sendMessage(ScatterMessage message, Identity identity)

        Enqueues a message to the datastore and signs it with a given identity. This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission but the calling package must have accesss to the identity

        Parameters:
        message - message to send
        identity - identity to sign with
      • sendMessage

         Unit sendMessage(List<ScatterMessage> messages, Identity identity)

        Enqueues a list of messages to the datastore and signs it with a given identity. This function requires net.ballmerlabs.scatterroutingservice.permission.ACCESS permission but the calling package must have accesss to the identity

        Parameters:
        messages - messages to send
        identity - identity to sign with
      • getPackages

         List<NamePackage> getPackages()

        Gets a list of packages declaring a Scatterbrain compatible BroadcastReceiver. This function requires net.ballmerlabs.scatterroutingservice.permission.SUPERUSER permission and is currently not available to 3rd party applications

      • removeIdentity

         Boolean removeIdentity(Identity identity)

        Deletes an identity. This function requires net.ballmerlabs.scatterroutingservice.permission.SUPERUSER and is currently not available to 3rd party applications

        Parameters:
        identity - identity object
      • getPermissionStatus

         PermissionStatus getPermissionStatus()

        Gets the current critical permissions granted to the router. This should be used to prompt the user to open Scatterbrain and grant permissions

      • startDiscover

         Unit startDiscover()

        Starts active discovery using default transport modules This function requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission

      • startPassive

         Unit startPassive()

        Starts passive discovery using the default radio module. This usually uses less power than active discovery for most transport modules but may skip peers that are also in passive mode This function requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission

      • stopDiscover

         Unit stopDiscover()

        Stops active discovery This function requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission

      • stopPassive

         Unit stopPassive()

        Stops passive discovery This function requires net.ballmerlabs.scatterroutingservice.permission.ADMIN permission

      • register

         Unit register()

        Unregisters the internal BroadcastReceiver for Scatterbrain events. This must be called to use the Scatterbrain SDK

      • unregister

         Unit unregister()

        Unregisters Scatterbrain broadcast receivers

      • isConnected

         Boolean isConnected()

        Checks if this SDK is connected to a running Scatterbrain router