Skip to content

Commit

Permalink
Added documentation to registerDevice
Browse files Browse the repository at this point in the history
  • Loading branch information
phil1995 committed Dec 27, 2023
1 parent 9476edb commit e797b2a
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,19 @@ public class CryptomatorHubAuthenticator: HubDeviceRegistering, HubKeyReceiving
return .success(.init(encryptedUserKey: encryptedUserKeyJWE, encryptedVaultKey: encryptedVaultKeyJWE, header: [:]))
}

public func registerDevice(withName name: String, hubConfig: HubConfig, authState: OIDAuthState, setupCode: String) async throws {
/** Registers a new device.

Registers a new mobile device at the hub instance derived from the `hubConfig` with the given `name`.

The device registration consists of two requests:

1. Request the encrypted user key which can be decrypted by using the `setupCode`.
2. Send a Create Device request to the hub instance which contains the user key encrypted with the device key pair
*/
public func registerDevice(withName name: String,
hubConfig: HubConfig,
authState: OIDAuthState,
setupCode: String) async throws {
guard let apiBaseURL = hubConfig.getAPIBaseURL() else {
throw CryptomatorHubAuthenticatorError.invalidBaseURL
}
Expand Down

0 comments on commit e797b2a

Please sign in to comment.