Skip to content

Commit

Permalink
Rename emailAuthVersion property to legacyEmailAuth (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
corbanbrook authored Aug 6, 2024
1 parent 8fde9bb commit 70c02c6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ function App() {
waasConfigKey: '<your-waas-config-key>',
googleClientId,
appleClientId,
appleRedirectUrl,
emailAuthVersion // (default 2), 1 for legacy
appleRedirectUrl
})
*/

Expand Down
2 changes: 1 addition & 1 deletion examples/react/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const getWaasConnectors = () => {
appleRedirectURI,
appName: 'Kit Demo',
projectAccessKey,
// emailAuthVersion: 1,
// legacyEmailAuth: true,
enableConfirmationModal: localStorage.getItem('confirmationEnabled') === 'true',
isDev: isDebugMode
})
Expand Down
6 changes: 3 additions & 3 deletions packages/kit/src/config/defaultConnectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ interface GetDefaultWaasConnectors {
appName: string
defaultChainId?: number

emailAuthVersion?: 1 | 2
legacyEmailAuth?: boolean

enableConfirmationModal?: boolean

Expand All @@ -100,16 +100,16 @@ export const getDefaultWaasConnectors = ({
appName,
defaultChainId,
enableConfirmationModal,
emailAuthVersion,
legacyEmailAuth = false,
isDev = false
}: GetDefaultWaasConnectors): CreateConnectorFn[] => {
const wallets: any[] = [
emailWaas({
emailAuthVersion,
projectAccessKey,
waasConfigKey,
enableConfirmationModal,
network: defaultChainId,
legacyEmailAuth,
isDev
}),
coinbaseWallet({
Expand Down
6 changes: 3 additions & 3 deletions packages/kit/src/connectors/email/emailWaas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { sequenceWaasWallet, BaseSequenceWaasConnectorOptions } from '../wagmiCo

import { getEmailLogo } from './EmailLogo'

export type EmailWaasOptions = { emailAuthVersion?: 1 | 2 } & Omit<BaseSequenceWaasConnectorOptions, 'loginType'>
export type EmailWaasOptions = { legacyEmailAuth?: boolean } & Omit<BaseSequenceWaasConnectorOptions, 'loginType'>

export const emailWaas = ({ emailAuthVersion = 2, ...rest }: EmailWaasOptions): Wallet => ({
export const emailWaas = ({ legacyEmailAuth = false, ...rest }: EmailWaasOptions): Wallet => ({
id: 'email-waas',
logoDark: getEmailLogo({ isDarkMode: true }),
logoLight: getEmailLogo({ isDarkMode: false }),
name: 'Email',
type: 'social',
createConnector: () => {
const options = { emailAuthVersion, ...rest }
const options = { legacyEmailAuth, ...rest }
const connector = sequenceWaasWallet({
...options,
loginType: 'email'
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/src/hooks/useWaasEmailAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function useEmailAuth({
setLoading(true)
setError(undefined)

if (params.emailAuthVersion === 1) {
if (params.legacyEmailAuth) {
try {
const { instance } = await waas.email.initiateAuth({ email })
setInstance(instance)
Expand Down Expand Up @@ -98,7 +98,7 @@ export function useEmailAuth({
setLoading(true)
setError(undefined)

if (params.emailAuthVersion === 1) {
if (params.legacyEmailAuth) {
// version 1
try {
const sessionHash = await waas.getSessionHash()
Expand Down

0 comments on commit 70c02c6

Please sign in to comment.