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.

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

identities

List of user identities for the current session.

@property (nonnull, nonatomic, readonly) NSArray<Bit6Address*> *identities

Declared In

Bit6Session.h

rtConnectionStatus

Web Socket connection status.

@property (nonatomic, readonly) Bit6RTStatus rtConnectionStatus

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.

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