Skip to content

Commit

Permalink
Remove endpoint check (#14)
Browse files Browse the repository at this point in the history
* Remove endpoint check

* Bump version
  • Loading branch information
hwhmeikle committed Jul 27, 2022
1 parent d20b1da commit 3677424
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@authsignal/browser",
"type": "module",
"version": "0.0.10",
"version": "0.0.11",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
Expand Down
11 changes: 3 additions & 8 deletions src/authsignal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@ import {setCookie, getCookieDomain, getCookie} from "./helpers";
import {AuthsignalOptions, AuthsignalWindowMessage, MfaInput, ChallengeInput, LaunchOptions} from "./types";
import {PopupHandler} from "./popup-handler";

const DEFAULT_ENDPOINT = "https://mfa.authsignal.com";
const DEFAULT_COOKIE_NAME = "__as_aid";

export class Authsignal {
anonymousId = "";
cookieDomain = "";
anonymousIdCookieName = "";
publishableKey = "";
endpoint = "";

constructor({publishableKey, cookieDomain, cookieName, endpoint}: AuthsignalOptions) {
constructor({publishableKey, cookieDomain, cookieName}: AuthsignalOptions) {
this.publishableKey = publishableKey;
this.cookieDomain = cookieDomain || getCookieDomain();
this.anonymousIdCookieName = cookieName || DEFAULT_COOKIE_NAME;
this.endpoint = endpoint || DEFAULT_ENDPOINT;

const idCookie = getCookie(this.anonymousIdCookieName);

Expand Down Expand Up @@ -73,10 +70,8 @@ export class Authsignal {

return new Promise<boolean>((resolve) => {
const onMessage = (event: MessageEvent) => {
if (event.origin === this.endpoint) {
if (event.data === AuthsignalWindowMessage.AUTHSIGNAL_CLOSE_POPUP) {
Popup.close();
}
if (event.data === AuthsignalWindowMessage.AUTHSIGNAL_CLOSE_POPUP) {
Popup.close();
}
};

Expand Down
5 changes: 0 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ export type AuthsignalOptions = {
* Name of id cookie. __eventn_id by default
*/
cookieName?: string;

/**
* A URL pointing to the Authsignal MFA page.
*/
endpoint?: string;
};

export enum AuthsignalWindowMessage {
Expand Down

0 comments on commit 3677424

Please sign in to comment.