mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 16:22:39 +00:00
69 lines
No EOL
2.3 KiB
Objective-C
69 lines
No EOL
2.3 KiB
Objective-C
/*
|
|
Copyright 2014 OpenMarket Ltd
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import "MX3PID.h"
|
|
|
|
typedef enum : NSUInteger {
|
|
MXC3PIDAuthStateUnknown,
|
|
MXC3PIDAuthStateTokenRequested,
|
|
MXC3PIDAuthStateTokenReceived,
|
|
MXC3PIDAuthStateTokenSubmitted,
|
|
MXC3PIDAuthStateAuthenticated
|
|
} MXC3PIDAuthState;
|
|
|
|
|
|
@interface MXC3PID : MX3PID
|
|
|
|
@property (nonatomic, readonly) MXC3PIDAuthState validationState;
|
|
|
|
/**
|
|
Start the validation process
|
|
The identity server will send a validation token to the user's address.
|
|
This validation token must be then send back to the identity server with [MXC3PID validateWithToken]
|
|
in order to complete the 3PID authentication.
|
|
|
|
@param success A block object called when the operation succeeds.
|
|
@param failure A block object called when the operation fails.
|
|
*/
|
|
- (void)requestValidationToken:(void (^)())success
|
|
failure:(void (^)(NSError *error))failure;
|
|
|
|
/**
|
|
Complete the 3rd party id validation by sending the validation token the user received.
|
|
|
|
@param validationToken the validation token the user received.
|
|
@param success A block object called when the operation succeeds. It indicates if the
|
|
validation has succeeded.
|
|
@param failure A block object called when the operation fails.
|
|
*/
|
|
- (void)validateWithToken:(NSString*)validationToken
|
|
success:(void (^)(BOOL success))success
|
|
failure:(void (^)(NSError *error))failure;
|
|
|
|
/**
|
|
Link an authenticated 3rd party id to a Matrix user id.
|
|
|
|
@param userId the Matrix user id to link the 3PID with.
|
|
@param success A block object called when the operation succeeds. It provides the raw
|
|
server response.
|
|
@param failure A block object called when the operation fails.
|
|
*/
|
|
- (void)bindWithUserId:(NSString*)userId
|
|
success:(void (^)())success
|
|
failure:(void (^)(NSError *error))failure;
|
|
|
|
@end |