<aside> <img src="https://prod-files-secure.s3.us-west-2.amazonaws.com/08bcd78f-acea-4107-8e5c-cce45804142d/2d8be17e-4bea-476a-9304-51c773ac33a8/Bridgefy_Official_Icon_2021.png" alt="https://prod-files-secure.s3.us-west-2.amazonaws.com/08bcd78f-acea-4107-8e5c-cce45804142d/2d8be17e-4bea-476a-9304-51c773ac33a8/Bridgefy_Official_Icon_2021.png" width="40px" /> Part of Bridgefy's functionality is its ability to provide a secure connection for sending data within a mesh network. To ensure the privacy and security of sensitive data, Bridgefy SDK employs encryption techniques. Encryption involves transforming data into an unreadable format, which can only be deciphered by authorized recipients who possess the correct decryption key.

</aside>

<aside> <img src="https://prod-files-secure.s3.us-west-2.amazonaws.com/08bcd78f-acea-4107-8e5c-cce45804142d/23150f12-3ace-4e73-950e-be27d01e3647/Bridgefy_Official_Icon_2021.png" alt="https://prod-files-secure.s3.us-west-2.amazonaws.com/08bcd78f-acea-4107-8e5c-cce45804142d/23150f12-3ace-4e73-950e-be27d01e3647/Bridgefy_Official_Icon_2021.png" width="40px" /> Bridgefy utilizes the Signal Protocol, a widely recognized and trusted encryption protocol, to encrypt sensitive data exchanged between devices in a mesh network. The Signal Protocol provides end-to-end encryption, meaning the data remains encrypted throughout its entire journey from the sender to the intended recipient. This ensures that even if someone intercepts the data, they won't be able to access its contents without the proper decryption key.

</aside>

However, companies and developers who use the Bridgefy SDK in their mobile apps also have the option to implement their own custom encryption if they prefer, which doesn't require the establishment of a secure connection but needs robust encryption-key management practices

Established secure connection

Bridgefy SDK offers the option to establish secure connections within the mesh network, encrypting the data traveling on the mesh using the Signal protocol. This ensures a secure connection and protects the data from unauthorized access.

When node is connected you can try to establishing a secure connection with follow method:

// Bridgefy instance
val bridgefy: Bridgefy

bridgefy.establishSecureConnection(connectedNodeID: UUID)

Throws: A BridgefyException if there is an error during the connection establishment.

These methods are used to handle events related to the establishment of on-demand secure connections. The onEstablishSecureConnection function is invoked when a secure connection is successfully established, while the onFailToEstablishSecureConnection function is called when the establishment of a secure connection fails, providing details about the user involved and the reason for the failure.

val delegate: BridgefyDelegate = object : BridgefyDelegate {

      /**
       * This function is called to notify when an on-demand secure connection was successfully established.
       *
       * - userId: The ID of the user with whom the secure connection was established.
       */
      fun onEstablishSecureConnection(userId: UUID)
   
      /**
       * This function is called to notify when an on-demand secure connection could not be established.
       *
       * - userId: The ID of the user with whom the secure connection failed.
       * - error: The error reason indicating why the secure connection failed.
       */
      fun onFailToEstablishSecureConnection(
         userId: UUID,
         error: BridgefyException,
      )
   }

Bridgefy also allows users to implement their own custom encryption if they prefer not to use the Signal Protocol. In such cases, where custom encryption is utilized, it's important to note that Bridgefy does not require the establishment of a secure connection between devices.

Bridgefy Method

bridgefy.fingerprint(userId: UUID): Result<BridgefyFingerprint>

Description: Generates a fingerprint for the secure connection established with a specified user.

Parameters:

Returns: A Result containing the generated BridgefyFingerprint object or an error message. Returns null if a secure connection hasn't been established with the user.

bridgefy.isFingerprintValid(
         fingerprintData: ByteArray,
         userId: UUID,
    ) : Result<Boolean>

Description: Verifies the validity of a fingerprint for a particular user.