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

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.
package/lib/index.cjs CHANGED
@@ -4071,29 +4071,6 @@ exports.AuthInfoInput = __decorate$b([
4071
4071
  InputType(),
4072
4072
  __metadata$b("design:paramtypes", [String, String, String, String, String, Array])
4073
4073
  ], exports.AuthInfoInput);
4074
- exports.User = class User {
4075
- constructor(username, did, password) {
4076
- this.username = username;
4077
- this.did = did;
4078
- this.password = password;
4079
- }
4080
- };
4081
- __decorate$b([
4082
- Field(),
4083
- __metadata$b("design:type", String)
4084
- ], exports.User.prototype, "username", void 0);
4085
- __decorate$b([
4086
- Field(),
4087
- __metadata$b("design:type", String)
4088
- ], exports.User.prototype, "did", void 0);
4089
- __decorate$b([
4090
- Field(),
4091
- __metadata$b("design:type", String)
4092
- ], exports.User.prototype, "password", void 0);
4093
- exports.User = __decorate$b([
4094
- ObjectType(),
4095
- __metadata$b("design:paramtypes", [String, String, String])
4096
- ], exports.User);
4097
4074
  exports.UserCreationResult = class UserCreationResult {
4098
4075
  constructor(did, success, error) {
4099
4076
  this.did = did;
@@ -6909,16 +6886,16 @@ class AgentClient {
6909
6886
  return agentSignMessage;
6910
6887
  }
6911
6888
  // Multi-user methods
6912
- async createUser(email, password) {
6889
+ async createUser(email, password, appInfo) {
6913
6890
  const { runtimeCreateUser } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
6914
- mutation: gql `mutation runtimeCreateUser($email: String!, $password: String!) {
6915
- runtimeCreateUser(email: $email, password: $password) {
6891
+ mutation: gql `mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
6892
+ runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
6916
6893
  did
6917
6894
  success
6918
6895
  error
6919
6896
  }
6920
6897
  }`,
6921
- variables: { email, password },
6898
+ variables: { email, password, appInfo },
6922
6899
  }));
6923
6900
  return runtimeCreateUser;
6924
6901
  }
@@ -6931,6 +6908,29 @@ class AgentClient {
6931
6908
  }));
6932
6909
  return runtimeLoginUser;
6933
6910
  }
6911
+ async requestLoginVerification(email, appInfo) {
6912
+ const { runtimeRequestLoginVerification } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
6913
+ mutation: gql `mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
6914
+ runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
6915
+ success
6916
+ message
6917
+ requiresPassword
6918
+ isExistingUser
6919
+ }
6920
+ }`,
6921
+ variables: { email, appInfo },
6922
+ }));
6923
+ return runtimeRequestLoginVerification;
6924
+ }
6925
+ async verifyEmailCode(email, code, verificationType) {
6926
+ const { runtimeVerifyEmailCode } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
6927
+ mutation: gql `mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
6928
+ runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
6929
+ }`,
6930
+ variables: { email, code, verificationType },
6931
+ }));
6932
+ return runtimeVerifyEmailCode;
6933
+ }
6934
6934
  }
6935
6935
  _AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
6936
6936
 
@@ -7709,6 +7709,48 @@ class RuntimeClient {
7709
7709
  }));
7710
7710
  return runtimeListUsers;
7711
7711
  }
7712
+ async emailTestModeEnable() {
7713
+ const { runtimeEmailTestModeEnable } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7714
+ mutation: gql `mutation runtimeEmailTestModeEnable {
7715
+ runtimeEmailTestModeEnable
7716
+ }`
7717
+ }));
7718
+ return runtimeEmailTestModeEnable;
7719
+ }
7720
+ async emailTestModeDisable() {
7721
+ const { runtimeEmailTestModeDisable } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7722
+ mutation: gql `mutation runtimeEmailTestModeDisable {
7723
+ runtimeEmailTestModeDisable
7724
+ }`
7725
+ }));
7726
+ return runtimeEmailTestModeDisable;
7727
+ }
7728
+ async emailTestGetCode(email) {
7729
+ const { runtimeEmailTestGetCode } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7730
+ mutation: gql `mutation runtimeEmailTestGetCode($email: String!) {
7731
+ runtimeEmailTestGetCode(email: $email)
7732
+ }`,
7733
+ variables: { email }
7734
+ }));
7735
+ return runtimeEmailTestGetCode;
7736
+ }
7737
+ async emailTestClearCodes() {
7738
+ const { runtimeEmailTestClearCodes } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7739
+ mutation: gql `mutation runtimeEmailTestClearCodes {
7740
+ runtimeEmailTestClearCodes
7741
+ }`
7742
+ }));
7743
+ return runtimeEmailTestClearCodes;
7744
+ }
7745
+ async emailTestSetExpiry(email, verificationType, expiresAt) {
7746
+ const { runtimeEmailTestSetExpiry } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7747
+ mutation: gql `mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
7748
+ runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
7749
+ }`,
7750
+ variables: { email, verificationType, expiresAt }
7751
+ }));
7752
+ return runtimeEmailTestSetExpiry;
7753
+ }
7712
7754
  addNotificationTriggeredCallback(cb) {
7713
7755
  __classPrivateFieldGet$5(this, _RuntimeClient_notificationTriggeredCallbacks, "f").push(cb);
7714
7756
  }
@@ -16980,6 +17022,12 @@ type Mutation {
16980
17022
  perspectiveUpdateLink(batchId: String, newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
16981
17023
  runtimeAddFriends(dids: [String!]!): [String!]!
16982
17024
  runtimeAddKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
17025
+ runtimeCreateUser(appInfo: AuthInfoInput, email: String!, password: String!): UserCreationResult!
17026
+ runtimeEmailTestClearCodes: Boolean!
17027
+ runtimeEmailTestGetCode(email: String!): String
17028
+ runtimeEmailTestModeDisable: Boolean!
17029
+ runtimeEmailTestModeEnable: Boolean!
17030
+ runtimeEmailTestSetExpiry(email: String!, expiresAt: Float!, verificationType: String!): Boolean!
16983
17031
  runtimeExportDb(filePath: String!): Boolean!
16984
17032
  runtimeExportPerspective(filePath: String!, perspectiveUuid: String!): Boolean!
16985
17033
  runtimeFriendSendMessage(did: String!, message: PerspectiveInput!): Boolean!
@@ -16987,16 +17035,20 @@ type Mutation {
16987
17035
  runtimeHcAddAgentInfos(agentInfos: String!): Boolean!
16988
17036
  runtimeImportDb(filePath: String!): Boolean!
16989
17037
  runtimeImportPerspective(filePath: String!): Boolean!
17038
+ runtimeLoginUser(email: String!, password: String!): String!
16990
17039
  runtimeOpenLink(url: String!): Boolean!
16991
17040
  runtimeQuit: Boolean!
16992
17041
  runtimeRemoveFriends(dids: [String!]!): [String!]!
16993
17042
  runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
16994
17043
  runtimeRemoveNotification(id: String!): Boolean!
16995
17044
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
17045
+ runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
16996
17046
  runtimeRestartHolochain: Boolean!
16997
17047
  runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
16998
17048
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
17049
+ runtimeTestEmail(to: String!): Boolean!
16999
17050
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
17051
+ runtimeVerifyEmailCode(code: String!, email: String!, verificationType: String!): String!
17000
17052
  }
17001
17053
 
17002
17054
  type Neighbourhood {
@@ -17174,6 +17226,12 @@ type TriggeredNotification {
17174
17226
  triggerMatch: String!
17175
17227
  }
17176
17228
 
17229
+ type UserCreationResult {
17230
+ did: String!
17231
+ error: String
17232
+ success: Boolean!
17233
+ }
17234
+
17177
17235
  type UserStatistics {
17178
17236
  did: String!
17179
17237
  email: String!
@@ -17181,6 +17239,13 @@ type UserStatistics {
17181
17239
  perspectiveCount: Int!
17182
17240
  }
17183
17241
 
17242
+ type VerificationRequestResult {
17243
+ isExistingUser: Boolean!
17244
+ message: String!
17245
+ requiresPassword: Boolean!
17246
+ success: Boolean!
17247
+ }
17248
+
17184
17249
  input VoiceActivityParamsInput {
17185
17250
  endThreshold: Float
17186
17251
  endWindow: Float
@@ -17490,6 +17555,27 @@ __decorate([
17490
17555
  exports.UserStatistics = __decorate([
17491
17556
  ObjectType()
17492
17557
  ], exports.UserStatistics);
17558
+ exports.VerificationRequestResult = class VerificationRequestResult {
17559
+ };
17560
+ __decorate([
17561
+ Field(),
17562
+ __metadata("design:type", Boolean)
17563
+ ], exports.VerificationRequestResult.prototype, "success", void 0);
17564
+ __decorate([
17565
+ Field(),
17566
+ __metadata("design:type", String)
17567
+ ], exports.VerificationRequestResult.prototype, "message", void 0);
17568
+ __decorate([
17569
+ Field(),
17570
+ __metadata("design:type", Boolean)
17571
+ ], exports.VerificationRequestResult.prototype, "requiresPassword", void 0);
17572
+ __decorate([
17573
+ Field(),
17574
+ __metadata("design:type", Boolean)
17575
+ ], exports.VerificationRequestResult.prototype, "isExistingUser", void 0);
17576
+ exports.VerificationRequestResult = __decorate([
17577
+ ObjectType()
17578
+ ], exports.VerificationRequestResult);
17493
17579
  /**
17494
17580
  * Resolver classes are used here to define the GraphQL schema
17495
17581
  * (through the type-graphql annotations)
@@ -17653,6 +17739,51 @@ let RuntimeResolver = class RuntimeResolver {
17653
17739
  perspectiveCount: 5
17654
17740
  }];
17655
17741
  }
17742
+ runtimeRequestLoginVerification(email, appInfo) {
17743
+ // For testing: simulate existing user
17744
+ return {
17745
+ success: true,
17746
+ message: "Verification email sent",
17747
+ requiresPassword: false,
17748
+ isExistingUser: true
17749
+ };
17750
+ }
17751
+ runtimeVerifyEmailCode(email, code, verificationType) {
17752
+ // For testing: return a test JWT token
17753
+ return "test-jwt-token-from-email-verification";
17754
+ }
17755
+ runtimeTestEmail(to) {
17756
+ // For testing: simulate successful email send
17757
+ return true;
17758
+ }
17759
+ runtimeCreateUser(email, password, appInfo) {
17760
+ // For testing: simulate successful user creation (email verification flow)
17761
+ return new exports.UserCreationResult("did:key:test123", true);
17762
+ }
17763
+ runtimeLoginUser(email, password) {
17764
+ // For testing: return a test JWT token
17765
+ return "test-jwt-token-from-password-login";
17766
+ }
17767
+ runtimeEmailTestModeEnable() {
17768
+ // For testing: enable test mode
17769
+ return true;
17770
+ }
17771
+ runtimeEmailTestModeDisable() {
17772
+ // For testing: disable test mode
17773
+ return true;
17774
+ }
17775
+ runtimeEmailTestGetCode(email) {
17776
+ // For testing: return a mock code
17777
+ return "123456";
17778
+ }
17779
+ runtimeEmailTestClearCodes() {
17780
+ // For testing: clear codes
17781
+ return true;
17782
+ }
17783
+ runtimeEmailTestSetExpiry(email, verificationType, expiresAt) {
17784
+ // For testing: simulate setting expiry (no-op in mock)
17785
+ return true;
17786
+ }
17656
17787
  };
17657
17788
  __decorate([
17658
17789
  Mutation(),
@@ -17905,6 +18036,81 @@ __decorate([
17905
18036
  __metadata("design:paramtypes", []),
17906
18037
  __metadata("design:returntype", Array)
17907
18038
  ], RuntimeResolver.prototype, "runtimeListUsers", null);
18039
+ __decorate([
18040
+ Mutation(),
18041
+ __param(0, Arg()),
18042
+ __param(1, Arg()),
18043
+ __metadata("design:type", Function),
18044
+ __metadata("design:paramtypes", [String, exports.AuthInfoInput]),
18045
+ __metadata("design:returntype", exports.VerificationRequestResult)
18046
+ ], RuntimeResolver.prototype, "runtimeRequestLoginVerification", null);
18047
+ __decorate([
18048
+ Mutation(),
18049
+ __param(0, Arg()),
18050
+ __param(1, Arg()),
18051
+ __param(2, Arg()),
18052
+ __metadata("design:type", Function),
18053
+ __metadata("design:paramtypes", [String, String, String]),
18054
+ __metadata("design:returntype", String)
18055
+ ], RuntimeResolver.prototype, "runtimeVerifyEmailCode", null);
18056
+ __decorate([
18057
+ Mutation(),
18058
+ __param(0, Arg()),
18059
+ __metadata("design:type", Function),
18060
+ __metadata("design:paramtypes", [String]),
18061
+ __metadata("design:returntype", Boolean)
18062
+ ], RuntimeResolver.prototype, "runtimeTestEmail", null);
18063
+ __decorate([
18064
+ Mutation(),
18065
+ __param(0, Arg()),
18066
+ __param(1, Arg()),
18067
+ __param(2, Arg()),
18068
+ __metadata("design:type", Function),
18069
+ __metadata("design:paramtypes", [String, String, exports.AuthInfoInput]),
18070
+ __metadata("design:returntype", exports.UserCreationResult)
18071
+ ], RuntimeResolver.prototype, "runtimeCreateUser", null);
18072
+ __decorate([
18073
+ Mutation(),
18074
+ __param(0, Arg()),
18075
+ __param(1, Arg()),
18076
+ __metadata("design:type", Function),
18077
+ __metadata("design:paramtypes", [String, String]),
18078
+ __metadata("design:returntype", String)
18079
+ ], RuntimeResolver.prototype, "runtimeLoginUser", null);
18080
+ __decorate([
18081
+ Mutation(),
18082
+ __metadata("design:type", Function),
18083
+ __metadata("design:paramtypes", []),
18084
+ __metadata("design:returntype", Boolean)
18085
+ ], RuntimeResolver.prototype, "runtimeEmailTestModeEnable", null);
18086
+ __decorate([
18087
+ Mutation(),
18088
+ __metadata("design:type", Function),
18089
+ __metadata("design:paramtypes", []),
18090
+ __metadata("design:returntype", Boolean)
18091
+ ], RuntimeResolver.prototype, "runtimeEmailTestModeDisable", null);
18092
+ __decorate([
18093
+ Mutation(),
18094
+ __param(0, Arg()),
18095
+ __metadata("design:type", Function),
18096
+ __metadata("design:paramtypes", [String]),
18097
+ __metadata("design:returntype", String)
18098
+ ], RuntimeResolver.prototype, "runtimeEmailTestGetCode", null);
18099
+ __decorate([
18100
+ Mutation(),
18101
+ __metadata("design:type", Function),
18102
+ __metadata("design:paramtypes", []),
18103
+ __metadata("design:returntype", Boolean)
18104
+ ], RuntimeResolver.prototype, "runtimeEmailTestClearCodes", null);
18105
+ __decorate([
18106
+ Mutation(),
18107
+ __param(0, Arg()),
18108
+ __param(1, Arg()),
18109
+ __param(2, Arg()),
18110
+ __metadata("design:type", Function),
18111
+ __metadata("design:paramtypes", [String, String, Number]),
18112
+ __metadata("design:returntype", Boolean)
18113
+ ], RuntimeResolver.prototype, "runtimeEmailTestSetExpiry", null);
17908
18114
  RuntimeResolver = __decorate([
17909
18115
  Resolver()
17910
18116
  ], RuntimeResolver);