@@ -28,13 +28,19 @@ function getSignerKindForSignup(kind: SignupArgs['kind'] | AuthCommitment['kind'
2828 if ( kind === 'google-id-token' || kind === 'google-pkce' ) {
2929 return Kinds . LoginGoogle
3030 }
31+ if ( kind === 'apple-id-token' || kind === 'apple' ) {
32+ return Kinds . LoginApple
33+ }
3134 if ( kind . startsWith ( 'custom-' ) ) {
3235 return kind
3336 }
3437 return ( 'login-' + kind ) as string
3538}
3639
37- function getIdTokenSignupHandler ( shared : Shared , kind : typeof Kinds . LoginGoogle | `custom-${string } `) : IdTokenHandler {
40+ function getIdTokenSignupHandler (
41+ shared : Shared ,
42+ kind : typeof Kinds . LoginGoogle | typeof Kinds . LoginApple | `custom-${string } `,
43+ ) : IdTokenHandler {
3844 const handler = shared . handlers . get ( kind )
3945 if ( ! handler ) {
4046 throw new Error ( 'handler-not-registered' )
@@ -82,7 +88,7 @@ export type EmailOtpSignupArgs = CommonSignupArgs & {
8288}
8389
8490export type IdTokenSignupArgs = CommonSignupArgs & {
85- kind : 'google-id-token' | `custom-${string } `
91+ kind : 'google-id-token' | 'apple-id-token' | `custom-${string } `
8692 idToken : string
8793}
8894
@@ -222,7 +228,7 @@ export interface WalletsInterface {
222228 * - `kind: 'mnemonic'`: Uses a mnemonic phrase as the login credential.
223229 * - `kind: 'passkey'`: Prompts the user to create a WebAuthn passkey.
224230 * - `kind: 'email-otp'`: Initiates an OTP flow to the user's email.
225- * - `kind: 'google-id-token'`: Completes an OIDC ID token flow when Google is configured with `authMethod: 'id-token'`.
231+ * - `kind: 'google-id-token' | 'apple-id-token' `: Completes an OIDC ID token flow when the provider is configured with `authMethod: 'id-token'`.
226232 * - `kind: 'google-pkce' | 'apple'`: Completes an OAuth redirect flow.
227233 * Common options like `noGuard` or `noRecovery` can customize the wallet's security features.
228234 * @returns A promise that resolves to the address of the newly created wallet, or `undefined` if the sign-up was aborted.
@@ -721,16 +727,20 @@ export class Wallets implements WalletsInterface {
721727 }
722728 }
723729
724- case 'google-id-token' : {
725- const handler = getIdTokenSignupHandler ( this . shared , Kinds . LoginGoogle )
730+ case 'google-id-token' :
731+ case 'apple-id-token' : {
732+ const handler = getIdTokenSignupHandler (
733+ this . shared ,
734+ args . kind === 'google-id-token' ? Kinds . LoginGoogle : Kinds . LoginApple ,
735+ )
726736 const [ signer , metadata ] = await handler . completeAuth ( args . idToken )
727737 const loginEmail = metadata . email
728738 this . shared . modules . logger . log ( 'Created new id token signer:' , signer . address )
729739
730740 return {
731741 signer,
732742 extra : {
733- signerKind : Kinds . LoginGoogle ,
743+ signerKind : getSignerKindForSignup ( args . kind ) ,
734744 } ,
735745 loginEmail,
736746 }
0 commit comments