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

Init

  • 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])

    Parameters

    networkService

    A networking service instance used for converting twitter handles into twitter id’s

    verifiers

    List of verifiers available to the library for the given app context

Public functions

  • Create a TorusWallet insteace from a social media provider

    Declaration

    Swift

    public func createWallet(from authType: TorusAuthProvider, displayOver: UIViewController?, mockedTorus: CustomAuth? = nil, completion: @escaping ((Result<TorusWallet, KukaiError>) -> Void))

    Parameters

    from

    The TorusAuthProvider that you want to invoke

    displayOver

    The UIViewController that the webpage will display on top of

    mockedTorus

    To avoid issues attempting to stub aspects of the Torus SDK, a mocked version of the SDK can be supplied instead

    completion

    The 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

    from

    The TorusAuthProvider that you want to invoke

    for

    The social media username to search for

    completion

    The callback returned when all the networking and cryptography is complete

  • Take in a Twitter username and fetch the Twitter userId instead.

    Declaration

    Swift

    public func twitterLookup(username: String, completion: @escaping ((Result<String, KukaiError>) -> Void))

    Parameters

    username

    The users username. Can contain an @ symbol, but will be stripped out by the code as its not required

    completion

    The callback fired when the userId has been found

Types