Skip to content

Seald SDK for Android

WARNING

This package is still early-access:

  • the interface will probably still have breaking changes
  • the installation instructions may change in the future
  • some quality-of-life features are still missing
  • some bugs may still be present
  • the documentation may still be incomplete, or not very readable

Feel free to give us feedback!

This package is the Seald SDK for Android.

To install it, you need to add the package io.seald:seald_sdk_android, available on Maven Central, to your dependencies.

The current version is 0.4.0-beta.2. Here is how you can add it to your app/build.gradle:

groovy
dependencies {
    /* ... */
    implementation 'io.seald:seald_sdk_android:0.4.0-beta.2'
}
dependencies {
    /* ... */
    implementation 'io.seald:seald_sdk_android:0.4.0-beta.2'
}

You can then import it in your code with:

kotlin
import io.seald.seald_sdk.SealdSDK
import io.seald.seald_sdk.SealdSDK

You can also see the example app.

This package contains the main SealdSDK class, the EncryptionSession class, as well as multiple helper classes.

SealdSDK

SealdSDK is the main class for the Seald SDK. It represents an instance of the Seald SDK.

You can instantiate it this way:

kotlin
val seald = SealdSDK(
    apiURL = "https://api.seald.io/",
    appId = "YourAppId",
    dbPath = "/myApp/seald_db",
    dbb64SymKey = "A Secret Key to encrypt the local database, encoded in b64"
)
val seald = SealdSDK(
    apiURL = "https://api.seald.io/",
    appId = "YourAppId",
    dbPath = "/myApp/seald_db",
    dbb64SymKey = "A Secret Key to encrypt the local database, encoded in b64"
)

This class then allows you to create an account, create or retrieve an EncryptionSession, etc.

See the SealdSDK reference for more information.

EncryptionSession

An EncryptionSession allows you to encrypt / decrypt multiple messages or files.

This should not be instantiated directly, and should be either created with SealdSDK.createEncryptionSession or retrieved with SealdSDK.retrieveEncryptionSession or SealdSDK.retrieveEncryptionSessionFromMessage.

© 2023 Seald SAS

You can find the license information of Open Source libraries used in Seald SDK for mobile at https://download.seald.io/download/mobile_dependencies_licenses_0.4.0-beta.2.txt.

Types

NameSummary
AccountInfodata class AccountInfo(val userId: String, val deviceId: String, val deviceExpires: Instant?)
AccountInfo is returned when calling SealdSDK.createAccount or SealdSDK.getCurrentAccountInfo, containing information about the local account.
ActionStatusdata class ActionStatus(val success: Boolean, val errorCode: String)
Represents the status of an operation on single user/device.
AuthFactordata class AuthFactor(val type: AuthFactorType, val value: String)
Represents a user's authentication factor
AuthFactorTypeenum AuthFactorType : Enum<AuthFactorType>
BeardErrordata class BeardError(val id: String, val code: String)
BeardError represents an error returned by the server. It contains a specific id and code to determine the underlying reason.
ClearFiledata class ClearFile(val filename: String, val sessionId: String, val fileContent: ByteArray)
ClearFile represents a decrypted file.
Connectordata class Connector(val sealdId: String, val type: ConnectorType, val value: String, val id: String, val state: ConnectorState)
Connector represents all details about a connector.
ConnectorStateenum ConnectorState : Enum<ConnectorState>
ConnectorState represents the allowed values for Connector states.
ConnectorTypeenum ConnectorType : Enum<ConnectorType>
ConnectorType represents the allowed values for Connector types:
ConnectorTypeValuedata class ConnectorTypeValue(val type: ConnectorType, val value: String)
ConnectorTypeValue is a simplified representation of a connector for which we don't know all details.
CreateSubIdentityResponsedata class CreateSubIdentityResponse(val deviceId: String, val backupKey: ByteArray)
CreateSubIdentityResponse represents a newly created sub identity.
DeviceMissingKeysdata class DeviceMissingKeys(val deviceId: String)
Represents a device of the current account which is missing some keys, and for which you probably want to call SealdSDK.massReencrypt.
EncryptionSessionclass EncryptionSession(encryptionSession: MobileEncryptionSession)
An encryption session, with which you can then encrypt / decrypt multiple messages or files. This should not be instantiated directly, and should be either created with SealdSDK.createEncryptionSession, or retrieved with SealdSDK.retrieveEncryptionSession or SealdSDK.retrieveEncryptionSessionFromMessage.
EncryptionSessionRetrievalDetailsclass EncryptionSessionRetrievalDetails(var flow: EncryptionSessionRetrievalFlow, var groupId: String?, var proxySessionId: String?, var fromCache: Boolean)
EncryptionSessionRetrievalDetails represents the details of how an Encryption Session was retrieved.
EncryptionSessionRetrievalFlowenum EncryptionSessionRetrievalFlow : Enum<EncryptionSessionRetrievalFlow>
EncryptionSessionRetrievalFlow represents the way the session was retrieved : as a direct recipient, as member of a group, or through a proxy session
MassReencryptOptionsdata class MassReencryptOptions@JvmOverloadsconstructor(var retries: Int = 3, var retrieveBatchSize: Int = 1000, var waitBetweenRetries: Duration = Duration.ofSeconds(3), var waitProvisioning: Boolean = true, var waitProvisioningTime: Duration = Duration.ofSeconds(5), var waitProvisioningTimeMax: Duration = Duration.ofSeconds(10), var waitProvisioningTimeStep: Duration = Duration.ofSeconds(1), var waitProvisioningRetries: Int = 100, var forceLocalAccountUpdate: Boolean = false)
Options for SealdSDK.massReencrypt function.
MassReencryptResponsedata class MassReencryptResponse(val reencrypted: Int, val failed: Int)
Represents the results of a call to SealdSDK.massReencrypt.
PreValidationTokendata class PreValidationToken(val domainValidationKeyId: String, val nonce: String, val token: String)
PreValidationToken represents a way for your server to authorize the adding of a connector.
RecipientRightsdata class RecipientRights(val read: Boolean = true, val forward: Boolean = true, val revoke: Boolean = false)
RecipientRights represents the rights a user can have over an encrypted message or an encryption session.
RecipientWithRightsdata class RecipientWithRights(val recipientId: String, val rights: RecipientRights = RecipientRights())
RecipientWithRight represents a recipient with associated rights.
RetrieveIdentityResponsedata class RetrieveIdentityResponse(val identity: ByteArray, val shouldRenewKey: Boolean, var authenticatedSessionId: String)
RetrieveIdentityResponse holds a retrieved identity
RevokeResultdata class RevokeResult(val recipients: Map<String, ActionStatus>, val proxySessions: Map<String, ActionStatus>)
The result of a revocation operation.
SealdExceptionclass SealdException(originalException: Throwable) : RuntimeException
SealdException represents an error that happened during a Seald operation.
SealdSDKclass SealdSDK@JvmOverloadsconstructor(apiURL: String = "https://api.seald.io/&quot;, appId: String, dbPath: String? = null, dbb64SymKey: String? = null, instanceName: String = "SealdSDK", logLevel: Byte = 0, logNoColor: Boolean = true, encryptionSessionCacheTTL: Duration? = Duration.ZERO, keySize: Int = 4096)
This is the main class for the Seald SDK. It represents an instance of the Seald SDK.
SealdSSKSPasswordPluginclass SealdSSKSPasswordPlugin(ssksURL: String = "https://ssks.seald.io/&quot;, appId: String, instanceName: String = "SealdSSKSPasswordPlugin", logLevel: Byte = 0, logNoColor: Boolean = true)
The SealdSSKSPassword class allows to use the SSKS key storage service to store Seald identities easily and securely, encrypted by a user password.
SealdSSKSTmrPluginclass SealdSSKSTmrPlugin(ssksURL: String = "https://ssks.seald.io/&quot;, appId: String, instanceName: String = "SealdSSKSTmrPlugin", logLevel: Byte = 0, logNoColor: Boolean = true)
The SealdSSKSTmrPlugin class allows to use the SSKS key storage service to store Seald identities easily and securely, encrypted by a key stored on your back-end server.

Functions

NameSummary
parseSessionIdFromBytesfun parseSessionIdFromBytes(fileByteArray: ByteArray): String
Takes an encrypted file as bytes, and returns the session id.
parseSessionIdFromFilefun parseSessionIdFromFile(encryptedFilePath: String): String
Takes the path to an encrypted file, and returns the session id.
parseSessionIdFromMessagefun parseSessionIdFromMessage(message: String): String
Takes an encrypted message, and returns the session id.