Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vonage/auth-client-sdk

Package Overview
Dependencies
Maintainers
51
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/auth-client-sdk - npm Package Compare versions

Comparing version 1.2.12 to 1.3.0

2

dst/consts.d.ts

@@ -1,4 +0,4 @@

export declare const SDK_VERSION = "1.2.12";
export declare const SDK_VERSION = "1.3.0";
export type Environment = 'LOCAL' | 'DEV' | 'QA' | 'PROD';
export declare const Remotes: Record<Environment, string>;
export declare const EnvironmentKeys: string[];

@@ -1,2 +0,2 @@

export const SDK_VERSION = '1.2.12'; // this MUST NOT be changed in any PR
export const SDK_VERSION = '1.3.0'; // this MUST NOT be changed in any PR
export const Remotes = {

@@ -3,0 +3,0 @@ LOCAL: 'sdk.auth.vocal-dev.com',

@@ -1,2 +0,2 @@

import { VaultMessage, Vault } from './vault-types.js';
import { VaultMessage, Vault, VaultConfig } from './vault-types.js';
import { Environment } from '../consts.js';

@@ -6,3 +6,3 @@ export declare class VBCAuthVault implements Vault {

private constructor();
static getInstance(env: Environment): VBCAuthVault;
static getInstance(env: Environment, config?: VaultConfig): VBCAuthVault;
store(key: string, value: string): Promise<VaultMessage>;

@@ -9,0 +9,0 @@ retrieve(key: string): Promise<VaultMessage>;

@@ -16,4 +16,5 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {

import { EnvironmentKeys, Remotes, SDK_VERSION } from '../consts.js';
const DEFAULT_VAULT_FRAME_SETUP_TIMEOUT_MS = 8000;
export class VBCAuthVault {
constructor(env) {
constructor(env, vaultFrameTimeoutMS) {
_VBCAuthVault_instances.add(this);

@@ -30,3 +31,3 @@ _VBCAuthVault_env.set(this, void 0);

__classPrivateFieldSet(this, _VBCAuthVault_interopFrame, setupVault(env), "f");
__classPrivateFieldSet(this, _VBCAuthVault_interopFrameReady, setupIFrameReadyPromise(__classPrivateFieldGet(this, _VBCAuthVault_interopFrame, "f")), "f");
__classPrivateFieldSet(this, _VBCAuthVault_interopFrameReady, setupIFrameReadyPromise(__classPrivateFieldGet(this, _VBCAuthVault_interopFrame, "f"), vaultFrameTimeoutMS), "f");
__classPrivateFieldSet(this, _VBCAuthVault_callbacksRegistry, {}, "f");

@@ -36,10 +37,17 @@ globalThis.addEventListener('message', __classPrivateFieldGet(this, _VBCAuthVault_instances, "m", _VBCAuthVault_vaultMessageHandler).bind(this));

}
static getInstance(env) {
if (!__classPrivateFieldGet(VBCAuthVault, _a, "f", _VBCAuthVault_instance)) {
__classPrivateFieldSet(VBCAuthVault, _a, new VBCAuthVault(env), "f", _VBCAuthVault_instance);
static getInstance(env, config = {}) {
if (!__classPrivateFieldGet(_a, _a, "f", _VBCAuthVault_instance) || config.forceFreshInstance) {
const vaultFrameSetupTimeoutMS = config.vaultFrameTimeoutMS || DEFAULT_VAULT_FRAME_SETUP_TIMEOUT_MS;
const instance = new _a(env, vaultFrameSetupTimeoutMS);
if (!__classPrivateFieldGet(_a, _a, "f", _VBCAuthVault_instance)) {
__classPrivateFieldSet(_a, _a, instance, "f", _VBCAuthVault_instance);
}
return instance;
}
if (__classPrivateFieldGet(__classPrivateFieldGet(VBCAuthVault, _a, "f", _VBCAuthVault_instance), _VBCAuthVault_env, "f") !== env) {
throw new Error(`VBCAuthVault already initialized for env '${__classPrivateFieldGet(__classPrivateFieldGet(VBCAuthVault, _a, "f", _VBCAuthVault_instance), _VBCAuthVault_env, "f")}', refusing to init another one for env '${env}'`);
else if (__classPrivateFieldGet(__classPrivateFieldGet(_a, _a, "f", _VBCAuthVault_instance), _VBCAuthVault_env, "f") !== env) {
throw new Error(`VBCAuthVault already initialized for env '${__classPrivateFieldGet(__classPrivateFieldGet(_a, _a, "f", _VBCAuthVault_instance), _VBCAuthVault_env, "f")}', refusing to init another one for env '${env}'`);
}
return __classPrivateFieldGet(VBCAuthVault, _a, "f", _VBCAuthVault_instance);
else {
return __classPrivateFieldGet(_a, _a, "f", _VBCAuthVault_instance);
}
}

@@ -154,6 +162,11 @@ async store(key, value) {

}
function setupIFrameReadyPromise(fe) {
return new Promise(resolve => {
fe.addEventListener('load', () => resolve(), { once: true });
});
function setupIFrameReadyPromise(fe, timeoutMS) {
return Promise.race([
new Promise(resolve => {
fe.addEventListener('load', () => resolve(void 0), { once: true });
}),
new Promise((_, reject) => {
setTimeout(() => reject(`vault frame setup timed out after ${timeoutMS}ms`), timeoutMS);
})
]);
}

@@ -6,2 +6,6 @@ export interface Vault {

}
export interface VaultConfig {
vaultFrameTimeoutMS?: number;
forceFreshInstance?: boolean;
}
export declare enum VaultMessageType {

@@ -8,0 +12,0 @@ REQUEST_STORE = 0,

{
"name": "@vonage/auth-client-sdk",
"version": "1.2.12",
"version": "1.3.0",
"type": "module",

@@ -16,12 +16,12 @@ "files": [

"devDependencies": {
"@tsconfig/node18": "^2.0.0",
"@types/jest": "^29.5.1",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.5.0",
"prettier": "^2.8.8",
"ts-jest": "^29.1.0",
"@tsconfig/node20": "^20.1.2",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typescript": "^5.0.4"

@@ -28,0 +28,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc