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

activeDisplayName

Display name to use for the active user. It can be nil if a session has not been created.

@property (nullable, nonatomic, strong) NSString *activeDisplayName

Declared In

Bit6Session.h

activeIdentity

Active user identity as a Bit6Address object. It can be nil if a session has not been created.

@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

currentDevice

Unique identifier for this device for the active user.

@property (nullable, nonatomic, readonly, strong) NSString *currentDevice

Declared In

Bit6Session.h

devices

List of device identifiers for the active user.

@property (nullable, nonatomic, readonly, strong) NSArray<NSString*> *devices

Declared In

Bit6Session.h

identities

List of user identities for the current session.

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

Declared In

Bit6Session.h

rtConnectionStatus

Web Socket connection status.

@property (nonatomic, readonly) Bit6WebSocketReadyState 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:(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:(NSString *)oldPassword newPassword:(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

init

Unavailable init. Use Bit6.session instead.

- (instancetype)init

Return Value

a new instance of the class.

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:(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:(Bit6Address *)userIdentity password:(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:(NSString *)provider params:(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:(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:(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:(Bit6Address *)userIdentity password:(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