Skip to main content

KeyManagementAPI

MethodHTTP requestDescription
addPubkeyPOST /pubkeys/{pubkey}Add pubkey for current user
addPubkeyForUserPOST /users/{user_id}/pubkeys/{pubkey}Add pubkey for user by user_id
createWalletPOST /pubkeysGenerate custodial wallet
getPubkeysGET /pubkeysRetrieve pubkeys
getPubkeysForUserGET /users/{user_id}/pubkeysRetrieve pubkeys by user_id

addPubkey#

Add pubkey for current user This call expects empty body

Request with Combine's publisher:#

public func addPubkeyPublisher(pubkey: String) -> AnyPublisher<String, APIError>

Example:#

import YatLib
let pubkey = "pubkey_example" // String | var cancelables = Set<AnyCancellable>()
Yat.api.keyManagement.addPubkeyPublisher(pubkey: pubkey)    .sink(        receiveCompletion: { [weak self] in /* Handle completion/failure */ },        receiveValue: { /* Handle response */ }    )    .store(in: &cancelables)

Request with closure:#

public func addPubkey(pubkey: String, result: @escaping (Result<String, APIError>) -> Void)

Example#

import YatLib
let pubkey = "pubkey_example" // String | 
Yat.api.keyManagement.addPubkey(pubkey: String { result in    switch result {        case let .success(model):        // Handle response        case let .failure(error):        // Handle failure    }}

Parameters#

NameTypeDescriptionNotes
pubkeyString

Return type#

String

Authorization#

two_factor

[Back to top] [Back to API list] [Back to Model list] [Back to index]

addPubkeyForUser#

Add pubkey for user by user_id NOTE: user should have scope UserPubkeyWrite This call expects empty body

Request with Combine's publisher:#

public func addPubkeyForUserPublisher(userId: String, pubkey: UUID) -> AnyPublisher<String, APIError>

Example:#

import YatLib
let userId = "userId_example" // String | Public key to addlet pubkey = 987 // UUID | `user_id` to grant public key ownership tovar cancelables = Set<AnyCancellable>()
Yat.api.keyManagement.addPubkeyForUserPublisher(userId: userId, pubkey: pubkey)    .sink(        receiveCompletion: { [weak self] in /* Handle completion/failure */ },        receiveValue: { /* Handle response */ }    )    .store(in: &cancelables)

Request with closure:#

public func addPubkeyForUser(userId: String, pubkey: UUID, result: @escaping (Result<String, APIError>) -> Void)

Example#

import YatLib
let userId = "userId_example" // String | Public key to addlet pubkey = 987 // UUID | `user_id` to grant public key ownership to
Yat.api.keyManagement.addPubkeyForUser(userId: String, pubkey: UUID { result in    switch result {        case let .success(model):        // Handle response        case let .failure(error):        // Handle failure    }}

Parameters#

NameTypeDescriptionNotes
userIdStringPublic key to add
pubkeyUUID`user_id` to grant public key ownership to

Return type#

String

Authorization#

two_factor

[Back to top] [Back to API list] [Back to Model list] [Back to index]

createWallet#

Generate custodial wallet Generates custodial wallet with pubkey for currently authenticated user. This call expects empty body.

Request with Combine's publisher:#

public func createWalletPublisher() -> AnyPublisher<String, APIError>

Example:#

import YatLib
var cancelables = Set<AnyCancellable>()
Yat.api.keyManagement.createWalletPublisher()    .sink(        receiveCompletion: { [weak self] in /* Handle completion/failure */ },        receiveValue: { /* Handle response */ }    )    .store(in: &cancelables)

Request with closure:#

public func createWallet(result: @escaping (Result<String, APIError>) -> Void)

Example#

import YatLib

Yat.api.keyManagement.createWallet( { result in    switch result {        case let .success(model):        // Handle response        case let .failure(error):        // Handle failure    }}

Parameters#

This endpoint does not need any parameter.

Return type#

String

Authorization#

two_factor

[Back to top] [Back to API list] [Back to Model list] [Back to index]

getPubkeys#

Retrieve pubkeys Retrieves pubkeys owned by currently authenticated user. This call expects empty body.

Request with Combine's publisher:#

public func getPubkeysPublisher() -> AnyPublisher<[String], APIError>

Example:#

import YatLib
var cancelables = Set<AnyCancellable>()
Yat.api.keyManagement.getPubkeysPublisher()    .sink(        receiveCompletion: { [weak self] in /* Handle completion/failure */ },        receiveValue: { /* Handle response */ }    )    .store(in: &cancelables)

Request with closure:#

public func getPubkeys(result: @escaping (Result<[String], APIError>) -> Void)

Example#

import YatLib

Yat.api.keyManagement.getPubkeys( { result in    switch result {        case let .success(model):        // Handle response        case let .failure(error):        // Handle failure    }}

Parameters#

This endpoint does not need any parameter.

Return type#

[String]

Authorization#

apiKey

[Back to top] [Back to API list] [Back to Model list] [Back to index]

getPubkeysForUser#

Retrieve pubkeys by user_id NOTE: user should have scope UserPubkeyList

Request with Combine's publisher:#

public func getPubkeysForUserPublisher(userId: UUID) -> AnyPublisher<[String], APIError>

Example:#

import YatLib
let userId = 987 // UUID | var cancelables = Set<AnyCancellable>()
Yat.api.keyManagement.getPubkeysForUserPublisher(userId: userId)    .sink(        receiveCompletion: { [weak self] in /* Handle completion/failure */ },        receiveValue: { /* Handle response */ }    )    .store(in: &cancelables)

Request with closure:#

public func getPubkeysForUser(userId: UUID, result: @escaping (Result<[String], APIError>) -> Void)

Example#

import YatLib
let userId = 987 // UUID | 
Yat.api.keyManagement.getPubkeysForUser(userId: UUID { result in    switch result {        case let .success(model):        // Handle response        case let .failure(error):        // Handle failure    }}

Parameters#

NameTypeDescriptionNotes
userIdUUID

Return type#

[String]

Authorization#

apiKey

[Back to top] [Back to API list] [Back to Model list] [Back to index]