Overview
The fundamental execution of the Credenza Passport library requires users to authenticate themselves and the app to then have essential metadata for the logged in user. These methods provide that functionality.
Available Methods
handleSignIn(_ emailAddress: String)
public func handleSignIn(_ emailAddress: String) Handles sign-in for a given email address using Magic.link SDK. Stores the login token in UserDefaults after successful authentication.
Parameters:
emailAddress: An email address for which to perform sign-in.
getAccount
public func getAccount() Gets the user's Ethereum public address using the Magic.link SDK and passes it to the delegation instance. Calls loginComplete(address:) of the delegation instance to pass the Ethereum public address to it.
showPassportIDQRCode
public func showPassportIDQRCode()Generates a QR Code that represents the user’s identity (“Passport ID”) for use by a Credenza-compliant scanner. Will only work with logged in user.
getWalletPass
public func getWalletPass()Generates an Pass that can be installed into Apple Wallet that represents the user’s identity (“Passport ID”) for use by a Credenza-compliant scanner. Will only work with logged in user.
PassScan
public func PassScan () This function will launch a scanner for a user to read a special PassScan QR Code and performs the operation defined by the QR Code. This oftens leads to an airdrop of a token or the deposit of loyalty points. Will only work with logged in user.
queryRuleset
public func queryRuleset(string payload)This function will pass a payload of configuration information on the user (Passport ID) and ruleset ID and allow the rules engine to provide the appropriate discount or access code that can be used by a client application.
Parameters:
payload: A combination of the PassportID metadata and Ruleset ID.
Example payload:
{"passportId": {"scanType":"PASSPORT_ID","payload":"1691400329134","chainId":"80001","sig":"0xc06d442a9b9254c4985b33c43d3c970d73651ec5ef299d02b3c8203ec68c88493cb1d55199ba3fc7cf2af8c124635853b6f7ad0ba689cd85918c3feb396dbeab1c"}, "ruleSetId": "64d0d7b9ae22c3ae7d035cdc"}