@fonoster/identity 0.9.19 → 0.9.22

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.
Files changed (132) hide show
  1. package/dist/apikeys/createCreateApiKey.d.ts +18 -0
  2. package/dist/apikeys/createCreateApiKey.js +1 -1
  3. package/dist/apikeys/createDeleteApiKey.d.ts +18 -0
  4. package/dist/apikeys/createDeleteApiKey.js +1 -1
  5. package/dist/apikeys/createListApiKeys.d.ts +18 -0
  6. package/dist/apikeys/createListApiKeys.js +1 -1
  7. package/dist/apikeys/createRegenerateApiKey.d.ts +18 -0
  8. package/dist/apikeys/createRegenerateApiKey.js +1 -1
  9. package/dist/apikeys/index.d.ts +18 -0
  10. package/dist/apikeys/index.js +1 -1
  11. package/dist/constants.d.ts +18 -0
  12. package/dist/constants.js +1 -1
  13. package/dist/db.js +2 -2
  14. package/dist/exchanges/createExchangeApiKey.d.ts +19 -1
  15. package/dist/exchanges/createExchangeApiKey.js +2 -2
  16. package/dist/exchanges/createExchangeCredentials.d.ts +19 -1
  17. package/dist/exchanges/createExchangeCredentials.js +3 -3
  18. package/dist/exchanges/createExchangeOauth2Code.d.ts +19 -1
  19. package/dist/exchanges/createExchangeOauth2Code.js +7 -21
  20. package/dist/exchanges/createExchangeRefreshToken.d.ts +19 -1
  21. package/dist/exchanges/createExchangeRefreshToken.js +2 -2
  22. package/dist/exchanges/exchangeTokens.d.ts +1 -1
  23. package/dist/exchanges/exchangeTokens.js +1 -1
  24. package/dist/exchanges/index.d.ts +18 -0
  25. package/dist/exchanges/index.js +1 -1
  26. package/dist/exchanges/payloads/apikeys/createGetAccessTokenPayload.d.ts +19 -1
  27. package/dist/exchanges/payloads/apikeys/createGetAccessTokenPayload.js +18 -0
  28. package/dist/exchanges/payloads/apikeys/createGetRefreshTokenPayload.d.ts +19 -1
  29. package/dist/exchanges/payloads/apikeys/index.d.ts +18 -0
  30. package/dist/exchanges/payloads/apikeys/index.js +1 -1
  31. package/dist/exchanges/payloads/buildRefreshTokenPayload.d.ts +18 -0
  32. package/dist/exchanges/payloads/buildRefreshTokenPayload.js +1 -1
  33. package/dist/exchanges/payloads/users/createGetAccessTokenPayload.d.ts +19 -1
  34. package/dist/exchanges/payloads/users/createGetAccessTokenPayload.js +2 -2
  35. package/dist/exchanges/payloads/users/createGetIdTokenPayload.d.ts +19 -1
  36. package/dist/exchanges/payloads/users/createGetIdTokenPayload.js +18 -0
  37. package/dist/exchanges/payloads/users/createGetRefreshTokenPayload.d.ts +19 -1
  38. package/dist/exchanges/payloads/users/createGetRefreshTokenPayload.js +18 -0
  39. package/dist/exchanges/payloads/users/index.d.ts +18 -0
  40. package/dist/exchanges/payloads/users/index.js +1 -1
  41. package/dist/exchanges/types.d.ts +18 -0
  42. package/dist/getPublicKey.d.ts +18 -0
  43. package/dist/index.d.ts +18 -1
  44. package/dist/index.js +1 -2
  45. package/dist/invites/createInviteBody.js +1 -1
  46. package/dist/invites/index.d.ts +18 -0
  47. package/dist/invites/index.js +1 -1
  48. package/dist/invites/sendInvite.d.ts +18 -0
  49. package/dist/invites/types.d.ts +18 -0
  50. package/dist/service.d.ts +3 -0
  51. package/dist/service.js +2 -1
  52. package/dist/templates/TemplatesEnum.d.ts +18 -0
  53. package/dist/templates/TemplatesEnum.js +1 -1
  54. package/dist/users/createCreateUser.d.ts +18 -0
  55. package/dist/users/createCreateUser.js +1 -1
  56. package/dist/users/createCreateUserWithOauth2Code.d.ts +25 -0
  57. package/dist/users/createCreateUserWithOauth2Code.js +109 -0
  58. package/dist/users/createDeleteUser.d.ts +18 -0
  59. package/dist/users/createDeleteUser.js +1 -1
  60. package/dist/users/createGetUser.d.ts +18 -0
  61. package/dist/users/createGetUser.js +1 -1
  62. package/dist/users/createResetPassword.d.ts +18 -0
  63. package/dist/users/createResetPassword.js +2 -2
  64. package/dist/users/createResetPasswordBody.js +1 -1
  65. package/dist/users/createSendResetPasswordCode.d.ts +18 -0
  66. package/dist/users/createSendResetPasswordCode.js +10 -2
  67. package/dist/users/createUpdateUser.d.ts +18 -0
  68. package/dist/users/createUpdateUser.js +1 -1
  69. package/dist/users/index.d.ts +19 -0
  70. package/dist/users/index.js +2 -1
  71. package/dist/users/sendResetPasswordEmail.d.ts +18 -0
  72. package/dist/users/types.d.ts +18 -0
  73. package/dist/users/upsertDefaultUser.js +1 -1
  74. package/dist/utils/createGenerateCallAccessToken.js +2 -2
  75. package/dist/utils/createGenerateVerificationCode.d.ts +1 -1
  76. package/dist/utils/createGenerateVerificationCode.js +18 -0
  77. package/dist/utils/createGenerateWorkspaceInviteToken.js +1 -1
  78. package/dist/utils/createGetAccessKeyIdFromEmail.d.ts +18 -0
  79. package/dist/utils/createGetAccessKeyIdFromEmail.js +0 -18
  80. package/dist/utils/createGetApiKeyByAccessKeyId.d.ts +18 -0
  81. package/dist/utils/createGetUserByAccessKeyId.d.ts +18 -0
  82. package/dist/utils/createGetUserByEmail.d.ts +18 -0
  83. package/dist/utils/createGetUserByWorkspaceAccessKeyId.d.ts +18 -0
  84. package/dist/utils/createIsUserContactVerified.d.ts +18 -0
  85. package/dist/utils/createIsValidVerificationCode.d.ts +1 -1
  86. package/dist/utils/createIsValidVerificationCode.js +18 -0
  87. package/dist/utils/createSendEmail.js +1 -1
  88. package/dist/utils/createUpdateMembershipStatus.js +2 -2
  89. package/dist/utils/generateAccessKeyId.js +1 -1
  90. package/dist/utils/generateAccessKeySecret.js +1 -1
  91. package/dist/utils/getAccessKeyIdFromToken.js +1 -1
  92. package/dist/utils/getGitHubUserWithOauth2Code.d.ts +6 -0
  93. package/dist/utils/getGitHubUserWithOauth2Code.js +57 -0
  94. package/dist/utils/getUserRefFromToken.js +1 -1
  95. package/dist/utils/hasAccessToResource.js +2 -2
  96. package/dist/utils/index.d.ts +18 -0
  97. package/dist/utils/index.js +1 -1
  98. package/dist/utils/withAccess.d.ts +18 -0
  99. package/dist/verification/createBodyForVerificationEmail.js +1 -1
  100. package/dist/verification/createBodyForVerificationMessage.js +1 -1
  101. package/dist/verification/createSendVerificationCode.d.ts +18 -0
  102. package/dist/verification/createSendVerificationCode.js +2 -2
  103. package/dist/verification/createVerifyCode.d.ts +18 -0
  104. package/dist/verification/createVerifyCode.js +1 -1
  105. package/dist/verification/index.d.ts +18 -0
  106. package/dist/verification/index.js +1 -1
  107. package/dist/verification/sendVerificationEmail.d.ts +18 -0
  108. package/dist/verification/sendVerificationMessage.d.ts +18 -0
  109. package/dist/verification/types.d.ts +18 -0
  110. package/dist/workspaces/createCreateWorkspace.d.ts +18 -0
  111. package/dist/workspaces/createCreateWorkspace.js +1 -1
  112. package/dist/workspaces/createDeleteWorkspace.d.ts +18 -0
  113. package/dist/workspaces/createDeleteWorkspace.js +1 -1
  114. package/dist/workspaces/createGetWorkspace.d.ts +18 -0
  115. package/dist/workspaces/createGetWorkspace.js +1 -1
  116. package/dist/workspaces/createInviteUserToWorkspace.d.ts +18 -0
  117. package/dist/workspaces/createInviteUserToWorkspace.js +3 -3
  118. package/dist/workspaces/createIsAdminMember.js +1 -1
  119. package/dist/workspaces/createIsWorkspaceMember.d.ts +18 -0
  120. package/dist/workspaces/createListWorkspaceMembers.d.ts +18 -0
  121. package/dist/workspaces/createListWorkspaceMembers.js +1 -1
  122. package/dist/workspaces/createListWorkspaces.d.ts +18 -0
  123. package/dist/workspaces/createListWorkspaces.js +1 -1
  124. package/dist/workspaces/createRemoveUserFromWorkspace.d.ts +18 -0
  125. package/dist/workspaces/createRemoveUserFromWorkspace.js +2 -2
  126. package/dist/workspaces/createResendWorkspaceMembershipInvitation.d.ts +18 -0
  127. package/dist/workspaces/createResendWorkspaceMembershipInvitation.js +2 -2
  128. package/dist/workspaces/createUpdateWorkspace.d.ts +18 -0
  129. package/dist/workspaces/createUpdateWorkspace.js +2 -2
  130. package/dist/workspaces/index.d.ts +18 -0
  131. package/dist/workspaces/index.js +1 -1
  132. package/package.json +5 -5
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  import { GrpcErrorMessage } from "@fonoster/common";
2
20
  import { CreateApiKeyRequest, CreateApiKeyResponse } from "@fonoster/types";
3
21
  import { Prisma } from "../db";
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.createCreateApiKey = createCreateApiKey;
13
- /*
13
+ /**
14
14
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
15
15
  * http://github.com/fonoster/fonoster
16
16
  *
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  import { GrpcErrorMessage } from "@fonoster/common";
2
20
  import { Prisma } from "../db";
3
21
  declare function createDeleteApiKey(prisma: Prisma): (call: {
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.createDeleteApiKey = createDeleteApiKey;
13
- /*
13
+ /**
14
14
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
15
15
  * http://github.com/fonoster/fonoster
16
16
  *
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  import { GrpcErrorMessage } from "@fonoster/common";
2
20
  import { Prisma } from "../db";
3
21
  declare function createListApiKeys(prisma: Prisma): (call: {
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.createListApiKeys = createListApiKeys;
13
- /*
13
+ /**
14
14
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
15
15
  * http://github.com/fonoster/fonoster
16
16
  *
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  import { GrpcErrorMessage } from "@fonoster/common";
2
20
  import { Prisma } from "../db";
3
21
  declare function createRegenerateApiKey(prisma: Prisma): (call: {
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.createRegenerateApiKey = createRegenerateApiKey;
13
- /*
13
+ /**
14
14
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
15
15
  * http://github.com/fonoster/fonoster
16
16
  *
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  export * from "./createCreateApiKey";
2
20
  export * from "./createDeleteApiKey";
3
21
  export * from "./createListApiKeys";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- /*
17
+ /**
18
18
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
19
19
  * http://github.com/fonoster/fonoster
20
20
  *
@@ -1,2 +1,20 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  export declare const SIGN_ALGORITHM = "RS256";
2
20
  export declare const VERIFICATION_CODE_EXPIRATION: number;
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERIFICATION_CODE_EXPIRATION = exports.SIGN_ALGORITHM = void 0;
4
- /*
4
+ /**
5
5
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
6
  * http://github.com/fonoster/fonoster
7
7
  *
package/dist/db.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createPrismaClient = void 0;
4
- /*
4
+ /**
5
5
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
6
  * http://github.com/fonoster/fonoster
7
7
  *
@@ -19,8 +19,8 @@ exports.createPrismaClient = void 0;
19
19
  * See the License for the specific language governing permissions and
20
20
  * limitations under the License.
21
21
  */
22
- const client_1 = require("./generated/@prisma/client");
23
22
  const prisma_field_encryption_1 = require("prisma-field-encryption");
23
+ const client_1 = require("./generated/@prisma/client");
24
24
  const createPrismaClient = (dbUrl, cloakEncryptionKey) => {
25
25
  return new client_1.PrismaClient({
26
26
  datasources: { db: { url: dbUrl } }
@@ -1,6 +1,24 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  import { GrpcErrorMessage } from "@fonoster/common";
2
- import { IdentityConfig } from "./types";
3
20
  import { Prisma } from "../db";
21
+ import { IdentityConfig } from "./types";
4
22
  declare function createExchangeApiKey(prisma: Prisma, identityConfig: IdentityConfig): (call: {
5
23
  request: unknown;
6
24
  }, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
@@ -43,7 +43,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.createExchangeApiKey = createExchangeApiKey;
46
- /*
46
+ /**
47
47
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
48
48
  * http://github.com/fonoster/fonoster
49
49
  *
@@ -64,8 +64,8 @@ exports.createExchangeApiKey = createExchangeApiKey;
64
64
  const common_1 = require("@fonoster/common");
65
65
  const logger_1 = require("@fonoster/logger");
66
66
  const grpc = __importStar(require("@grpc/grpc-js"));
67
- const exchangeTokens_1 = require("./exchangeTokens");
68
67
  const createGetApiKeyByAccessKeyId_1 = require("../utils/createGetApiKeyByAccessKeyId");
68
+ const exchangeTokens_1 = require("./exchangeTokens");
69
69
  const logger = (0, logger_1.getLogger)({ service: "identity", filePath: __filename });
70
70
  function createExchangeApiKey(prisma, identityConfig) {
71
71
  const exchangeApiKey = (call, callback) => __awaiter(this, void 0, void 0, function* () {
@@ -1,6 +1,24 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  import { GrpcErrorMessage } from "@fonoster/common";
2
- import { IdentityConfig } from "./types";
3
20
  import { Prisma } from "../db";
21
+ import { IdentityConfig } from "./types";
4
22
  declare function createExchangeCredentials(prisma: Prisma, identityConfig: IdentityConfig): (call: {
5
23
  request: unknown;
6
24
  }, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
@@ -43,7 +43,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.createExchangeCredentials = createExchangeCredentials;
46
- /*
46
+ /**
47
47
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
48
48
  * http://github.com/fonoster/fonoster
49
49
  *
@@ -64,10 +64,10 @@ exports.createExchangeCredentials = createExchangeCredentials;
64
64
  const common_1 = require("@fonoster/common");
65
65
  const logger_1 = require("@fonoster/logger");
66
66
  const grpc = __importStar(require("@grpc/grpc-js"));
67
- const exchangeTokens_1 = require("./exchangeTokens");
68
- const createIsValidVerificationCode_1 = require("../utils/createIsValidVerificationCode");
69
67
  const createGetUserByEmail_1 = require("../utils/createGetUserByEmail");
68
+ const createIsValidVerificationCode_1 = require("../utils/createIsValidVerificationCode");
70
69
  const verification_1 = require("../verification");
70
+ const exchangeTokens_1 = require("./exchangeTokens");
71
71
  const logger = (0, logger_1.getLogger)({ service: "identity", filePath: __filename });
72
72
  const verificationRequiredButNotProvided = (identityConfig, user) => identityConfig.userVerificationRequired &&
73
73
  (!user.emailVerified || !user.phoneNumberVerified);
@@ -1,6 +1,24 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  import { GrpcErrorMessage } from "@fonoster/common";
2
- import { IdentityConfig } from "./types";
3
20
  import { Prisma } from "../db";
21
+ import { IdentityConfig } from "./types";
4
22
  declare function createExchangeOauth2Code(prisma: Prisma, identityConfig: IdentityConfig): (call: {
5
23
  request: unknown;
6
24
  }, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
@@ -43,7 +43,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.createExchangeOauth2Code = createExchangeOauth2Code;
46
- /*
46
+ /**
47
47
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
48
48
  * http://github.com/fonoster/fonoster
49
49
  *
@@ -64,34 +64,20 @@ exports.createExchangeOauth2Code = createExchangeOauth2Code;
64
64
  const common_1 = require("@fonoster/common");
65
65
  const logger_1 = require("@fonoster/logger");
66
66
  const grpc = __importStar(require("@grpc/grpc-js"));
67
- const exchangeTokens_1 = require("./exchangeTokens");
68
67
  const createGetUserByEmail_1 = require("../utils/createGetUserByEmail");
68
+ const getGitHubUserWithOauth2Code_1 = require("../utils/getGitHubUserWithOauth2Code");
69
+ const exchangeTokens_1 = require("./exchangeTokens");
69
70
  const logger = (0, logger_1.getLogger)({ service: "identity", filePath: __filename });
70
71
  function createExchangeOauth2Code(prisma, identityConfig) {
71
72
  const exchangeOauth2Code = (call, callback) => __awaiter(this, void 0, void 0, function* () {
72
73
  const { request } = call;
73
74
  const { provider, code } = request;
74
75
  logger.verbose("call to exchangeOauth2Code", { provider });
75
- const tokenResponse = yield fetch("https://github.com/login/oauth/access_token", {
76
- method: "POST",
77
- headers: {
78
- "Content-Type": "application/json",
79
- Accept: "application/json"
80
- },
81
- body: JSON.stringify({
82
- client_id: identityConfig.githubOauth2Config.clientId,
83
- client_secret: identityConfig.githubOauth2Config.clientSecret,
84
- code
85
- })
86
- });
87
- const tokenData = yield tokenResponse.json();
88
- const accessToken = tokenData === null || tokenData === void 0 ? void 0 : tokenData.access_token;
89
- const userResponse = yield fetch("https://api.github.com/user", {
90
- headers: {
91
- Authorization: `token ${accessToken}`
92
- }
76
+ const userData = yield (0, getGitHubUserWithOauth2Code_1.getGitHubUserWithOauth2Code)({
77
+ clientId: identityConfig.githubOauth2Config.clientId,
78
+ clientSecret: identityConfig.githubOauth2Config.clientSecret,
79
+ code
93
80
  });
94
- const userData = yield userResponse.json();
95
81
  const user = yield (0, createGetUserByEmail_1.createGetUserByEmail)(prisma)(userData.email);
96
82
  if (!user) {
97
83
  return callback({
@@ -1,6 +1,24 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  import { GrpcErrorMessage } from "@fonoster/common";
2
- import { IdentityConfig } from "./types";
3
20
  import { Prisma } from "../db";
21
+ import { IdentityConfig } from "./types";
4
22
  declare function createExchangeRefreshToken(prisma: Prisma, identityConfig: IdentityConfig): (call: {
5
23
  request: unknown;
6
24
  }, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.createExchangeRefreshToken = createExchangeRefreshToken;
16
- /*
16
+ /**
17
17
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
18
18
  * http://github.com/fonoster/fonoster
19
19
  *
@@ -34,8 +34,8 @@ exports.createExchangeRefreshToken = createExchangeRefreshToken;
34
34
  const common_1 = require("@fonoster/common");
35
35
  const logger_1 = require("@fonoster/logger");
36
36
  const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
37
- const exchangeTokens_1 = require("./exchangeTokens");
38
37
  const constants_1 = require("../constants");
38
+ const exchangeTokens_1 = require("./exchangeTokens");
39
39
  const logger = (0, logger_1.getLogger)({ service: "identity", filePath: __filename });
40
40
  function createExchangeRefreshToken(prisma, identityConfig) {
41
41
  const exchangeRefreshToken = (call, callback) => __awaiter(this, void 0, void 0, function* () {
@@ -1,5 +1,5 @@
1
- import { IdentityConfig } from "./types";
2
1
  import { Prisma } from "../db";
2
+ import { IdentityConfig } from "./types";
3
3
  declare function exchangeTokens(prisma: Prisma, identityConfig: IdentityConfig): (accessKeyId: string) => Promise<{
4
4
  idToken: any;
5
5
  accessToken: any;
@@ -46,7 +46,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
46
46
  };
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
48
  exports.exchangeTokens = exchangeTokens;
49
- /*
49
+ /**
50
50
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
51
51
  * http://github.com/fonoster/fonoster
52
52
  *
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  export * from "./createExchangeApiKey";
2
20
  export * from "./createExchangeCredentials";
3
21
  export * from "./createExchangeOauth2Code";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- /*
17
+ /**
18
18
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
19
19
  * http://github.com/fonoster/fonoster
20
20
  *
@@ -1,5 +1,23 @@
1
- import { Prisma } from "../../../db";
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
2
19
  import { AccessToken } from "@fonoster/common/";
20
+ import { Prisma } from "../../../db";
3
21
  import { IdentityConfig } from "../../types";
4
22
  declare function createGetAccessTokenPayload(prisma: Prisma, identityConfig: IdentityConfig): (accessKeyId: string) => Promise<AccessToken>;
5
23
  export { createGetAccessTokenPayload };
@@ -10,6 +10,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.createGetAccessTokenPayload = createGetAccessTokenPayload;
13
+ /**
14
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
15
+ * http://github.com/fonoster/fonoster
16
+ *
17
+ * This file is part of Fonoster
18
+ *
19
+ * Licensed under the MIT License (the "License");
20
+ * you may not use this file except in compliance with
21
+ * the License. You may obtain a copy of the License at
22
+ *
23
+ * https://opensource.org/licenses/MIT
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software
26
+ * distributed under the License is distributed on an "AS IS" BASIS,
27
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ * See the License for the specific language governing permissions and
29
+ * limitations under the License.
30
+ */
13
31
  const common_1 = require("@fonoster/common/");
14
32
  function createGetAccessTokenPayload(prisma, identityConfig) {
15
33
  return function getAccessTokenPayload(accessKeyId) {
@@ -1,5 +1,23 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ import { RefreshToken } from "@fonoster/common";
1
20
  import { Prisma } from "../../../db";
2
21
  import { IdentityConfig } from "../../types";
3
- import { RefreshToken } from "@fonoster/common";
4
22
  declare function createGetRefreshTokenPayload(prisma: Prisma, identityConfig: IdentityConfig): (accessKeyId: string) => Promise<RefreshToken>;
5
23
  export { createGetRefreshTokenPayload };
@@ -1,2 +1,20 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  export * from "./createGetAccessTokenPayload";
2
20
  export * from "./createGetRefreshTokenPayload";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- /*
17
+ /**
18
18
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
19
19
  * http://github.com/fonoster/fonoster
20
20
  *
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/fonoster
4
+ *
5
+ * This file is part of Fonoster
6
+ *
7
+ * Licensed under the MIT License (the "License");
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
1
19
  import { RefreshToken } from "@fonoster/common";
2
20
  import { IdentityConfig } from "../types";
3
21
  declare function buildRefreshTokenPayload(params: {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildRefreshTokenPayload = buildRefreshTokenPayload;
4
- /*
4
+ /**
5
5
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
6
  * http://github.com/fonoster/fonoster
7
7
  *