Bit6Session Class Reference
Inherits from | NSObject |
Declared in | Bit6Session.h |
Overview
A Bit6Session object contains the session information about the current connection to the Bit6 platform. It allows the user to sign up for a new account with the app, login into an existing account or logout.
Tasks
Start/Destroy a session
-
– signUpWithUserIdentity:password:completionHandler:
-
– loginWithUserIdentity:password:completionHandler:
-
– anonymousWithCompletionHandler:
-
– getAuthInfoCompletionHandler:
-
– oauthForProvider:params:completion:
-
– authWithExternalToken:completionHandler:
-
– logoutWithCompletionHandler:
Identities
-
activeIdentity
property -
identities
property -
– isMyIdentity:
Public/Private Profiles
Properties
-
authenticated
property -
rtConnectionStatus
property
Password
Properties
activeIdentity
Active user identity as a Bit6Address object. It can be nil if a session has not been created. Only values returned in [Bit6Session identities] can be set in this property.
@property (nullable, nonatomic, strong) Bit6Address *activeIdentity
Declared In
Bit6Session.h
authenticated
Checks if the user is authenticated with the Bit6 platform and the session has been established.
@property (nonatomic) BOOL authenticated
Declared In
Bit6Session.h
Instance Methods
anonymousWithCompletionHandler:
Signs in using an anonymous account.
- (void)anonymousWithCompletionHandler:(nullable Bit6CompletionHandler)completion
Parameters
- completion
Block to call after the operation has been completed. The “error” value can be use to know if the session was initiated.
Declared In
Bit6Session.h
authWithExternalToken:completionHandler:
Signs in using a token from an external Service.
- (void)authWithExternalToken:(nonnull NSString *)token completionHandler:(nullable Bit6CompletionHandler)completion
Parameters
- token
token to be used to authenticate the user
- completion
Block to call after the operation has been completed. The “error” value can be use to know if the session was initiated.
Declared In
Bit6Session.h
changePassword:newPassword:completionHandler:
Change the password for the current user
- (void)changePassword:(nonnull NSString *)oldPassword newPassword:(nonnull NSString *)newPassword completionHandler:(nullable Bit6CompletionHandler)completion
Parameters
- oldPassword
the user’s old password
- newPassword
the new password for the user
- completion
Block to call after the operation has been completed.
Declared In
Bit6Session.h
getAuthInfoCompletionHandler:
Get the OAuth configurations available.
- (void)getAuthInfoCompletionHandler:(nullable Bit6CompletionHandler)completion
Parameters
- completion
Block to be executed after the operation has been completed.
Declared In
Bit6Session.h
isMyIdentity:
Convenience method to find if an Bit6Address identity belongs to the current user. This is done by performing a loop through [Bit6Session identities] to try to find the identity.
- (BOOL)isMyIdentity:(nonnull Bit6Address *)address
Parameters
- address
identity to search
Return Value
YES if the address belongs to the current user.
See Also
Declared In
Bit6Session.h
loginWithUserIdentity:password:completionHandler:
Signs into an existing account.
- (void)loginWithUserIdentity:(nonnull Bit6Address *)userIdentity password:(nonnull NSString *)pass completionHandler:(nullable Bit6CompletionHandler)completion
Parameters
- userIdentity
Bit6Address object that represents the local user
- pass
User’s password
- completion
Block to call after the operation has been completed. The “error” value can be use to know if the session was initiated.
Declared In
Bit6Session.h
logoutWithCompletionHandler:
Ends the current session.
- (void)logoutWithCompletionHandler:(nullable Bit6CompletionHandler)completion
Parameters
- completion
Block to be executed after the operation has been completed.
Declared In
Bit6Session.h
oauthForProvider:params:completion:
Signs in using an OAuth provider
- (void)oauthForProvider:(nonnull NSString *)provider params:(nonnull NSDictionary<NSString*,id> *)params completion:(nullable Bit6CompletionHandler)completion
Parameters
- provider
the provider to use.
- params
additional params required to perform the sign in. If provided it has to be able to be converted to JSON data (check by using +[NSJSONSerialization isValidJSONObject:])
- completion
Block to be executed after the operation has been completed. The “error” value can be use to know if the session was initiated.
Declared In
Bit6Session.h
privateData
Private profile of the current user.
- (nullable NSDictionary<NSString*,id> *)privateData
Declared In
Bit6Session.h
publicProfile
Public profile of the current user.
- (nullable NSDictionary<NSString*,id> *)publicProfile
Declared In
Bit6Session.h
setPrivateData:completion:
Used to set the private profile of the current user.
- (void)setPrivateData:(nonnull NSDictionary<NSString*,id> *)privateData completion:(nullable Bit6CompletionHandler)completion
Parameters
- privateData
New private profile for the current user. If provided it has to be able to be converted to JSON data (check by using +[NSJSONSerialization isValidJSONObject:])
- completion
Block to call after the operation has been completed.
Declared In
Bit6Session.h
setPublicProfile:completion:
Used to set the public profile of the current user.
- (void)setPublicProfile:(nonnull NSDictionary<NSString*,id> *)publicProfile completion:(nullable Bit6CompletionHandler)completion
Parameters
- publicProfile
New public profile for the current user. If provided it has to be able to be converted to JSON data (check by using +[NSJSONSerialization isValidJSONObject:])
- completion
Block to call after the operation has been completed.
Declared In
Bit6Session.h
signUpWithUserIdentity:password:completionHandler:
Creates an account and initiates the session.
- (void)signUpWithUserIdentity:(nonnull Bit6Address *)userIdentity password:(nonnull NSString *)pass completionHandler:(nullable Bit6CompletionHandler)completion
Parameters
- userIdentity
A Bit6Address object that represents the local user.
- pass
User’s password
- completion
Block to call after the operation has been completed. The “error” value can be use to know if the account was created.
Declared In
Bit6Session.h