PromiseWrapper
public final class PromiseWrapper : WebcomWrapper, CustomDebugStringConvertible
The type that wraps AuthenticationMethodInternal
in order to enrich it with a PromiseKit-based API.
See also the documentation section of WebcomWrapper
for the corresponding wrapped type.
To use this type, import the following dependency in your code:
import WebcomPromises
-
Declaration
Swift
public let wrapped: AuthenticationMethodInternal
-
Requests to send a link to the user, which allows him/her to reset his/her password.
Only use this method if the authentication mode is
Mode.staticPassword
.Declaration
Swift
public func requestPasswordResetLink() -> Promise<Void>
Return Value
A promise with a void value.
-
Updates the password of the user.
This method may only by used:
- if the authentication mode is
Mode.staticPassword
, - and the
setStaticPassword(_:)
method has been called before.
After using this method, you may safely continue the authentication process using the
AuthenticationService.continueAuthentication()
method.Declaration
Swift
public func updatePassword(_ newPassword: String) -> Promise<Void>
Parameters
newPassword
The new password of the user.
Return Value
A promise with a void value.
- if the authentication mode is
-
Attach a new identity to the current user.
This method is to be used only for sign-up.
To sign-in, use the
setVerificationOneTimePassword(_:)
method when the authentication mode isMode.oneTimePassword
or directly theAuthenticationService.continueAuthentication()
method when the authentication mode isMode.staticPassword
.Declaration
Swift
public func attachIdentity() -> Promise<Void>
Return Value
A promise with a void value.
-
Requests the verification token again.
The verification token was normally sent to the user at sign-up. This method may be used to send it again, if the user has not received it or if he/she has lost it. Only use this method if the authentication mode is
Mode.staticPassword
.Declaration
Swift
public func requestVerificationTokenAgain() -> Promise<Void>
Return Value
A promise with a void value.
-
Requests the provider to send a one-time password for sign-in.
For sign-up, use the
attachIdentity()
method instead.For security reasons, this method returns a fulfilled promise when the user has not yet signed-up, but it does nothing in this case.
Declaration
Swift
public func requestOneTimePassword() -> Promise<Void>
Return Value
A promise with a void value.
-
Processed an operation on the user profile.
Important: This method does not trigger any authentication event. The updated profile will only be available the next time the same user will sign in. The user profile is not designed to store business applicative data about the user. For that purpose, use the
DatasyncService
.Declaration
Swift
public func processProfileOperation(_ operation: ProfileOperation) -> Promise<Void>
Parameters
operation
The operation to process.
Return Value
A promise with a void value.