Confirm Your Access
+Hi,
+Confirm access to your Flash account using the following code:
+This code will only be used once. Do not share it with anyone.
+From 069ba09c0f2da358db148d22fb3bebfff37af658 Mon Sep 17 00:00:00 2001 From: Dread <34528298+islandbitcoin@users.noreply.github.com> Date: Wed, 17 Sep 2025 10:54:15 -0500 Subject: [PATCH 1/5] =?UTF-8?q?=20=E2=9C=85=20Email-Only=20Authentication?= =?UTF-8?q?=20Implementation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New GraphQL mutations: newUserEmailRegistrationInitiate and newUserEmailRegistrationValidate for email-only account creation - Kratos integration: Successfully using email recovery flow for OTP delivery - Account creation: Fixed critical bug where accounts weren't being created after validation - Code cleanup: Removed all debug console.log statements ✅ Key Changes Made 1. Fixed validation logic - Changed from checking User existence to Account existence 2. Proper account creation - Creates account with wallets when none exists 3. Clean production code - Removed debug statements for production readiness --- dev/apollo-federation/supergraph.graphql | 22 +++++ dev/ory/email-template.html | 93 +++++++++++++++++++ dev/ory/kratos.yml | 4 +- src/app/accounts/create-account.ts | 22 +++++ .../create-account-from-email-registration.ts | 76 +++++++++++++++ ...reate-account-from-registration-payload.ts | 3 + src/app/authentication/index.ts | 1 + src/app/authentication/index.types.d.ts | 5 + src/app/authentication/request-code.ts | 8 +- src/domain/authentication/index.types.d.ts | 9 +- .../registration-payload-validator.ts | 34 ++++++- src/domain/users/index.types.d.ts | 4 +- src/graphql/public/mutations.ts | 4 + .../new-user-email-registration-initiate.ts | 64 +++++++++++++ .../new-user-email-registration-validate.ts | 93 +++++++++++++++++++ src/graphql/public/schema.graphql | 16 ++++ src/services/kratos/auth-email-no-password.ts | 52 ++++++++++- src/services/mongoose/schema.ts | 10 +- src/services/mongoose/schema.types.d.ts | 2 + src/services/mongoose/users.ts | 31 ++++++- 20 files changed, 534 insertions(+), 19 deletions(-) create mode 100644 dev/ory/email-template.html create mode 100644 src/app/authentication/create-account-from-email-registration.ts create mode 100644 src/graphql/public/root/mutation/new-user-email-registration-initiate.ts create mode 100644 src/graphql/public/root/mutation/new-user-email-registration-validate.ts diff --git a/dev/apollo-federation/supergraph.graphql b/dev/apollo-federation/supergraph.graphql index 4c0006339..a24128e71 100644 --- a/dev/apollo-federation/supergraph.graphql +++ b/dev/apollo-federation/supergraph.graphql @@ -1132,6 +1132,8 @@ type Mutation lnUsdInvoiceCreateOnBehalfOfRecipient(input: LnUsdInvoiceCreateOnBehalfOfRecipientInput!): LnInvoicePayload! lnUsdInvoiceFeeProbe(input: LnUsdInvoiceFeeProbeInput!): CentAmountPayload! merchantMapSuggest(input: MerchantMapSuggestInput!): MerchantPayload! + newUserEmailRegistrationInitiate(input: NewUserEmailRegistrationInitiateInput!): NewUserEmailRegistrationInitiatePayload! + newUserEmailRegistrationValidate(input: NewUserEmailRegistrationValidateInput!): AuthTokenPayload! onChainAddressCreate(input: OnChainAddressCreateInput!): OnChainAddressPayload! onChainAddressCurrent(input: OnChainAddressCurrentInput!): OnChainAddressPayload! onChainPaymentSend(input: OnChainPaymentSendInput!): PaymentSendPayload! @@ -1181,6 +1183,26 @@ enum Network testnet @join__enumValue(graph: PUBLIC) } +input NewUserEmailRegistrationInitiateInput + @join__type(graph: PUBLIC) +{ + email: EmailAddress! +} + +type NewUserEmailRegistrationInitiatePayload + @join__type(graph: PUBLIC) +{ + emailFlowId: String + errors: [Error!]! +} + +input NewUserEmailRegistrationValidateInput + @join__type(graph: PUBLIC) +{ + code: OneTimeAuthCode! + emailFlowId: String! +} + scalar NotificationCategory @join__type(graph: PUBLIC) diff --git a/dev/ory/email-template.html b/dev/ory/email-template.html new file mode 100644 index 000000000..194d19fbf --- /dev/null +++ b/dev/ory/email-template.html @@ -0,0 +1,93 @@ + + + +
+ + + + + + +
+ Hi,
+Confirm access to your Flash account using the following code:
+This code will only be used once. Do not share it with anyone.
+