TorusAuthService
public class TorusAuthService : NSObject
extension TorusAuthService: ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding
TorusAuthService is a wrapper around the SDK provided by: https://tor.us/ to allow the creation of TorusWallet‘s.
This allows users to create a wallet from their social media accounts without having to use a seed phrase / mnemonic.
TorusAuthService allows Tezos apps to leverage this service for a number of providers, and also has the ability to query the network for someone else’s wallet address,
based on their social profile. This allows you to send XTZ or tokens to your friend based on their twitter username for example
-
Setup the TorusAuthService verifiers and networking clients for testnet and mainnet, so they can be queried easier.
Declaration
Swift
public init(networkService: NetworkService, verifiers: [TorusAuthProvider : SubverifierWrapper], web3AuthClientId: String)Parameters
networkServiceA networking service instance used for converting twitter handles into twitter id’s
verifiersList of verifiers available to the library for the given app context
-
Create a
TorusWalletinsteace from a social media providerDeclaration
Swift
public func createWallet(from authType: TorusAuthProvider, displayOver: UIViewController?, mockedTorus: CustomAuth? = nil, completion: @escaping ((Result<TorusWallet, KukaiError>) -> Void))Parameters
fromThe
TorusAuthProviderthat you want to invokedisplayOverThe
UIViewControllerthat the webpage will display on top ofmockedTorusTo avoid issues attempting to stub aspects of the Torus SDK, a mocked version of the SDK can be supplied instead
completionThe callback returned when all the networking and cryptography is complete
-
Get a TZ2 address from a social media user name. If Twitter, will first convert the username to a userid and then query
Declaration
Swift
public func getAddress(from authType: TorusAuthProvider, for socialUsername: String, completion: @escaping ((Result<String, KukaiError>) -> Void))Parameters
fromThe
TorusAuthProviderthat you want to invokeforThe social media username to search for
completionThe callback returned when all the networking and cryptography is complete
-
Take in a Twitter id and fetch the Twitter username instead.
Declaration
Swift
public func twitterHandleLookup(id: String, completion: @escaping ((Result<String, KukaiError>) -> Void))Parameters
idThe users ID. Can contain a prefix of “twitter|” or not
completionThe callback fired when the username has been found
-
Take in a Twitter username and fetch the Twitter userId instead.
Declaration
Swift
public func twitterAddressLookup(username: String, completion: @escaping ((Result<String, KukaiError>) -> Void))Parameters
usernameThe users username. Can contain an
@symbol, but will be stripped out by the code as its not requiredcompletionThe callback fired when the userId has been found
-
Declaration
Swift
@MainActor public func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor -
Declaration
Swift
@MainActor public func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error) -
Declaration
Swift
@MainActor public func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization)
Install in Dash