Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/web3authcoresdk' into qa-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Nov 1, 2023
2 parents 0ffaf62 + 52366b3 commit 8959da8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING=
NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING=

# Redefine
NEXT_PUBLIC_REDEFINE_API=
NEXT_PUBLIC_REDEFINE_API=

# Social Login
NEXT_PUBLIC_WEB3AUTH_CLIENT_ID=
NEXT_PUBLIC_WEB3AUTH_SUBVERIFIER_ID=
NEXT_PUBLIC_WEB3AUTH_AGGREGATE_VERIFIER_ID=
NEXT_PUBLIC_GOOGLE_CLIENT_ID=
3 changes: 2 additions & 1 deletion .github/workflows/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ runs:
NEXT_PUBLIC_IS_OFFICIAL_HOST: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_IS_OFFICIAL_HOST }}
NEXT_PUBLIC_REDEFINE_API: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_REDEFINE_API }}
NEXT_PUBLIC_WEB3AUTH_CLIENT_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_WEB3AUTH_CLIENT_ID }}
NEXT_PUBLIC_WEB3AUTH_AGGREGATE_VERIFIER_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_WEB3AUTH_AGGREGATE_VERIFIER_ID }}
NEXT_PUBLIC_WEB3AUTH_SUBVERIFIER_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_WEB3AUTH_SUBVERIFIER_ID }}
NEXT_PUBLIC_GOOGLE_CLIENT_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GOOGLE_CLIENT_ID }}
NEXT_PUBLIC_WEB3AUTH_VERIFIER_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_WEB3AUTH_VERIFIER_ID }}
NEXT_PUBLIC_FIREBASE_OPTIONS_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_OPTIONS_PRODUCTION }}
NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING }}
NEXT_PUBLIC_FIREBASE_VAPID_KEY_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_VAPID_KEY_PRODUCTION }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ describe('WalletLogin', () => {

it('should not invoke the callback if connection fails', async () => {
const mockOnLogin = jest.fn()
jest.spyOn(useWallet, 'default').mockReturnValue(null)

jest.spyOn(useConnectWallet, 'default').mockReturnValue(jest.fn().mockReturnValue([]))

const result = render(<WalletLogin onLogin={mockOnLogin} />)
Expand Down
4 changes: 2 additions & 2 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@ export const REDEFINE_ARTICLE = 'https://safe.mirror.xyz/rInLWZwD_sf7enjoFerj6FI
// Social Login
export const WEB3_AUTH_CLIENT_ID = process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID || ''
export const GOOGLE_CLIENT_ID = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || ''
export const WEB3AUTH_VERIFIER_ID = process.env.NEXT_PUBLIC_WEB3AUTH_VERIFIER_ID || ''
export const AUTHENTICATOR_APP_VERIFIER = process.env.NEXT_PUBLIC_AUTHENTICATOR_APP_VERIFIER || ''
export const WEB3AUTH_SUBVERIFIER_ID = process.env.NEXT_PUBLIC_WEB3AUTH_SUBVERIFIER_ID || ''
export const WEB3AUTH_AGGREGATE_VERIFIER_ID = process.env.NEXT_PUBLIC_WEB3AUTH_AGGREGATE_VERIFIER_ID || ''
16 changes: 10 additions & 6 deletions src/services/mpc/SocialWalletService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { COREKIT_STATUS, type Web3AuthMPCCoreKit } from '@web3auth/mpc-core-kit'
import BN from 'bn.js'
import { GOOGLE_CLIENT_ID, WEB3AUTH_VERIFIER_ID } from '@/config/constants'
import { GOOGLE_CLIENT_ID, WEB3AUTH_AGGREGATE_VERIFIER_ID, WEB3AUTH_SUBVERIFIER_ID } from '@/config/constants'
import { SecurityQuestionRecovery } from '@/services/mpc/recovery/SecurityQuestionRecovery'
import { trackEvent } from '@/services/analytics'
import { MPC_WALLET_EVENTS } from '@/services/analytics/events/mpcWallet'
Expand Down Expand Up @@ -69,11 +69,15 @@ class SocialWalletService implements ISocialWalletService {
async loginAndCreate(): Promise<COREKIT_STATUS> {
try {
await this.mpcCoreKit.loginWithOauth({
subVerifierDetails: {
typeOfLogin: 'google',
verifier: WEB3AUTH_VERIFIER_ID,
clientId: GOOGLE_CLIENT_ID,
},
aggregateVerifierIdentifier: WEB3AUTH_AGGREGATE_VERIFIER_ID,
subVerifierDetailsArray: [
{
clientId: GOOGLE_CLIENT_ID,
typeOfLogin: 'google',
verifier: WEB3AUTH_SUBVERIFIER_ID,
},
],
aggregateVerifierType: 'single_id_verifier',
})

if (this.mpcCoreKit.status === COREKIT_STATUS.REQUIRED_SHARE) {
Expand Down

0 comments on commit 8959da8

Please sign in to comment.