|
| LimeManager (String db_access, LimePostToX3DH postObj) |
| Lime Manager constructor. More...
|
|
native void | nativeDestructor () |
| Native ressource destructor We cannot rely on finalize (deprecated since java9), it must explicitely be called before the object is destroyed by the java environment. More...
|
|
void | create_user (String localDeviceId, String serverURL, LimeCurveId curveId, int OPkInitialBatchSize, LimeStatusCallback statusObj) throws LimeException |
| Create a user in local database and publish it on the given X3DH server. More...
|
|
void | create_user (String localDeviceId, String serverURL, LimeCurveId curveId, LimeStatusCallback statusObj) throws LimeException |
|
native void | delete_user (String localDeviceId, LimeStatusCallback statusObj) throws LimeException |
| Delete a user from local database and from the X3DH server. More...
|
|
native boolean | is_user (String localDeviceId) throws LimeException |
| Check if a user is present and active in local storage. More...
|
|
void | encrypt (String localDeviceId, String recipientUserId, RecipientData[] recipients, byte[] plainMessage, LimeOutputBuffer cipherMessage, LimeStatusCallback statusObj, LimeEncryptionPolicy encryptionPolicy) |
| Encrypt a buffer (text or file) for a given list of recipient devices. More...
|
|
void | encrypt (String localDeviceId, String recipientUserId, RecipientData[] recipients, byte[] plainMessage, LimeOutputBuffer cipherMessage, LimeStatusCallback statusObj) |
|
LimePeerDeviceStatus | decrypt (String localDeviceId, String recipientUserId, String senderDeviceId, byte[] DRmessage, byte[] cipherMessage, LimeOutputBuffer plainMessage) |
| Decrypt the given message. More...
|
|
LimePeerDeviceStatus | decrypt (String localDeviceId, String recipientUserId, String senderDeviceId, byte[] DRmessage, LimeOutputBuffer plainMessage) |
|
void | update (LimeStatusCallback statusObj, int OPkServerLowLimit, int OPkBatchSize) |
| Update: shall be called once a day at least, performs checks, updates and cleaning operations. More...
|
|
void | update (LimeStatusCallback statusObj) |
|
native void | get_selfIdentityKey (String localDeviceId, LimeOutputBuffer Ik) throws LimeException |
| retrieve self Identity Key, an EdDSA formatted public key More...
|
|
void | set_peerDeviceStatus (String peerDeviceId, byte[] Ik, LimePeerDeviceStatus status) throws LimeException |
| set the peer device status flag in local storage: unsafe, trusted or untrusted. More...
|
|
void | set_peerDeviceStatus (String peerDeviceId, LimePeerDeviceStatus status) |
| set the peer device status flag in local storage: unsafe or untrusted. More...
|
|
LimePeerDeviceStatus | get_peerDeviceStatus (String peerDeviceId) |
| get the status of a peer device: unknown, untrusted, trusted, unsafe More...
|
|
native void | delete_peerDevice (String peerDeviceId) |
| delete a peerDevice from local storage More...
|
|
native void | set_x3dhServerUrl (String localDeviceId, String serverURL) throws LimeException |
| Set the X3DH key server URL for this identified user if specified localDeviceId is not found in local Storage, throw an exception. More...
|
|
native void | stale_sessions (String localDeviceId, String peerDeviceId) throws LimeException |
| Stale all sessions between localDeviceId and peerDevice. If peerDevice keep using this session to encrypt and we decrypt with success, the session will be reactivated but to encrypt a message to this peerDevice, a new session will be created. If no session is active between the given device, this call has no effect. More...
|
|
native String | get_x3dhServerUrl (String localDeviceId) throws LimeException |
| Get the X3DH key server URL for this identified user if specified localDeviceId is not found in local Storage, throw an exception. More...
|
|
A java wrapper around the native Lime Manager interface.
To use this wrapper you must implement the interfaces
- LimePostToX3DH to communicate with the X3DH Https server
- LimeStatusCallback to manage the lime response to asynchronous operations: create/delete users, encrypt, update
Encrypt a buffer (text or file) for a given list of recipient devices.
if specified localDeviceId is not found in local Storage, throw an exception
Clarification on recipients:
recipients information needed are a list of the device Id and one userId. The device Id shall be their GRUU while the userId is a sip:uri.
recipient User Id is used to identify the actual intended recipient. Example: alice have two devices and is signed up on a conference having
bob and claire as other members. The recipientUserId will be the conference sip:uri and device list will include:
- alice other device
- bob devices
- claire devices
If Alice write to Bob only, the recipientUserId will be bob sip:uri and recipient devices list :
- alice other device
- bob devices
In all cases, the identified source of the message will be the localDeviceId
If the X3DH server can't provide keys for a peer device, its status is set to fail and its DRmessage is empty. Other devices get their encrypted message
If no peer device could get encrypted for all of them are missing keys on the X3DH server, the callback will be called with fail exit status
- Note
- nearly all parameters are shared pointers as the process being asynchronous, the ownership will be taken internally exempting caller to manage the buffers.
- Parameters
-
[in] | localDeviceId | used to identify which local acount to use and also as the identified source of the message, shall be the GRUU |
[in] | recipientUserId | the Id of intended recipient, shall be a sip:uri of user or conference, is used as associated data to ensure no-one can mess with intended recipient |
[in,out] | recipients | a list of RecipientData holding:
- the recipient device Id(GRUU)
- an empty buffer to store the DRmessage which must then be routed to that recipient
- the peer Status. If peerStatus is set to fail, this entry is ignored otherwise the peerStatus is set by the encrypt, see LimePeerDeviceStatus definition for details
|
[in] | plainMessage | a buffer holding the message to encrypt, can be text or data. |
[out] | cipherMessage | points to the buffer to store the encrypted message which must be routed to all recipients(if one is produced, depends on encryption policy) |
[in] | statusObj | Performing encryption may involve the X3DH server and is thus asynchronous, when the operation is completed, this statusObj.callback will be called giving the exit status and an error message in case of failure. It is advised to store a reference to cipherMessage and recipients in this object so they can access the output of encryption as it won't be part of the callback parameters. |
[in] | encryptionPolicy | select how to manage the encryption: direct use of Double Ratchet message or encrypt in the cipher message and use the DR message to share the cipher message key default is optimized output size mode. |
set the peer device status flag in local storage: unsafe, trusted or untrusted.
- Parameters
-
[in] | peerDeviceId | The device Id of peer, shall be its GRUU |
[in] | Ik | the EdDSA peer public identity key, formatted as in RFC8032 |
[in] | status | value of flag to set: accepted values are trusted, untrusted, unsafe |
throw an exception if given key doesn't match the one present in local storage if the status flag value is unexpected (not one of trusted, untrusted, unsafe), ignore the call if the status flag is unsafe or untrusted, ignore the value of Ik and call the version of this function without it
if peer Device is not present in local storage and status is trusted or unsafe, it is added, if status is untrusted, it is just ignored
General algorithm followed by the set_peerDeviceStatus functions
- Status is valid? (not one of trusted, untrusted, unsafe)? No: return
- status is trusted
- We have Ik? -> No: return
- Device is already in storage but Ik differs from the given one : exception
- Insert/update in local storage
- status is untrusted
- Ik is ignored
- Device already in storage? No: return
- Device already in storage but current status is unsafe? Yes: return
- update in local storage -status is unsafe
- ignore Ik
- insert/update the status. If inserted, insert an invalid Ik
void org.linphone.lime.LimeManager.set_peerDeviceStatus |
( |
String |
peerDeviceId, |
|
|
LimePeerDeviceStatus |
status |
|
) |
| |
|
inline |
set the peer device status flag in local storage: unsafe or untrusted.
This variation allows to set a peer Device status to unsafe or untrusted only whithout providing its identity key Ik
- Parameters
-
[in] | peerDeviceId | The device Id of peer, shall be its GRUU |
[in] | status | value of flag to set: accepted values are untrusted or unsafe |
if the status flag value is unexpected (not one of untrusted, unsafe), ignore the call
if peer Device is not present in local storage, it is inserted if status is unsafe and call is ignored if status is untrusted if the status is untrusted but the current status in local storage is unsafe, ignore the call Any call to the other form of the function with a status to unsafe or untrusted is rerouted to this function