SealdSdk class SealdSdk

This is the main class for the Seald SDK. It represents an instance of the Seald SDK. This must be instantiated from the root isolate, or you must pass the rootIsolateToken argument.

Constructors

SealdSdk({required String apiURL, required String appId, int keySize = 4096, String databasePath = "", Uint8List? databaseEncryptionKey, Duration encryptionSessionCacheTTL = Duration.zero, int logLevel = 0, bool logNoColor = false, String instanceName = "", RootIsolateToken? rootIsolateToken})
Creates a new instance of SealdSdk.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addConnector(String connectorType, String connectorValue, {SealdPreValidationToken? preValidationToken}) SealdConnector
Add a connector to the current identity. If no preValidationToken is given, the connector will need to be validated before use.
addConnectorAsync(String connectorType, String connectorValue, {SealdPreValidationToken? preValidationToken}) Future<SealdConnector>
Add a connector to the current identity. If no preValidationToken is given, the connector will need to be validated before use.
addGroupMembers(String groupId, {required List<String> membersToAdd, List<String> adminsToSet = const [], SealdGeneratedPrivateKeys? privateKeys}) → void
Adds members to a group. Can only be done by a group administrator. Can also specify which of these newly added group members should also be admins.
addGroupMembersAsync(String groupId, {required List<String> membersToAdd, List<String> adminsToSet = const [], SealdGeneratedPrivateKeys? privateKeys}) Future<void>
Adds members to a group. Can only be done by a group administrator. Can also specify which of these newly added group members should also be admins.
checkSigchainHash(String userId, String expectedHash, {int position = -1}) SealdCheckSigchainResponse
Verify if a given hash is included in the recipient's sigchain. Use the position option to check the hash of a specific sigchain transaction.
checkSigchainHashAsync(String userId, String expectedHash, {int position = -1}) Future<SealdCheckSigchainResponse>
Verify if a given hash is included in the recipient's sigchain. Use the position option to check the hash of a specific sigchain transaction.
close() → void
Close the current SDK instance. This frees any lock on the current database, and frees the memory. After calling close, the instance cannot be used anymore.
convertTmrAccesses(String tmrJWT, Uint8List overEncryptionKey, {SealdTmrAccessesConvertFilters? conversionFilters, bool deleteOnConvert = true}) SealdConvertTmrAccessesResult
Convert all TMR Accesses addressed to a given auth factor and matching specified filters to classic message keys. All TMR accesses matching the specified filters must have been encrypted with the same overEncryptionKey.
convertTmrAccessesAsync(String tmrJWT, Uint8List overEncryptionKey, {SealdTmrAccessesConvertFilters? conversionFilters, bool deleteOnConvert = true}) Future<SealdConvertTmrAccessesResult>
Convert all TMR Accesses addressed to a given auth factor and matching specified filters to classic message keys. All TMR accesses matching the specified filters must have been encrypted with the same overEncryptionKey.
createAccount(String signupJwt, {String displayName = "User", String deviceName = "Device", SealdGeneratedPrivateKeys? privateKeys, Duration expireAfter = Duration.zero}) SealdAccountInfo
Creates a new Seald SDK Account for this Seald SDK instance. This function can only be called if the current SDK instance does not have an account yet.
createAccountAsync(String signupJwt, {String displayName = "User", String deviceName = "Device", SealdGeneratedPrivateKeys? privateKeys, Duration expireAfter = Duration.zero}) Future<SealdAccountInfo>
Creates a new Seald SDK Account for this Seald SDK instance. This function can only be called if the current SDK instance does not have an account yet.
createEncryptionSession(List<SealdRecipientWithRights> recipients, {bool useCache = true}) SealdEncryptionSession
Create an encryption session, and returns the associated SealdEncryptionSession instance, with which you can then encrypt/decrypt multiple messages. Warning: if you want to be able to retrieve the session later, you must put your own Seald ID in the recipients argument.
createEncryptionSessionAsync(List<SealdRecipientWithRights> recipients, {bool useCache = true}) Future<SealdEncryptionSession>
Create an encryption session, and returns the associated SealdEncryptionSession instance, with which you can then encrypt/decrypt multiple messages. Warning: if you want to be able to retrieve the session later, you must put your own Seald ID in the recipients argument.
createGroup({String groupName = "", required List<String> members, required List<String> admins, SealdGeneratedPrivateKeys? privateKeys}) String
Create a group and return the created group's ID. admins must also be members. admins must include yourself.
createGroupAsync({String groupName = "", required List<String> members, required List<String> admins, SealdGeneratedPrivateKeys? privateKeys}) Future<String>
Create a group and return the created group's ID. admins must also be members. admins must include yourself.
createSubIdentity({String deviceName = "", SealdGeneratedPrivateKeys? privateKeys, Duration expireAfter = const Duration(days: 5 * 365)}) SealdCreateSubIdentityResponse
Creates a new sub-identity, or new device, for the current user account. After creating this new device, you will probably want to call massReencrypt, so that the newly created device will be able to decrypt SealdEncryptionSessions previously created for this account.
createSubIdentityAsync({String deviceName = "", SealdGeneratedPrivateKeys? privateKeys, Duration expireAfter = const Duration(days: 5 * 365)}) Future<SealdCreateSubIdentityResponse>
Creates a new sub-identity, or new device, for the current user account. After creating this new device, you will probably want to call massReencrypt, so that the newly created device will be able to decrypt SealdEncryptionSessions previously created for this account.
devicesMissingKeys({bool forceLocalAccountUpdate = false}) List<SealdDeviceMissingKeys>
List which of the devices of the current account are missing keys, so you can call massReencrypt for them.
devicesMissingKeysAsync({bool forceLocalAccountUpdate = false}) Future<List<SealdDeviceMissingKeys>>
List which of the devices of the current account are missing keys, so you can call massReencrypt for them.
exportIdentity() Uint8List
Exports the current device as an identity export.
generatePrivateKeysAsync() Future<SealdGeneratedPrivateKeys>
Generate private keys.
getConnectorsFromSealdId(String sealdId) List<SealdConnector>
List all connectors known locally for a given Seald ID.
getConnectorsFromSealdIdAsync(String sealdId) Future<List<SealdConnector>>
List all connectors known locally for a given Seald ID.
getCurrentAccountInfo() SealdAccountInfo?
Returns information about the current account, or null if there is none.
getSealdIdsFromConnectors(List<SealdConnectorTypeValue> connectorTypeValues) List<String>
Get all the info for the given connectors to look for, updates the local cache of connectors, and returns a list with the corresponding Seald IDs. Seald IDs are not de-duped and can appear for multiple connector values. If one of the connectors is not assigned to a Seald user, this will throw a SealdException with the details of the missing connector.
getSealdIdsFromConnectorsAsync(List<SealdConnectorTypeValue> connectorTypeValues) Future<List<String>>
Get all the info for the given connectors to look for, updates the local cache of connectors, and returns a list with the corresponding Seald IDs. Seald IDs are not de-duped and can appear for multiple connector values. If one of the connectors is not assigned to a Seald user, this will throw a SealdException with the details of the missing connector.
getSigchainHash(String userId, {int position = -1}) SealdGetSigchainResponse
Get a user's sigchain transaction hash at index position.
getSigchainHashAsync(String userId, {int position = -1}) Future<SealdGetSigchainResponse>
Get a user's sigchain transaction hash at index position.
heartbeat() → void
Just call the Seald server, without doing anything. This may be used, for example, to verify that the current instance has a valid identity.
heartbeatAsync() Future<void>
Just call the Seald server, without doing anything. This may be used, for example, to verify that the current instance has a valid identity.
importIdentity(Uint8List identity) → void
Loads an identity export into the current SDK instance. This function can only be called if the current SDK instance does not have an account yet.
importIdentityAsync(Uint8List identity) Future<void>
Loads an identity export into the current SDK instance. This function can only be called if the current SDK instance does not have an account yet.
listConnectors() List<SealdConnector>
List connectors associated with the current account.
listConnectorsAsync() Future
List connectors associated with the current account.
massReencrypt(String deviceId, {int retries = 3, int retrieveBatchSize = 1000, Duration waitBetweenRetries = const Duration(seconds: 3), bool waitProvisioning = true, Duration waitProvisioningTime = const Duration(seconds: 5), Duration waitProvisioningTimeMax = const Duration(seconds: 10), Duration waitProvisioningTimeStep = const Duration(seconds: 1), int waitProvisioningRetries = 100, bool forceLocalAccountUpdate = false}) SealdMassReencryptResponse
Retrieve, re-encrypt, and add missing keys for a certain device.
massReencryptAsync(String deviceId, {int retries = 3, int retrieveBatchSize = 1000, Duration waitBetweenRetries = const Duration(seconds: 3), bool waitProvisioning = true, Duration waitProvisioningTime = const Duration(seconds: 5), Duration waitProvisioningTimeMax = const Duration(seconds: 10), Duration waitProvisioningTimeStep = const Duration(seconds: 1), int waitProvisioningRetries = 100, bool forceLocalAccountUpdate = false}) Future<SealdMassReencryptResponse>
Retrieve, re-encrypt, and add missing keys for a certain device.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prepareRenew({SealdGeneratedPrivateKeys? privateKeys}) Uint8List
Prepare a private key renewal, so it can be stored on SSKS without risk of loss during the actual renew
prepareRenewAsync({SealdGeneratedPrivateKeys? privateKeys}) Future<Uint8List>
Prepare a private key renewal, so it can be stored on SSKS without risk of loss during the actual renew
pushJWT(String jwt) → void
Pushes a given JWT to the Seald server, for example, to add a connector to the current account.
pushJWTAsync(String jwt) Future<void>
Pushes a given JWT to the Seald server, for example, to add a connector to the current account.
removeConnector(String connectorId) SealdConnector
Remove a connector belonging to the current account.
removeConnectorAsync(String connectorId) Future<SealdConnector>
Remove a connector belonging to the current account.
removeGroupMembers(String groupId, {required List<String> membersToRemove, SealdGeneratedPrivateKeys? privateKeys}) → void
Removes members from the group. Can only be done by a group administrator. You should call renewGroupKey after this.
removeGroupMembersAsync(String groupId, {required List<String> membersToRemove, SealdGeneratedPrivateKeys? privateKeys}) Future<void>
Removes members from the group. Can only be done by a group administrator. You should call renewGroupKey after this.
renewGroupKey(String groupId, {SealdGeneratedPrivateKeys? privateKeys}) → void
Renews the group's private key. Can only be done by a group administrator. Should be called after removing members from the group.
renewGroupKeyAsync(String groupId, {SealdGeneratedPrivateKeys? privateKeys}) Future<void>
Renews the group's private key. Can only be done by a group administrator. Should be called after removing members from the group.
renewKeys({Uint8List? preparedRenewal, SealdGeneratedPrivateKeys? privateKeys, Duration expireAfter = const Duration(days: 5 * 365)}) → void
Renews the keys of the current device, extending their validity. If the current device has expired, you will need to call renewKeys before you are able to do anything else. Warning: if the identity of the current device is stored externally, for example on SSKS, you will want to re-export it and store it again, otherwise the previously stored identity will not be recognized anymore.
renewKeysAsync({Uint8List? preparedRenewal, SealdGeneratedPrivateKeys? privateKeys, Duration expireAfter = const Duration(days: 5 * 365)}) Future<void>
Renews the keys of the current device, extending their validity. If the current device has expired, you will need to call renewKeys before you are able to do anything else. Warning: if the identity of the current device is stored externally, for example on SSKS, you will want to re-export it and store it again, otherwise the previously stored identity will not be recognized anymore.
retrieveConnector(String connectorId) SealdConnector
Retrieve a connector by its connectorId, then updates the local cache of connectors.
retrieveConnectorAsync(String connectorId) Future<SealdConnector>
Retrieve a connector by its connectorId, then updates the local cache of connectors.
retrieveEncryptionSession({String? sessionId, String? message, String? filePath, Uint8List? fileBytes, bool useCache = true, bool lookupProxyKey = false, bool lookupGroupKey = true}) SealdEncryptionSession
Retrieve an encryption session, and returns the associated SealdEncryptionSession instance, with which you can then encrypt/decrypt multiple messages.
retrieveEncryptionSessionAsync({String? sessionId, String? message, String? filePath, Uint8List? fileBytes, bool useCache = true, bool lookupProxyKey = false, bool lookupGroupKey = true}) Future<SealdEncryptionSession>
Retrieve an encryption session, and returns the associated SealdEncryptionSession instance, with which you can then encrypt/decrypt multiple messages.
retrieveEncryptionSessionByTmr(String tmrJWT, String sessionId, Uint8List overEncryptionKey, SealdTmrAccessesRetrievalFilters tmrAccessesFilters, {bool tryIfMultiple = true, bool useCache = true}) SealdEncryptionSession
Retrieve an encryption session with a TMR access JWT.
retrieveEncryptionSessionByTmrAsync(String tmrJWT, String sessionId, Uint8List overEncryptionKey, {SealdTmrAccessesRetrievalFilters? tmrAccessesFilters, bool tryIfMultiple = true, bool useCache = true}) Future<SealdEncryptionSession>
Retrieve an encryption session with a TMR access JWT.
retrieveMultipleEncryptionSessions(List<String> sessionIds, {bool useCache = true, bool lookupProxyKey = false, bool lookupGroupKey = true}) List<SealdEncryptionSession>
Retrieve multiple encryption sessions with a List of sessionIds, and return a List of the associated EncryptionSession instances, with which you can then encrypt / decrypt multiple messages. The returned List of EncryptionSession instances is in the same order as the input List.
retrieveMultipleEncryptionSessionsAsync(List<String> sessionIds, {bool useCache = true, bool lookupProxyKey = false, bool lookupGroupKey = true}) Future<List<SealdEncryptionSession>>
Retrieve multiple encryption sessions with a List of sessionIds, and return a List of the associated EncryptionSession instances, with which you can then encrypt / decrypt multiple messages. The returned List of EncryptionSession instances is in the same order as the input List.
setGroupAdmins(String groupId, {List<String> addToAdmins = const [], List<String> removeFromAdmins = const []}) → void
Adds some existing group members to the group admins, and/or removes admin status from some existing group admins. Can only be done by a group administrator.
setGroupAdminsAsync(String groupId, {List<String> addToAdmins = const [], List<String> removeFromAdmins = const []}) Future<void>
Adds some existing group members to the group admins, and/or removes admin status from some existing group admins. Can only be done by a group administrator.
toString() String
A string representation of this object.
inherited
updateCurrentDevice() → void
Updates the locally known information about the current device.
validateConnector(String connectorId, String challenge) SealdConnector
Validate an added connector that was added without a preValidationToken.
validateConnectorAsync(String connectorId, String challenge) Future<SealdConnector>
Validate an added connector that was added without a preValidationToken.

Operators

operator ==(Object other) bool
The equality operator.
inherited