Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Chore) Bump Torus CustomAuth SDK to v18 #4252

Merged
merged 3 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"@textile/threaddb": "^0.1.0",
"@textile/threads-client": "^2.1.2",
"@textile/threads-id": "^0.5.1",
"@toruslabs/customauth": "^11.4.3",
"@toruslabs/customauth": "^18.0.0",
"@toruslabs/customauth-react-native-sdk": "^4.0.1",
"@tradle/react-native-http": "^2.0.1",
"@usedapp/core": "1.2.6",
Expand Down
8 changes: 7 additions & 1 deletion src/components/auth/torus/sdk/TorusSDK.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ class TorusSDK {
}

constructor(config, options, logger) {
const { env, torusNetwork, torusUxMode = 'popup' } = config
const { env, torusWeb3AuthClientId, torusNetwork, torusUxMode = 'popup' } = config

const torusOptions = defaults({}, options, {
web3AuthClientId: torusWeb3AuthClientId,
network: torusNetwork, // details for test net
enableLogging: env === 'development',
uxMode: torusUxMode,
Expand Down Expand Up @@ -97,13 +98,18 @@ class TorusSDK {

let torusUser = response
let { userInfo, ...otherResponse } = torusUser
const { finalKeyData } = otherResponse

if (userInfo) {
// aggregate login returns an array with user info
userInfo = first(userInfo) || userInfo
torusUser = { ...otherResponse, ...userInfo }
}

if (finalKeyData && finalKeyData.privKey) {
torusUser.privateKey = finalKeyData.privKey
}

let { name, email, privateKey = '' } = torusUser
const isLoginPhoneNumber = /\+[0-9]+$/.test(name)

Expand Down
1 change: 1 addition & 0 deletions src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ const Config = {
torusAuth0SMS: env.REACT_APP_TORUS_AUTH0SMS || 'gooddollar-auth0-sms-passwordless',
torusUxMode: isWeb ? env.REACT_APP_TORUS_UXMODE || 'redirect' : 'popup',
torusRedirectUrl: isDeltaApp ? env.REACT_APP_TORUS_REDIRECT_URL || publicUrl : publicUrl, // REACT_APP_TORUS_REDIRECT_URL avalable for Delta ONLY
torusWeb3AuthClientId: env.REACT_APP_TORUS_WEB3AUTH_CLIENT_ID,
abTestPercentage: env.REACT_APP_AB_TEST_PERCENTAGE || 0.5,
smsRateLimit: env.REACT_APP_SMS_RATE_LIMIT || 60 * 1000, // rate limit for sms code verification resend
recaptchaSiteKey: env.REACT_APP_RECAPTCHA_SITE_KEY,
Expand Down