flashauthbyjagwar 3.0.0 → 3.5.0

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/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
- Copyright (c) 2025 Jagwar. All rights reserved.
2
-
3
- This software and associated documentation files (the "Software") are the exclusive property of Jagwar.
4
-
5
- Unauthorized copying, modification, distribution, or use of this Software, in whole or in part, is strictly prohibited without the express written permission of the copyright holder.
6
-
7
- For licensing inquiries, please contact: https://github.com/jagwar7
1
+ Copyright (c) 2025 Jagwar. All rights reserved.
2
+
3
+ This software and associated documentation files (the "Software") are the exclusive property of Jagwar.
4
+
5
+ Unauthorized copying, modification, distribution, or use of this Software, in whole or in part, is strictly prohibited without the express written permission of the copyright holder.
6
+
7
+ For licensing inquiries, please contact: https://github.com/jagwar7
package/README.md CHANGED
@@ -1,69 +1,69 @@
1
- ```text
2
- +----------------------+ +-----------------------------------+
3
- | User Triggers Auth | | FlashAuth SDK Captures |
4
- | in React App |---->| Credentials |
5
- | (Login Button) | | (Email/Password or OAuth Token) |
6
- +----------------------+ +-------------------+---------------+
7
- |
8
- |
9
- |
10
- v
11
- +-----------------------------------------------------------------------------------------------+
12
- | SDK Sends Encrypted Request to FlashAuth Backend with FlashAuth Client Public Key |
13
- +-----------------------------------------------------------------------------------------------+
14
- |
15
- |
16
- |
17
- |
18
- +------------------------------------------------------------------------+
19
- | Backend Finds and Connect to Client' Database by Client Pubilc Key |
20
- +------------------------------------------------------------------------+
21
- |
22
- |
23
- |
24
- +----------------------+ +----------------------------------+
25
- | If Failed ? |<-------------| If Successfully connected ? |
26
- +----------------------+ +--------+-------------------------+
27
- | |
28
- | |
29
- | v
30
- | +----------------------------------------------------------------------+
31
- | | Backend Attempt for Creating / Updating user in client's database |
32
- | | (Custom Logic + Security Checks) |
33
- | +----------------------------------------------------------------------+
34
- | |
35
- | v
36
- +----------------------+ +-----------------------------------------+
37
- | If Failed ? |<-----------| If Successfuly Created / Updated ? |
38
- +----------------------+ +---------------+-------------------------+
39
- | |
40
- + +---------------+
41
- | |
42
- | |
43
- | |
44
- v v
45
- +---------------------------------+ +---------------------------------+
46
- | Error: Reject Auth | | Create/Update User in client's |
47
- | (Invalid Credentials) | | Database |
48
- +-----------------+---------------+ +-----------------+---------------+
49
- | |
50
- | +-----------------------+
51
- | |
52
- | |
53
- | |
54
- | v
55
- | +-----------------------------------------------------+
56
- | | Backend Sends Callback to App |
57
- | | (Update Auth State) |
58
- | +-----------------------------------------------------+
59
- | |
60
- | v
61
- | +------------------+
62
- +------->| User Logged In!|<-------+
63
- | (Redirect/Unlock | |
64
- | Features) | |
65
- +------------------+ |
66
- | |
67
- +------------------+
68
- Optional: Retry Flow
1
+ ```text
2
+ +----------------------+ +-----------------------------------+
3
+ | User Triggers Auth | | FlashAuth SDK Captures |
4
+ | in React App |---->| Credentials |
5
+ | (Login Button) | | (Email/Password or OAuth Token) |
6
+ +----------------------+ +-------------------+---------------+
7
+ |
8
+ |
9
+ |
10
+ v
11
+ +-----------------------------------------------------------------------------------------------+
12
+ | SDK Sends Encrypted Request to FlashAuth Backend with FlashAuth Client Public Key |
13
+ +-----------------------------------------------------------------------------------------------+
14
+ |
15
+ |
16
+ |
17
+ |
18
+ +------------------------------------------------------------------------+
19
+ | Backend Finds and Connect to Client' Database by Client Pubilc Key |
20
+ +------------------------------------------------------------------------+
21
+ |
22
+ |
23
+ |
24
+ +----------------------+ +----------------------------------+
25
+ | If Failed ? |<-------------| If Successfully connected ? |
26
+ +----------------------+ +--------+-------------------------+
27
+ | |
28
+ | |
29
+ | v
30
+ | +----------------------------------------------------------------------+
31
+ | | Backend Attempt for Creating / Updating user in client's database |
32
+ | | (Custom Logic + Security Checks) |
33
+ | +----------------------------------------------------------------------+
34
+ | |
35
+ | v
36
+ +----------------------+ +-----------------------------------------+
37
+ | If Failed ? |<-----------| If Successfuly Created / Updated ? |
38
+ +----------------------+ +---------------+-------------------------+
39
+ | |
40
+ + +---------------+
41
+ | |
42
+ | |
43
+ | |
44
+ v v
45
+ +---------------------------------+ +---------------------------------+
46
+ | Error: Reject Auth | | Create/Update User in client's |
47
+ | (Invalid Credentials) | | Database |
48
+ +-----------------+---------------+ +-----------------+---------------+
49
+ | |
50
+ | +-----------------------+
51
+ | |
52
+ | |
53
+ | |
54
+ | v
55
+ | +-----------------------------------------------------+
56
+ | | Backend Sends Callback to App |
57
+ | | (Update Auth State) |
58
+ | +-----------------------------------------------------+
59
+ | |
60
+ | v
61
+ | +------------------+
62
+ +------->| User Logged In!|<-------+
63
+ | (Redirect/Unlock | |
64
+ | Features) | |
65
+ +------------------+ |
66
+ | |
67
+ +------------------+
68
+ Optional: Retry Flow
69
69
  ```
@@ -1 +1 @@
1
- {"version":3,"file":"OAuthPopupManager.d.ts","sourceRoot":"","sources":["../../src/providers/OAuthPopupManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAI,MAAM,kCAAkC,CAAC;AAExE,MAAM,CAAC,OAAO,OAAO,iBAAkB,YAAW,kBAAkB;IAEhE,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI;IAM/E,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA+B9E"}
1
+ {"version":3,"file":"OAuthPopupManager.d.ts","sourceRoot":"","sources":["../../src/providers/OAuthPopupManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAI,MAAM,kCAAkC,CAAC;AAExE,MAAM,CAAC,OAAO,OAAO,iBAAkB,YAAW,kBAAkB;IAEhE,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI;IAS/E,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAuC9E"}
@@ -7,25 +7,29 @@ class OAuthPopupManager {
7
7
  return window.open(url, name, `width=${width},height=${height},left=${left},top=${top}`);
8
8
  }
9
9
  async handleAuthResponse(popup, serverURL) {
10
- return await new Promise((resolve, reject) => {
10
+ return new Promise((resolve, reject) => {
11
+ let checkPopup;
12
+ const cleanup = () => {
13
+ clearInterval(checkPopup);
14
+ window.removeEventListener("message", popupEventResponse);
15
+ };
11
16
  const popupEventResponse = (event) => {
12
17
  if (event.origin !== serverURL.replace(/\/$/, ""))
13
18
  return;
14
19
  const data = event.data;
15
20
  if (data.type === "FLASHAUTH_TOKEN" && data.token) {
16
- window.removeEventListener("message", popupEventResponse);
21
+ cleanup();
17
22
  resolve(data.token);
18
23
  }
19
24
  else if (data.type === "FLASHAUTH_ERROR") {
20
- window.removeEventListener("message", popupEventResponse);
25
+ cleanup();
21
26
  reject(new Error(data.error || "Authentication Failed"));
22
27
  }
23
28
  };
24
29
  window.addEventListener("message", popupEventResponse);
25
- const checkPopup = setInterval(() => {
30
+ checkPopup = setInterval(() => {
26
31
  if (popup.closed) {
27
- clearInterval(checkPopup);
28
- window.removeEventListener("message", popupEventResponse);
32
+ cleanup();
29
33
  reject(new Error("FlashAuth: Popup closed by user"));
30
34
  }
31
35
  }, 500);
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "flashauthbyjagwar",
3
- "version": "3.0.0",
4
- "description": "An authentication SDK for your React site. No need to write auth logic — just create an account at flashauth.connectjagwar.com to get started.",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "module": "dist/index.js",
8
- "files": [
9
- "dist",
10
- "README.md",
11
- "LICENSE"
12
- ],
13
- "scripts": {
14
- "build": "npm run clean && tsc",
15
- "watch": "tsc --watch",
16
- "clean": "rimraf dist && rimraf .history",
17
- "prepublishOnly": "npm run build"
18
- },
19
- "repository": {
20
- "type": "git",
21
- "url": "https://github.com/jagwar7/flashauth-sdk.git"
22
- },
23
- "keywords": [
24
- "flashauth",
25
- "authentication",
26
- "sdk",
27
- "firebase",
28
- "google-signin",
29
- "typescript",
30
- "javascript"
31
- ],
32
- "author": {
33
- "name": "Jagwar",
34
- "url": "https://github.com/jagwar7"
35
- },
36
- "license": "MIT",
37
- "bugs": {
38
- "url": "https://github.com/jagwar7/flashauth-sdk/issues"
39
- },
40
- "homepage": "https://github.com/jagwar7/flashauth-sdk#readme",
41
- "dependencies": {
42
- "firebase": "^12.1.0",
43
- "jwt-decode": "^4.0.0"
44
- },
45
- "devDependencies": {
46
- "rimraf": "^6.0.1",
47
- "typescript": "^5.9.2"
48
- },
49
- "private": false
50
- }
1
+ {
2
+ "name": "flashauthbyjagwar",
3
+ "version": "3.5.0",
4
+ "description": "An authentication SDK for your React site. No need to write auth logic — just create an account at flashauth.connectjagwar.com to get started.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "module": "dist/index.js",
8
+ "files": [
9
+ "dist",
10
+ "README.md",
11
+ "LICENSE"
12
+ ],
13
+ "scripts": {
14
+ "build": "npm run clean && tsc",
15
+ "watch": "tsc --watch",
16
+ "clean": "rimraf dist && rimraf .history",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/jagwar7/flashauth-sdk.git"
22
+ },
23
+ "keywords": [
24
+ "flashauth",
25
+ "authentication",
26
+ "sdk",
27
+ "firebase",
28
+ "google-signin",
29
+ "typescript",
30
+ "javascript"
31
+ ],
32
+ "author": {
33
+ "name": "Jagwar",
34
+ "url": "https://github.com/jagwar7"
35
+ },
36
+ "license": "MIT",
37
+ "bugs": {
38
+ "url": "https://github.com/jagwar7/flashauth-sdk/issues"
39
+ },
40
+ "homepage": "https://github.com/jagwar7/flashauth-sdk#readme",
41
+ "dependencies": {
42
+ "firebase": "^12.1.0",
43
+ "jwt-decode": "^4.0.0"
44
+ },
45
+ "devDependencies": {
46
+ "rimraf": "^6.1.3",
47
+ "typescript": "^5.9.2"
48
+ },
49
+ "private": false
50
+ }