Interacting with Particle Auth on iOS using Swift or Objective-C.
projectId
, clientKey
, and appId
. We’ll be using these down the road.
ParticleAuthCore
, ParticleMPCCore
, and Thresh
pod.
projectId
, clientKey
, and appId
retrieved from the Particle dashboard.
ParticleNetwork-Info.plist
file from the root of your corresponding Xcode project.
ParticleNetworkBase
module in your AppDelegate.swift
file.
application:didFinishLaunchingWithOptions
method:
Info.plist
file and include the following snippet:
auth.switchChain
is used. This enables asynchronous switching. Similar to the initial configuration, chain information derived from ParticleNetwork.ChainInfo
can be passed as the primary parameter, determining the destination chain.
Field | Type | Description |
---|---|---|
chainInfo | ChainInfo | A chainInfo object, can be derived from ParticleNetwork.ChainInfo . |
auth.connect
is the main mechanism for facilitating login (account creation or sign in) with Particle’s Wallet-as-a-Service. Specifically, five key parameters are available within auth.connect
:
Field | Type | Description |
---|---|---|
type | LoginType | The specific social login to be used. This can be either .email , .phone , .google , .apple , .jwt , .facebook , .twitter , .discord , .github , .twitch , .microsoft or linkedin . |
account | String? | (Optional) When type is set to either .email , .phone , or .jwt , you can use the account parameter to pass in an expected email, phone number, or JWT. This is optional for the former two, but required for .jwt . When passing a phone number, it must be in E.164 format. |
code | String? | (Optional) When type is set to either .email pr .phone , you can use the code parameter to pass the verification code. |
socialLoginPrompt | SocialLoginPrompt? | (Optional) Changes what the OAuth provider prompts a user to do; either .none , .consent , or .select_account . Only Google, Discord and Microsoft support it. |
auth.presentLoginPage
is another mechanism for facilitating login (account creation or sign in) with Particle’s Wallet-as-a-Service. Upon calling this method, an authentication UI will be thrown, and the user will be asked to sign in with a specified login method. Specifically, five key parameters are available within auth.presentLoginPage
:
Field | Type | Description |
---|---|---|
type | LoginType | The specific social login to be used. This can be either .email , .phone , .google , .apple , .jwt , .facebook , .twitter , .discord , .github , .twitch , .microsoft or linkedin . |
account | String? | (Optional) When type is set to either .email , .phone , or .jwt , you can use the account parameter to pass in an expected email, phone number, or JWT. This is optional for the former two, but required for .jwt . When passing a phone number, it must be in E.164 format. |
supportAuthTypeode | [SupportAuthType] | The methods of authentication visible on the authentication popup UI. By default, this will be exclusive to the chosen social login method, although by passing in additional types, you can expand the UI to include the ability to login with those as an alternative to type. |
socialLoginPrompt | SocialLoginPrompt? | (Optional) Changes what the OAuth provider prompts a user to do; either .none , .consent , or .select_account . Only Google, Discord and Microsoft support it. |
config | LoginPageConfig? | (Optional) To customize the UI page, contains project name, icon and description. |
auth.getUserInfo
.
auth.getUserInfo() != nil
returns a Boolean based upon the current state of a session (whether or not a user is currently logged into an account). Additionally, an asynchronous method, auth.isConnected
can be called and subscribed to, returning userInfo
upon a status of true
.
auth.disconnect
will simply log a user out of their existing session, assuming they’re logged in.
auth.getUserInfo
and auth.evm.getAddress
to retrieve specific user details. The getUserInfo
response will, by default, include both an associated EVM and Solana address, while auth.evm.getAddress
will return an EVM address, auth.solana.getAddress
will return a Solana address.
ParticleNetwork
has been initialized and a user has successfully logged in, signatures can be proposed for confirmation through a popup
auth.evm.personalSign
or auth.evm.personalSignUnique
method. If you need the same message to return a unique signature each time, use the auth.evm.personalSignUnique
method. Otherwise, the auth.evm.personalSign
method is generally recommended.
Field | Type | Description |
---|---|---|
message | String | Either a hexadecimal string starting with ‘0x’ or a human-readable string is required. |
chainInfo | ChainInfo? | (Optional) Default is current chainInfo, the specific chain selected |
auth.evm.signTypedData
or auth.evm.signTypedDataUnique
method. If you need the same message to return a unique signature each time, use the auth.evm.signTypedDataUnique
method. Otherwise, the auth.evm.signTypedData
method is generally recommended.
Field | Type | Description |
---|---|---|
message | String | Either a hexadecimal string starting with “0x” or a JSON string is required. |
chainInfo | ChainInfo? | (Optional) default is current chainInfo, the specific use which chain to sign |
auth.evm.sendTransaction
.
Field | Type | Description |
---|---|---|
transaction | String | A hexadecimal string starting with “0x” is required. |
chainInfo | ChainInfo? | (Optional) default is current chainInfo, the specific use which chain to sign and send |
auth.solana.signMessage
.
Field | Type | Description |
---|---|---|
message | String | A base58 formatted string is required. |
chainInfo | ChainInfo? | (Optional) default is current chainInfo, the specific use which chain to sign |
auth.solana.signAndSendTransaction
.
Field | Type | Description |
---|---|---|
transaction | String | A base58 formatted string is required. |
chainInfo | ChainInfo? | (Optional) default is current chainInfo, the specific use which chain to sign and send |
auth.solana.signTransaction
.
Field | Type | Description |
---|---|---|
transaction | String | A base58 formatted string is required. |
chainInfo | ChainInfo? | (Optional) default is current chainInfo, the specific use which chain to sign |
auth.solana.signAllTransactions
.
Field | Type | Description |
---|---|---|
transactions | String | Base58 formatted strings are required. |
chainInfo | ChainInfo? | (Optional) default is current chainInfo, the specific use which chain to sign |
TxData
or FeeMarketEIP1559TxData
, also you can use another SDK ParticleWalletAPI
to create transaction, you can reference the examples from Wallet SDK reference, all the rpc methods are defined in ParticleWalletAPI
.
auth.openAccountAndSecurity
. Upon calling this method, a popup allowing the user to control security settings will appear.
promptSettingWhenSign
, which refers to payment (signature) passwords, and promptMasterPasswordSettingWhenLogin
, which refers to a login-based master password.
By default, promptSettingWhenSign
is set to 1, which will show the prompt upon the first signature a given account conducts. If it’s set to 0, it will never be shown; if it’s set to 2, it will be shown upon every signature confirmation, if it’s set to 3, it will be forced to set payment password.
This same logic applies to promptMasterPasswordSettingWhenLogin
, which by default is set to 0.
auth.changeMasterPassword
to set or change master password, call auth.openAccountAndSecurity()
to set or change payment password.
ParticleNetwork.setAppearance
. By default, it will follow current system setting.
Field | Type | Description |
---|---|---|
appearance | UIUserInterfaceStyle | The specific appearance to be used. This can be either .unspefified , .dark , .light . |
ParticleNetwork.setLanguage
, with retrieval of the current active language facilitated by ParticleNetwork.getLanguage
. By default, this is set to English.
Field | Type | Description |
---|---|---|
language | Language | The specific language to be used. This can be either .en , .ja , .zh_hans , .zh_hant , .ko . |
ParticleNetwork.setFiatCoin
, with retrieval of the current active language facilitated by ParticleNetwork.getFiatCoin
. By default, this is set to USD.
Field | Type | Description |
---|---|---|
fiatCoin | FiatCoin | The specific fiat currency in which value is denominated. This can be either .usd , .cny , .jpy , .hkd , .inr , .krw . |
ParticleNetwork.setSecurityAccountConfig
to update its value.