@coasys/ad4m 0.11.2-dev-multi-user → 0.11.2-dev-multi-user-email

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ import { ExpressionProof } from "../expression/Expression";
4
4
  import { LinkExpression } from "../links/Links";
5
5
  import { ExceptionType } from "../Exception";
6
6
  import { RUNTIME_MESSAGED_RECEIVED_TOPIC, EXCEPTION_OCCURRED_TOPIC, RUNTIME_NOTIFICATION_REQUESTED_TOPIC, RUNTIME_NOTIFICATION_TRIGGERED_TOPIC } from '../PubSub';
7
+ import { UserCreationResult, AuthInfoInput } from "../agent/Agent";
7
8
 
8
9
  const testLink = new LinkExpression()
9
10
  testLink.author = "did:ad4m:test"
@@ -207,6 +208,18 @@ export class UserStatistics {
207
208
  perspectiveCount: number;
208
209
  }
209
210
 
211
+ @ObjectType()
212
+ export class VerificationRequestResult {
213
+ @Field()
214
+ success: boolean;
215
+
216
+ @Field()
217
+ message: string;
218
+
219
+ @Field()
220
+ requiresPassword: boolean;
221
+ }
222
+
210
223
  /**
211
224
  * Resolver classes are used here to define the GraphQL schema
212
225
  * (through the type-graphql annotations)
@@ -461,5 +474,87 @@ export default class RuntimeResolver {
461
474
  perspectiveCount: 5
462
475
  }]
463
476
  }
477
+
478
+ @Mutation(returns => VerificationRequestResult)
479
+ runtimeRequestLoginVerification(
480
+ @Arg("email") email: string,
481
+ @Arg("appInfo", { nullable: true }) appInfo?: AuthInfoInput
482
+ ): VerificationRequestResult {
483
+ // For testing: simulate existing user
484
+ return {
485
+ success: true,
486
+ message: "Verification email sent",
487
+ requiresPassword: false
488
+ }
489
+ }
490
+
491
+ @Mutation(returns => String)
492
+ runtimeVerifyEmailCode(
493
+ @Arg("email") email: string,
494
+ @Arg("code") code: string,
495
+ @Arg("verificationType") verificationType: string
496
+ ): string {
497
+ // For testing: return a test JWT token
498
+ return "test-jwt-token-from-email-verification"
499
+ }
500
+
501
+ @Mutation(returns => Boolean)
502
+ runtimeTestEmail(@Arg("to") to: string): boolean {
503
+ // For testing: simulate successful email send
504
+ return true
505
+ }
506
+
507
+ @Mutation(returns => UserCreationResult)
508
+ runtimeCreateUser(
509
+ @Arg("email") email: string,
510
+ @Arg("password") password: string,
511
+ @Arg("appInfo", { nullable: true }) appInfo?: AuthInfoInput
512
+ ): UserCreationResult {
513
+ // For testing: simulate successful user creation (email verification flow)
514
+ return new UserCreationResult("did:key:test123", true)
515
+ }
516
+
517
+ @Mutation(returns => String)
518
+ runtimeLoginUser(
519
+ @Arg("email") email: string,
520
+ @Arg("password") password: string
521
+ ): string {
522
+ // For testing: return a test JWT token
523
+ return "test-jwt-token-from-password-login"
524
+ }
525
+
526
+ @Mutation(returns => Boolean)
527
+ runtimeEmailTestModeEnable(): boolean {
528
+ // For testing: enable test mode
529
+ return true
530
+ }
531
+
532
+ @Mutation(returns => Boolean)
533
+ runtimeEmailTestModeDisable(): boolean {
534
+ // For testing: disable test mode
535
+ return true
536
+ }
537
+
538
+ @Mutation(returns => String, { nullable: true })
539
+ runtimeEmailTestGetCode(@Arg("email") email: string): string | null {
540
+ // For testing: return a mock code
541
+ return "123456"
542
+ }
543
+
544
+ @Mutation(returns => Boolean)
545
+ runtimeEmailTestClearCodes(): boolean {
546
+ // For testing: clear codes
547
+ return true
548
+ }
549
+
550
+ @Mutation(returns => Boolean)
551
+ runtimeEmailTestSetExpiry(
552
+ @Arg("email") email: string,
553
+ @Arg("verificationType") verificationType: string,
554
+ @Arg("expiresAt") expiresAt: number
555
+ ): boolean {
556
+ // For testing: simulate setting expiry (no-op in mock)
557
+ return true
558
+ }
464
559
  }
465
560