RatchetClient
@objc(VSRRatchetClient)
open class RatchetClient : BaseClient
extension RatchetClient: RatchetClientProtocol
Implemetation of RatchetClientProtocol
- Tag: RatchetClient
-
Default URL for service
Declaration
Swift
@objc public static let defaultURL: URL
-
Initializes a new
RatchetClient
instanceDeclaration
Swift
public init(accessTokenProvider: AccessTokenProvider, serviceUrl: URL = RatchetClient.defaultURL, connection: HttpConnectionProtocol? = nil, retryConfig: ExpBackoffRetry.Config)
Parameters
accessTokenProvider
Access token provider
serviceUrl
URL of service client will use
connection
custom HTTPConnection
-
Initializes new
RatchetClient
instanceDeclaration
Swift
@objc public convenience init(accessTokenProvider: AccessTokenProvider)
Parameters
accessTokenProvider
Access Token Provider
-
Initializes new
RatchetClient
instanceDeclaration
Swift
@objc public convenience init(accessTokenProvider: AccessTokenProvider, serviceUrl: URL)
Parameters
accessTokenProvider
Access Token Provider
serviceUrl
service URL
-
Uploads public keys
Long-term public key signature should be verified. Upload priority: identity card id > long-term public key > one-time public key. Which means long-term public key can’t be uploaded if identity card id is absent in the cloud and one-time public key can’t be uploaded if long-term public key is absent in the cloud.
Throws
RatchetClientError.constructingUrl
- Rethrows from
ServiceRequest
- Rethrows from
HttpConnectionProtocol
- Rethrows from
JSONDecoder
- Rethrows from
BaseClient
Declaration
Swift
public func uploadPublicKeys(identityCardId: String?, longTermPublicKey: SignedPublicKey?, oneTimePublicKeys: [Data]) throws
Parameters
identityCardId
Identity cardId that should be available on Card service.
longTermPublicKey
long-term public key + its signature created using identity private key. Should be curve25519 in PKCS#8
oneTimePublicKeys
one-time public keys (up to 150 keys in the cloud). Should be curve25519 in PKCS#8
-
Checks list of keys ids and returns subset of that list with already used keys ids
Note
keyId == SHA512(raw 32-byte publicKey)[0..<8]
Throws
Throws:
RatchetClientError.constructingUrl
- Rethrows from
ServiceRequest
- Rethrows from
HttpConnectionProtocol
- Rethrows from
JSONDecoder
- Rethrows from
BaseClient
Declaration
Swift
public func validatePublicKeys(longTermKeyId: Data?, oneTimeKeysIds: [Data]) throws -> ValidatePublicKeysResponse
Parameters
longTermKeyId
long-term public key id to validate
oneTimeKeysIds
list of one-time public keys ids to validate
Return Value
Object with used keys ids
-
Returns public keys set for given identity
Throws
RatchetClientError.constructingUrl
- Rethrows from
ServiceRequest
- Rethrows from
HttpConnectionProtocol
- Rethrows from
JSONDecoder
- Rethrows from
BaseClient
Declaration
Swift
public func getPublicKeySet(forRecipientIdentity identity: String) throws -> PublicKeySet
Parameters
identity
User’s identity
Return Value
Set of public keys
-
Returns public keys sets for given identities.
Throws
RatchetClientError.constructingUrl
- Rethrows from
ServiceRequest
- Rethrows from
HttpConnectionProtocol
- Rethrows from
JSONDecoder
- Rethrows from
BaseClient
Declaration
Swift
public func getMultiplePublicKeysSets(forRecipientsIdentities identities: [String]) throws -> [IdentityPublicKeySet]
Parameters
identities
Users’ identities
Return Value
Sets of public keys
-
Deletes keys entity
Throws
RatchetClientError.constructingUrl
- Rethrows from
ServiceRequest
- Rethrows from
HttpConnectionProtocol
- Rethrows from
JSONDecoder
- Rethrows from
BaseClient
Declaration
Swift
public func deleteKeysEntity() throws