UserOperations
public struct UserOperations
IronOxide User Operations
Key Terms
- Device - The only entity in the Data Control Platform that can decrypt data. A device is authorized using a user’s private key, therefore a device is tightly bound to a user.
- ID - The ID representing a user or device. It must be unique within its segment and will not be encrypted.
- Password - The string used to encrypt and escrow a user’s private key.
- Rotation - Changing a user’s private key while leaving their public key unchanged. This can be accomplished by calling
SDK.user.rotatePrivateKey
.
-
Lists all of the devices for the current user.
Declaration
Swift
public func listDevices() -> Result<UserDeviceListResult, IronOxideError>
-
Gets users’ public keys given their IDs.
Allows discovery of which user IDs have keys in the IronCore system to help determine if they can be added to groups or have documents shared with them.
Only returns users whose keys were found in the IronCore system.
Declaration
Swift
public func getPublicKey(users: [UserId]) -> Result<[UserWithKey], IronOxideError>
Parameters
users
List of user IDs to check
-
Deletes a device.
If deleting the currently signed-in device, the SDK will need to be re-initialized with
IronOxide.initialize
before further use.Returns the ID of the deleted device.
Declaration
Swift
public func deleteDevice(deviceId: DeviceId?) -> Result<DeviceId, IronOxideError>
Parameters
deviceId
ID of the device to delete. If
nil
, deletes the current device -
Rotates the current user’s private key while leaving their public key the same.
There’s no black magic here! This is accomplished via multi-party computation with the IronCore webservice.
The main use case for this is a workflow that requires that users be generated prior to the user logging in for the first time. In this situation, a user’s cryptographic identity can be generated by a third party, like a server process, and then the user can take control of their keys by rotating their private key.
Declaration
Swift
public func rotatePrivateKey(password: String) -> Result<UserUpdatePrivateKeyResult, IronOxideError>
Parameters
password
Password to unlock the current user’s private key