@cyphlens/2fa-sse-sdk 2.0.1 → 2.1.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/README.md +31 -29
- package/dist/bundle.min.js +1 -1
- package/dist/bundle.min.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/index.d.ts +10 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +6 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,13 +30,15 @@ yarn add @cyphlens/2fa-sse-sdk
|
|
|
30
30
|
### Using CDN (Browser)
|
|
31
31
|
Include the SDK directly in your HTML:
|
|
32
32
|
```html
|
|
33
|
-
<script src="https://cdn.jsdelivr.net/npm/@cyphlens/2fa-sse-sdk@2/dist/bundle.min.js"
|
|
33
|
+
<script src="https://cdn.jsdelivr.net/npm/@cyphlens/2fa-sse-sdk@2/dist/bundle.min.js"></script>
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
---
|
|
37
37
|
|
|
38
38
|
## Usage 🔧
|
|
39
39
|
|
|
40
|
+
> 💡 **Tip:** Start with the **Sandbox** base URL for development and testing.
|
|
41
|
+
|
|
40
42
|
### Importing the SDK
|
|
41
43
|
|
|
42
44
|
#### 1. ES Modules (ESM) - Modern JavaScript
|
|
@@ -52,7 +54,7 @@ const { Cyphlens, EventType } = require("@cyphlens/2fa-sse-sdk");
|
|
|
52
54
|
#### 3. Browser (IIFE)
|
|
53
55
|
After including the CDN script, the SDK is available as a global `Cyphlens` object:
|
|
54
56
|
```javascript
|
|
55
|
-
const cyphlensClient = new Cyphlens("https://
|
|
57
|
+
const cyphlensClient = new Cyphlens("https://api.sandbox.cyphlens.com/b2b/v1");
|
|
56
58
|
```
|
|
57
59
|
|
|
58
60
|
---
|
|
@@ -61,49 +63,52 @@ const cyphlensClient = new Cyphlens("https://your-api-base-url/b2b/v1");
|
|
|
61
63
|
|
|
62
64
|
#### 1. Initialize the Client
|
|
63
65
|
```javascript
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const cyphlensClient = new Cyphlens(`${baseUrl}/b2b/v1`);
|
|
66
|
+
const baseUrl = "https://api.sandbox.cyphlens.com/b2b/v1"; // Use the correct Cyphlens base URL
|
|
67
|
+
const sessionId = "your-session-id"; // Replace with the current session ID
|
|
68
|
+
const cyphlensClient = new Cyphlens(baseUrl); // Initialize the Cyphlens client
|
|
68
69
|
```
|
|
69
70
|
|
|
70
71
|
#### 2. Listen for Events
|
|
71
72
|
```javascript
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
// Define the callback for handling events
|
|
74
|
+
const onData = (eventType, data) => {
|
|
75
|
+
if (eventType === EventType.MFASwipe) {
|
|
76
|
+
const twoFactorEvent = data;
|
|
77
|
+
console.log("2FA Status:", twoFactorEvent.status);
|
|
78
|
+
// Handle status change (e.g., update UI or trigger logic)
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const onError = (error) => {
|
|
82
|
+
console.error("SSE Error:", error);
|
|
83
|
+
// Handle the error (e.g., retry connection, notify user)
|
|
84
|
+
};
|
|
85
|
+
// Start listening to events
|
|
86
|
+
cyphlensClient.listen(sessionId, onData, onError);
|
|
86
87
|
```
|
|
87
88
|
|
|
88
89
|
#### 3. Stop Listening
|
|
89
90
|
```javascript
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
// Stop the event listener when no longer needed
|
|
92
|
+
cyphlensClient.stop();
|
|
92
93
|
```
|
|
93
94
|
|
|
94
95
|
---
|
|
95
96
|
|
|
96
97
|
## API Reference 📚
|
|
97
98
|
|
|
98
|
-
### ```new Cyphlens(baseUrl)```
|
|
99
|
-
- **baseUrl**: `string` - The base URL of your Cyphlens API (e.g., `"https://api.cyphlens.com/b2b/v1"`)
|
|
99
|
+
### ```new Cyphlens(baseUrl)```
|
|
100
100
|
Creates a new instance of the Cyphlens client.
|
|
101
101
|
|
|
102
|
+
- **baseUrl**: `string` — Cyphlens API base URL
|
|
103
|
+
- **Production**: `https://api.prod.cyphlens.com/b2b/v1`
|
|
104
|
+
- **Sandbox**: `https://api.sandbox.cyphlens.com/b2b/v1`
|
|
105
|
+
|
|
102
106
|
### ```listen(sessionId, callback, errorCallback)```
|
|
107
|
+
Starts listening for Server-Sent Events tied to the specified session.
|
|
108
|
+
|
|
103
109
|
- **sessionId**: `string` - The session ID to listen for events
|
|
104
|
-
- **callback**: `(eventType:
|
|
110
|
+
- **callback**: `(eventType: EventType, data: any) => void` - Callback function to handle incoming events
|
|
105
111
|
- **errorCallback**: `(error: Event) => void` - Callback function to handle errors (optional)
|
|
106
|
-
Starts listening for Server-Sent Events tied to the specified session.
|
|
107
112
|
|
|
108
113
|
### ```stop()```
|
|
109
114
|
Stops the event listener and closes the connection.
|
|
@@ -146,6 +151,3 @@ If you're looking for docs on maintaining this package, head over to [docs/](./d
|
|
|
146
151
|
## License 📄
|
|
147
152
|
This project is licensed under the Cyphlens License. See the [LICENSE](https://cyphlens.com/legal/terms-and-conditions.html) file for details.
|
|
148
153
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
package/dist/bundle.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Cyphlens=function(){"use strict";var t,e;!function(t){t.MFASwipe="MFA.SWIPE",t.Disconnect="DISCONNECT"}(t||(t={})),function(t){t.Pending="PENDING",t.Success="SUCCESS",t.Expired="EXPIRED"}(e||(e={}));class s{constructor(t="https://api.prod.cyphme.com/b2b/v1"){this.eventSource=null,this.timeoutId=null,this.onVisibilityChange=()=>{/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&/iP(ad|od|hone)/i.test(navigator.userAgent)&&"visible"===document.visibilityState&&this.sessionID&&this.start()},this.baseUrl=t}setBaseUrl(t){this.baseUrl=t}start(){
|
|
1
|
+
var Cyphlens=function(){"use strict";var t,e;!function(t){t.MFASwipe="MFA.SWIPE",t.Disconnect="DISCONNECT",t.FileKeySwipe="FILEKEY.SWIPE"}(t||(t={})),function(t){t.Pending="PENDING",t.Success="SUCCESS",t.Expired="EXPIRED"}(e||(e={}));class s{constructor(t="https://api.prod.cyphme.com/b2b/v1",e=!1){this.eventSource=null,this.timeoutId=null,this.onVisibilityChange=()=>{/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&/iP(ad|od|hone)/i.test(navigator.userAgent)&&"visible"===document.visibilityState&&this.sessionID&&this.start()},this.baseUrl=t,this.isFileKeySwipe=e}setBaseUrl(t){this.baseUrl=t}setIsFileKeySwipe(t){this.isFileKeySwipe=t}start(){if(!this.sessionID)return null;this.stop();const s=this.isFileKeySwipe?"checkpoint":"cyphlens";return this.eventSource=new EventSource(`${this.baseUrl}/${s}/status-events?sid=${this.sessionID}`),this.eventSource.addEventListener(t.MFASwipe,s=>{try{const i=JSON.parse(s.data);i.status===e.Pending&&this.setupTimeout(i.expiresAt),this.onSuccess?.(t.MFASwipe,i)}catch(t){console.error("Error parsing event data:",t);const e=new Event("Something went wrong");this.onError?.(e)}}),this.eventSource.addEventListener(t.Disconnect,e=>{this.stop();const s=e.data;this.onSuccess?.(t.Disconnect,s)}),this.eventSource.addEventListener(t.FileKeySwipe,s=>{try{const i=JSON.parse(s.data);i.status===e.Pending&&this.setupTimeout(i.expiresAt),this.onSuccess?.(t.FileKeySwipe,i)}catch(t){console.error("Error parsing event data:",t);const e=new Event("Something went wrong");this.onError?.(e)}}),this.eventSource.addEventListener("error",t=>{this.onError?.(t)}),this.eventSource}setupTimeout(t){this.timeoutId&&clearTimeout(this.timeoutId);const e=t-Date.now()+5e3;this.timeoutId=setTimeout(()=>this.stop(),e)}listen(t,e,s){return this.sessionID=t,this.onSuccess=e,this.onError=s,"undefined"!=typeof document&&document.addEventListener("visibilitychange",this.onVisibilityChange),this.start()}stop(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}}return s.EventType=t,s.StatusType=e,s}();
|
|
2
2
|
//# sourceMappingURL=bundle.min.js.map
|
package/dist/bundle.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.min.js","sources":["../src/types.ts","../src/index.ts","../src/constants.ts","../src/index.iife.js"],"sourcesContent":[null,null,null,"// we are using a separate index.iife.js file as entry point to generate bundle.min.js to have only one default export\nimport { Cyphlens, EventType, StatusType } from \"./index.ts\"\n\nCyphlens.EventType = EventType;\nCyphlens.StatusType = StatusType;\n\nexport default Cyphlens;\n"],"names":["EventType","StatusType","Cyphlens","constructor","baseUrl","this","eventSource","timeoutId","onVisibilityChange","test","navigator","userAgent","document","visibilityState","sessionID","start","setBaseUrl","stop","EventSource","addEventListener","MFASwipe","event","data","JSON","parse","status","Pending","setupTimeout","expiresAt","onSuccess","error","console","errorEvent","Event","onError","Disconnect","clearTimeout","timeoutDuration","Date","now","setTimeout","listen","sessionId","onData","close"],"mappings":"qCAAA,IAAYA,
|
|
1
|
+
{"version":3,"file":"bundle.min.js","sources":["../src/types.ts","../src/index.ts","../src/constants.ts","../src/index.iife.js"],"sourcesContent":[null,null,null,"// we are using a separate index.iife.js file as entry point to generate bundle.min.js to have only one default export\nimport { Cyphlens, EventType, StatusType } from \"./index.ts\"\n\nCyphlens.EventType = EventType;\nCyphlens.StatusType = StatusType;\n\nexport default Cyphlens;\n"],"names":["EventType","StatusType","Cyphlens","constructor","baseUrl","isFileKeySwipe","this","eventSource","timeoutId","onVisibilityChange","test","navigator","userAgent","document","visibilityState","sessionID","start","setBaseUrl","setIsFileKeySwipe","stop","path","EventSource","addEventListener","MFASwipe","event","data","JSON","parse","status","Pending","setupTimeout","expiresAt","onSuccess","error","console","errorEvent","Event","onError","Disconnect","FileKeySwipe","clearTimeout","timeoutDuration","Date","now","setTimeout","listen","sessionId","onData","close"],"mappings":"qCAAA,IAAYA,EAMAC,GANZ,SAAYD,GACVA,EAAA,SAAA,YACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACD,CAJD,CAAYA,IAAAA,EAAS,CAAA,IAMrB,SAAYC,GACVA,EAAA,QAAA,UACAA,EAAA,QAAA,UACAA,EAAA,QAAA,SACD,CAJD,CAAYA,IAAAA,EAAU,CAAA,UCsBTC,EAcX,WAAAC,CACEC,EC3C4B,qCD4C5BC,GAA0B,GAdpBC,KAAAC,YAAkC,KAIlCD,KAAAE,UAAkD,KAiJzCF,KAAAG,mBAAqB,KACb,iCAAiCC,KAAKC,UAAUC,YACrE,kBAAkBF,KAAKC,UAAUC,YACgB,YAA7BC,SAASC,iBAAiCR,KAAKS,WACnET,KAAKU,SAzIPV,KAAKF,QAAUA,EACfE,KAAKD,eAAiBA,CACxB,CAMA,UAAAY,CAAWb,GACTE,KAAKF,QAAUA,CACjB,CAMA,iBAAAc,CAAkBb,GAChBC,KAAKD,eAAiBA,CACxB,CAMQ,KAAAW,GACN,IAAKV,KAAKS,UAAW,OAAO,KAE5BT,KAAKa,OAEL,MAAMC,EAAOd,KAAKD,eAAiB,aAAe,WAgDlD,OA9CAC,KAAKC,YAAc,IAAIc,YAAY,GAAGf,KAAKF,WAAWgB,uBAA0Bd,KAAKS,aAGrFT,KAAKC,YAAYe,iBAAiBtB,EAAUuB,SAAWC,IACrD,IACE,MAAMC,EAAuBC,KAAKC,MAAMH,EAAMC,MAE1CA,EAAKG,SAAW3B,EAAW4B,SAC7BvB,KAAKwB,aAAaL,EAAKM,WAEzBzB,KAAK0B,YAAYhC,EAAUuB,SAAUE,EACvC,CAAE,MAAOQ,GACPC,QAAQD,MAAM,4BAA6BA,GAC3C,MAAME,EAAa,IAAI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),function(t){t.Pending="PENDING",t.Success="SUCCESS",t.Expired="EXPIRED"}(e||(e={}));const s="https://api.prod.cyphme.com/b2b/v1";class i{constructor(t=s){this.eventSource=null,this.timeoutId=null,this.onVisibilityChange=()=>{/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&/iP(ad|od|hone)/i.test(navigator.userAgent)&&"visible"===document.visibilityState&&this.sessionID&&this.start()},this.baseUrl=t}setBaseUrl(t){this.baseUrl=t}start(){
|
|
1
|
+
var t,e;!function(t){t.MFASwipe="MFA.SWIPE",t.Disconnect="DISCONNECT",t.FileKeySwipe="FILEKEY.SWIPE"}(t||(t={})),function(t){t.Pending="PENDING",t.Success="SUCCESS",t.Expired="EXPIRED"}(e||(e={}));const s="https://api.prod.cyphme.com/b2b/v1";class i{constructor(t=s,e=!1){this.eventSource=null,this.timeoutId=null,this.onVisibilityChange=()=>{/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&/iP(ad|od|hone)/i.test(navigator.userAgent)&&"visible"===document.visibilityState&&this.sessionID&&this.start()},this.baseUrl=t,this.isFileKeySwipe=e}setBaseUrl(t){this.baseUrl=t}setIsFileKeySwipe(t){this.isFileKeySwipe=t}start(){if(!this.sessionID)return null;this.stop();const s=this.isFileKeySwipe?"checkpoint":"cyphlens";return this.eventSource=new EventSource(`${this.baseUrl}/${s}/status-events?sid=${this.sessionID}`),this.eventSource.addEventListener(t.MFASwipe,s=>{try{const i=JSON.parse(s.data);i.status===e.Pending&&this.setupTimeout(i.expiresAt),this.onSuccess?.(t.MFASwipe,i)}catch(t){console.error("Error parsing event data:",t);const e=new Event("Something went wrong");this.onError?.(e)}}),this.eventSource.addEventListener(t.Disconnect,e=>{this.stop();const s=e.data;this.onSuccess?.(t.Disconnect,s)}),this.eventSource.addEventListener(t.FileKeySwipe,s=>{try{const i=JSON.parse(s.data);i.status===e.Pending&&this.setupTimeout(i.expiresAt),this.onSuccess?.(t.FileKeySwipe,i)}catch(t){console.error("Error parsing event data:",t);const e=new Event("Something went wrong");this.onError?.(e)}}),this.eventSource.addEventListener("error",t=>{this.onError?.(t)}),this.eventSource}setupTimeout(t){this.timeoutId&&clearTimeout(this.timeoutId);const e=t-Date.now()+5e3;this.timeoutId=setTimeout(()=>this.stop(),e)}listen(t,e,s){return this.sessionID=t,this.onSuccess=e,this.onError=s,"undefined"!=typeof document&&document.addEventListener("visibilitychange",this.onVisibilityChange),this.start()}stop(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}}export{i as Cyphlens,s as DEFAULT_BASE_URL,t as EventType,e as StatusType};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/types.ts","../src/constants.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":["EventType","StatusType","DEFAULT_BASE_URL","Cyphlens","constructor","baseUrl","this","eventSource","timeoutId","onVisibilityChange","test","navigator","userAgent","document","visibilityState","sessionID","start","setBaseUrl","stop","EventSource","addEventListener","MFASwipe","event","data","JSON","parse","status","Pending","setupTimeout","expiresAt","onSuccess","error","console","errorEvent","Event","onError","Disconnect","clearTimeout","timeoutDuration","Date","now","setTimeout","listen","sessionId","onData","close"],"mappings":"IAAYA,
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/types.ts","../src/constants.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":["EventType","StatusType","DEFAULT_BASE_URL","Cyphlens","constructor","baseUrl","isFileKeySwipe","this","eventSource","timeoutId","onVisibilityChange","test","navigator","userAgent","document","visibilityState","sessionID","start","setBaseUrl","setIsFileKeySwipe","stop","path","EventSource","addEventListener","MFASwipe","event","data","JSON","parse","status","Pending","setupTimeout","expiresAt","onSuccess","error","console","errorEvent","Event","onError","Disconnect","FileKeySwipe","clearTimeout","timeoutDuration","Date","now","setTimeout","listen","sessionId","onData","close"],"mappings":"IA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AK0B,YAAYjC,EAAUuC,WAAYb,KAI3CnB,KAAKC,YAAYe,iBAAiBvB,EAAUwC,aAAef,IACzD,IACE,MAAMC,EAAqBC,KAAKC,MAAMH,EAAMC,MAExCA,EAAKG,SAAW5B,EAAW6B,SAC7BvB,KAAKwB,aAAaL,EAAKM,WAEzBzB,KAAK0B,YAAYjC,EAAUwC,aAAcd,EAC3C,CAAE,MAAOQ,GACPC,QAAQD,MAAM,4BAA6BA,GAC3C,MAAME,EAAa,IAAIC,MAAM,wBAC7B9B,KAAK+B,UAAUF,EACjB,IAIF7B,KAAKC,YAAYe,iBAAiB,QAAUE,IAC1ClB,KAAK+B,UAAUb,KAGVlB,KAAKC,WACd,CAMQ,YAAAuB,CAAaC,GACfzB,KAAKE,WACPgC,aAAalC,KAAKE,WAIpB,MAAMiC,EAAkBV,EAAYW,KAAKC,MAAQ,IACjDrC,KAAKE,UAAYoC,WAAW,IAAMtC,KAAKa,OAAQsB,EACjD,CASA,MAAAI,CAAOC,EAAmBC,EAAwBV,GAUhD,OATA/B,KAAKS,UAAY+B,EACjBxC,KAAK0B,UAAYe,EACjBzC,KAAK+B,QAAUA,EAGS,oBAAbxB,UACTA,SAASS,iBAAiB,mBAAoBhB,KAAKG,oBAG9CH,KAAKU,OACd,CAKA,IAAAG,GACMb,KAAKC,cACPD,KAAKC,YAAYyC,QACjB1C,KAAKC,YAAc,MAEjBD,KAAKE,YACPgC,aAAalC,KAAKE,WAClBF,KAAKE,UAAY,KAErB"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t
|
|
1
|
+
"use strict";var e,t;exports.EventType=void 0,(e=exports.EventType||(exports.EventType={})).MFASwipe="MFA.SWIPE",e.Disconnect="DISCONNECT",e.FileKeySwipe="FILEKEY.SWIPE",exports.StatusType=void 0,(t=exports.StatusType||(exports.StatusType={})).Pending="PENDING",t.Success="SUCCESS",t.Expired="EXPIRED";const s="https://api.prod.cyphme.com/b2b/v1";exports.Cyphlens=class{constructor(e=s,t=!1){this.eventSource=null,this.timeoutId=null,this.onVisibilityChange=()=>{/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&/iP(ad|od|hone)/i.test(navigator.userAgent)&&"visible"===document.visibilityState&&this.sessionID&&this.start()},this.baseUrl=e,this.isFileKeySwipe=t}setBaseUrl(e){this.baseUrl=e}setIsFileKeySwipe(e){this.isFileKeySwipe=e}start(){if(!this.sessionID)return null;this.stop();const e=this.isFileKeySwipe?"checkpoint":"cyphlens";return this.eventSource=new EventSource(`${this.baseUrl}/${e}/status-events?sid=${this.sessionID}`),this.eventSource.addEventListener(exports.EventType.MFASwipe,e=>{try{const t=JSON.parse(e.data);t.status===exports.StatusType.Pending&&this.setupTimeout(t.expiresAt),this.onSuccess?.(exports.EventType.MFASwipe,t)}catch(e){console.error("Error parsing event data:",e);const t=new Event("Something went wrong");this.onError?.(t)}}),this.eventSource.addEventListener(exports.EventType.Disconnect,e=>{this.stop();const t=e.data;this.onSuccess?.(exports.EventType.Disconnect,t)}),this.eventSource.addEventListener(exports.EventType.FileKeySwipe,e=>{try{const t=JSON.parse(e.data);t.status===exports.StatusType.Pending&&this.setupTimeout(t.expiresAt),this.onSuccess?.(exports.EventType.FileKeySwipe,t)}catch(e){console.error("Error parsing event data:",e);const t=new Event("Something went wrong");this.onError?.(t)}}),this.eventSource.addEventListener("error",e=>{this.onError?.(e)}),this.eventSource}setupTimeout(e){this.timeoutId&&clearTimeout(this.timeoutId);const t=e-Date.now()+5e3;this.timeoutId=setTimeout(()=>this.stop(),t)}listen(e,t,s){return this.sessionID=e,this.onSuccess=t,this.onError=s,"undefined"!=typeof document&&document.addEventListener("visibilitychange",this.onVisibilityChange),this.start()}stop(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}},exports.DEFAULT_BASE_URL=s;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/types.ts","../src/constants.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":["EventType","StatusType","DEFAULT_BASE_URL","constructor","baseUrl","this","eventSource","timeoutId","onVisibilityChange","test","navigator","userAgent","document","visibilityState","sessionID","start","setBaseUrl","stop","EventSource","addEventListener","MFASwipe","event","data","JSON","parse","status","Pending","setupTimeout","expiresAt","onSuccess","error","console","errorEvent","Event","onError","Disconnect","clearTimeout","timeoutDuration","Date","now","setTimeout","listen","sessionId","onData","close"],"mappings":"aAAA,IAAYA,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/types.ts","../src/constants.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":["EventType","StatusType","DEFAULT_BASE_URL","constructor","baseUrl","isFileKeySwipe","this","eventSource","timeoutId","onVisibilityChange","test","navigator","userAgent","document","visibilityState","sessionID","start","setBaseUrl","setIsFileKeySwipe","stop","path","EventSource","addEventListener","MFASwipe","event","data","JSON","parse","status","Pending","setupTimeout","expiresAt","onSuccess","error","console","errorEvent","Event","onError","Disconnect","FileKeySwipe","clearTimeout","timeoutDuration","Date","now","setTimeout","listen","sessionId","onData","close"],"mappings":"aAAA,IAAYA,EAMAC,EANAD,QAAAA,eAAAA,GAAAA,EAAAA,QAAAA,YAAAA,kBAAS,CAAA,IACnB,SAAA,YACAA,EAAA,WAAA,aACAA,EAAA,aAAA,gBAGUC,QAAAA,gBAAAA,GAAAA,EAAAA,QAAAA,aAAAA,mBAAU,CAAA,IACpB,QAAA,UACAA,EAAA,QAAA,UACAA,EAAA,QAAA,UCTK,MAAMC,EAAmB,4DC0C9B,WAAAC,CACEC,EAAkBF,EAClBG,GAA0B,GAdpBC,KAAAC,YAAkC,KAIlCD,KAAAE,UAAkD,KAiJzCF,KAAAG,mBAAqB,KACb,iCAAiCC,KAAKC,UAAUC,YACrE,kBAAkBF,KAAKC,UAAUC,YACgB,YAA7BC,SAASC,iBAAiCR,KA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B,KAAKC,WACd,CAMQ,YAAAuB,CAAaC,GACfzB,KAAKE,WACPgC,aAAalC,KAAKE,WAIpB,MAAMiC,EAAkBV,EAAYW,KAAKC,MAAQ,IACjDrC,KAAKE,UAAYoC,WAAW,IAAMtC,KAAKa,OAAQsB,EACjD,CASA,MAAAI,CAAOC,EAAmBC,EAAwBV,GAUhD,OATA/B,KAAKS,UAAY+B,EACjBxC,KAAK0B,UAAYe,EACjBzC,KAAK+B,QAAUA,EAGS,oBAAbxB,UACTA,SAASS,iBAAiB,mBAAoBhB,KAAKG,oBAG9CH,KAAKU,OACd,CAKA,IAAAG,GACMb,KAAKC,cACPD,KAAKC,YAAYyC,QACjB1C,KAAKC,YAAc,MAEjBD,KAAKE,YACPgC,aAAalC,KAAKE,WAClBF,KAAKE,UAAY,KAErB"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Cyphlens={})}(this,function(e){"use strict";var t,s;e.EventType=void 0,(t=e.EventType||(e.EventType={})).MFASwipe="MFA.SWIPE",t.Disconnect="DISCONNECT",t.FileKeySwipe="FILEKEY.SWIPE",e.StatusType=void 0,(s=e.StatusType||(e.StatusType={})).Pending="PENDING",s.Success="SUCCESS",s.Expired="EXPIRED";const i="https://api.prod.cyphme.com/b2b/v1";e.Cyphlens=class{constructor(e=i,t=!1){this.eventSource=null,this.timeoutId=null,this.onVisibilityChange=()=>{/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&/iP(ad|od|hone)/i.test(navigator.userAgent)&&"visible"===document.visibilityState&&this.sessionID&&this.start()},this.baseUrl=e,this.isFileKeySwipe=t}setBaseUrl(e){this.baseUrl=e}setIsFileKeySwipe(e){this.isFileKeySwipe=e}start(){if(!this.sessionID)return null;this.stop();const t=this.isFileKeySwipe?"checkpoint":"cyphlens";return this.eventSource=new EventSource(`${this.baseUrl}/${t}/status-events?sid=${this.sessionID}`),this.eventSource.addEventListener(e.EventType.MFASwipe,t=>{try{const s=JSON.parse(t.data);s.status===e.StatusType.Pending&&this.setupTimeout(s.expiresAt),this.onSuccess?.(e.EventType.MFASwipe,s)}catch(e){console.error("Error parsing event data:",e);const t=new Event("Something went wrong");this.onError?.(t)}}),this.eventSource.addEventListener(e.EventType.Disconnect,t=>{this.stop();const s=t.data;this.onSuccess?.(e.EventType.Disconnect,s)}),this.eventSource.addEventListener(e.EventType.FileKeySwipe,t=>{try{const s=JSON.parse(t.data);s.status===e.StatusType.Pending&&this.setupTimeout(s.expiresAt),this.onSuccess?.(e.EventType.FileKeySwipe,s)}catch(e){console.error("Error parsing event data:",e);const t=new Event("Something went wrong");this.onError?.(t)}}),this.eventSource.addEventListener("error",e=>{this.onError?.(e)}),this.eventSource}setupTimeout(e){this.timeoutId&&clearTimeout(this.timeoutId);const t=e-Date.now()+5e3;this.timeoutId=setTimeout(()=>this.stop(),t)}listen(e,t,s){return this.sessionID=e,this.onSuccess=t,this.onError=s,"undefined"!=typeof document&&document.addEventListener("visibilitychange",this.onVisibilityChange),this.start()}stop(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}},e.DEFAULT_BASE_URL=i});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/types.ts","../src/constants.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":["EventType","StatusType","DEFAULT_BASE_URL","constructor","baseUrl","this","eventSource","timeoutId","onVisibilityChange","test","navigator","userAgent","document","visibilityState","sessionID","start","setBaseUrl","stop","EventSource","addEventListener","MFASwipe","event","data","JSON","parse","status","Pending","setupTimeout","expiresAt","onSuccess","error","console","errorEvent","Event","onError","Disconnect","clearTimeout","timeoutDuration","Date","now","setTimeout","listen","sessionId","onData","close"],"mappings":"+OAAA,IAAYA,
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/types.ts","../src/constants.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":["EventType","StatusType","DEFAULT_BASE_URL","constructor","baseUrl","isFileKeySwipe","this","eventSource","timeoutId","onVisibilityChange","test","navigator","userAgent","document","visibilityState","sessionID","start","setBaseUrl","setIsFileKeySwipe","stop","path","EventSource","addEventListener","MFASwipe","event","data","JSON","parse","status","Pending","setupTimeout","expiresAt","onSuccess","error","console","errorEvent","Event","onError","Disconnect","FileKeySwipe","clearTimeout","timeoutDuration","Date","now","setTimeout","listen","sessionId","onData","close"],"mappings":"+OAAA,IAAYA,EAMAC,EANAD,EAAAA,eAAAA,GAAAA,EAAAA,EAAAA,YAAAA,YAAS,CAAA,IACnB,SAAA,YACAA,EAAA,WAAA,aACAA,EAAA,aAAA,gBAGUC,EAAAA,gBAAAA,GAAAA,EAAAA,EAAAA,aAAAA,aAAU,CAAA,IACpB,QAAA,UACAA,EAAA,QAAA,UACAA,EAAA,QAAA,UCTK,MAAMC,EAAmB,sDC0C9B,WAAAC,CACEC,EAAkBF,EAClBG,GAA0B,GAdpBC,KAAAC,YAAkC,KAIlCD,KAAAE,UAAkD,KAiJzCF,KAAAG,mBAAqB,KACb,iCAAiCC,KAAKC,UAAUC,YACrE,kBAAkBF,KAAKC,UAAUC,YACgB,YAA7BC,SAASC,iBAAiCR,KAAKS,WACnET,KAAKU,SAzIPV,KAAKF,QAAUA,EACfE,KAAKD,eAAiBA,CACxB,CAMA,UAAAY,CAAWb,GACTE,KAAKF,QAAUA,CACjB,CAMA,iBAAAc,CAAkBb,GAChBC,KAAKD,eAAiBA,CACxB,CAMQ,KAAAW,GACN,IAAKV,KAAKS,UAAW,OAAO,KAE5BT,KAAKa,OAEL,MAAMC,EAAOd,KAAKD,eAAiB,aAAe,WAgDlD,OA9CAC,KAAKC,YAAc,I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bxB,UACTA,SAASS,iBAAiB,mBAAoBhB,KAAKG,oBAG9CH,KAAKU,OACd,CAKA,IAAAG,GACMb,KAAKC,cACPD,KAAKC,YAAYyC,QACjB1C,KAAKC,YAAc,MAEjBD,KAAKE,YACPgC,aAAalC,KAAKE,WAClBF,KAAKE,UAAY,KAErB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CyphlensErrorCallback, CyphlensEvent, DisconnectEvent, EventCallback, EventType, StatusType, TwoFactorEvent } from './types';
|
|
1
|
+
import { CyphlensErrorCallback, CyphlensEvent, DisconnectEvent, EventCallback, EventType, FileKeyEvent, StatusType, TwoFactorEvent } from './types';
|
|
2
2
|
import { DEFAULT_BASE_URL } from "./constants";
|
|
3
3
|
export { EventType, StatusType, DEFAULT_BASE_URL, };
|
|
4
|
-
export type { EventCallback, TwoFactorEvent, CyphlensErrorCallback, DisconnectEvent, CyphlensEvent, };
|
|
4
|
+
export type { EventCallback, TwoFactorEvent, CyphlensErrorCallback, DisconnectEvent, CyphlensEvent, FileKeyEvent };
|
|
5
5
|
export declare class Cyphlens {
|
|
6
6
|
private baseUrl;
|
|
7
7
|
private eventSource;
|
|
@@ -9,16 +9,23 @@ export declare class Cyphlens {
|
|
|
9
9
|
private onSuccess?;
|
|
10
10
|
private onError?;
|
|
11
11
|
private timeoutId;
|
|
12
|
+
private isFileKeySwipe;
|
|
12
13
|
/**
|
|
13
14
|
* Initializes the Cyphlens service with a base URL.
|
|
14
15
|
* @param baseUrl The base API URL for connecting to the Cyphlens service.
|
|
16
|
+
* @param isFileKeySwipe set true if listening to FileKey swipe events
|
|
15
17
|
*/
|
|
16
|
-
constructor(baseUrl?: string);
|
|
18
|
+
constructor(baseUrl?: string, isFileKeySwipe?: boolean);
|
|
17
19
|
/**
|
|
18
20
|
* Updates the base API URL.
|
|
19
21
|
* @param baseUrl The new base URL.
|
|
20
22
|
*/
|
|
21
23
|
setBaseUrl(baseUrl: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Updates the isFileKeySwipe flag.
|
|
26
|
+
* @param isFileKeySwipe set true if listening to FileKey swipe events.
|
|
27
|
+
*/
|
|
28
|
+
setIsFileKeySwipe(isFileKeySwipe: boolean): void;
|
|
22
29
|
/**
|
|
23
30
|
* Starts the Server-Sent Events (SSE) connection to listen for authentication events.
|
|
24
31
|
* @returns The EventSource instance if successful, otherwise null.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,UAAU,EACV,cAAc,EACf,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EACL,SAAS,EACT,UAAU,EACV,gBAAgB,GACjB,CAAA;AAED,YAAY,EACV,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,YAAY,EACZ,UAAU,EACV,cAAc,EACf,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EACL,SAAS,EACT,UAAU,EACV,gBAAgB,GACjB,CAAA;AAED,YAAY,EACV,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,YAAY,EACb,CAAA;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAC,CAAgB;IAClC,OAAO,CAAC,OAAO,CAAC,CAAwB;IACxC,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,cAAc,CAAU;IAEhC;;;;OAIG;gBAED,OAAO,GAAE,MAAyB,EAClC,cAAc,GAAE,OAAe;IAMjC;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;;OAGG;IACH,iBAAiB,CAAC,cAAc,EAAE,OAAO,GAAG,IAAI;IAIhD;;;OAGG;IACH,OAAO,CAAC,KAAK;IAwDb;;;OAGG;IACH,OAAO,CAAC,YAAY;IAUpB;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,WAAW,GAAG,IAAI;IAatG;;OAEG;IACH,IAAI,IAAI,IAAI;IAWZ;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAMjC;CACH;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,cAAc,EAAE,cAAc,CAAC;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,eAAe,EAAE,eAAe,CAAC;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,qBAAqB,EAAE,qBAAqB,CAAC;CAC9C,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare enum EventType {
|
|
2
2
|
MFASwipe = "MFA.SWIPE",
|
|
3
|
-
Disconnect = "DISCONNECT"
|
|
3
|
+
Disconnect = "DISCONNECT",
|
|
4
|
+
FileKeySwipe = "FILEKEY.SWIPE"
|
|
4
5
|
}
|
|
5
6
|
export declare enum StatusType {
|
|
6
7
|
Pending = "PENDING",
|
|
@@ -15,6 +16,10 @@ export interface TwoFactorEvent extends CyphlensEvent {
|
|
|
15
16
|
timestamp: number;
|
|
16
17
|
expiresAt: number;
|
|
17
18
|
}
|
|
19
|
+
export interface FileKeyEvent extends TwoFactorEvent {
|
|
20
|
+
kek: string;
|
|
21
|
+
authToken: string;
|
|
22
|
+
}
|
|
18
23
|
export interface DisconnectEvent extends CyphlensEvent {
|
|
19
24
|
message: string;
|
|
20
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,QAAQ,cAAc;IACtB,UAAU,eAAe;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,QAAQ,cAAc;IACtB,UAAU,eAAe;IACzB,YAAY,kBAAkB;CAC/B;AAED,oBAAY,UAAU;IACpB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,aAAa;CAAG;AAEjC,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAa,SAAQ,cAAc;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;AAChF,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC"}
|