SINClientRegistration
Objective-C
@protocol SINClientRegistration <NSObject>
Swift
protocol SINClientRegistration : NSObjectProtocol
Callback object to be used to proceed in user registration process when registration credentials for the user in question have been obtained.
-
Proceed with user registration by providing a signed JWT (JSON Web Token).
The JWT should contain the following JWT header parameters:
- ‘alg’: ‘HS256’,
- ‘kid’: ‘hkdfv1-{date}’, where date is in UTC on the format YYYYMMDD.
The JWT should contain the following claims:
- ‘iss’: ‘//rtc.sinch.com/applications/{applicationKey}’
- ‘sub’: ‘//rtc.sinch.com/applications/{applicationKey}/users/{userId}’
- ‘iat’: See https://tools.ietf.org/html/rfc7519#section-4.1.1
- ‘exp’: See https://tools.ietf.org/html/rfc7519#section-4.1.4
- ‘nonce’: A unique cryptographic nonce. E.g. a random string that has been generated using a cryptographically strong PRNG.
The JWT should be signed using a signing key derived from the Sinch Application Secret as follows. Given a function
HMAC256(key, message)
, a date-formatting functionFormatDate(date, format)
, and the current date as variablenow
, derive the signing key as follows:signingKey = HMAC256(applicationSecret, UTF8-ENCODE(FormatDate(now, "YYYYMMDD")));
Declaration
Objective-C
- (void)registerWithJWT:(NSString *)jwt;
Swift
func register(withJWT jwt: String!)
Parameters
jwt
signed JWT (JSON Web Token)
-
If the application fails to provide a signed user registration token (JWT), it must notify the Sinch client via this method.
Calling this method will have the effect that the client delegate will receive a call to
-[SINClientDelegate clientDidFail:error:]
.See
SINClient, SINClientDelegate
Declaration
Objective-C
- (void)registerDidFail:(NSError *)error;
Swift
func registerDidFail(_ error: Error!)
Parameters
error
Error that prevented obtaining a user registration token (JWT).