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

@rudderstack/analytics-js-cookies

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rudderstack/analytics-js-cookies - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## [0.3.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-cookies@0.2.0...@rudderstack/analytics-js-cookies@0.3.0) (2024-07-01)
### Features
* expose exclusive cookies functions for server and browser environments ([#1774](https://github.com/rudderlabs/rudder-sdk-js/issues/1774)) ([428e5cd](https://github.com/rudderlabs/rudder-sdk-js/commit/428e5cd96c389ab0944fa9255d6d68c56c71908c))
## [0.2.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-cookies@0.1.0...@rudderstack/analytics-js-cookies@0.2.0) (2024-06-25)

@@ -7,0 +14,0 @@

9

dist/npm/index.d.ts

@@ -11,4 +11,7 @@ type Nullable<T> = T | null;

declare const getDecryptedValue: (value: string) => Nullable<string | ApiObject>;
declare const getDecryptedCookie: (cookieKey: string) => Nullable<string | ApiObject>;
declare const getEncryptedValueBrowser: (value: string | ApiObject, debug?: boolean) => Nullable<string>;
declare const getDecryptedValueBrowser: (value: string, debug?: boolean) => Nullable<string | ApiObject>;
declare const getDecryptedCookieBrowser: (cookieKey: string, debug?: boolean) => Nullable<string | ApiObject>;
declare const getDecryptedValue: (value: string, debug?: boolean) => Nullable<string | ApiObject>;
declare const getEncryptedValue: (value: string | ApiObject, debug?: boolean) => Nullable<string>;
//# sourceMappingURL=cookiesUtilities.d.ts.map

@@ -26,2 +29,2 @@

export { anonymousUserIdKey, authTokenKey, getDecryptedCookie, getDecryptedValue, groupIdKey, groupTraitsKey, pageInitialReferrerKey, pageInitialReferringDomainKey, sessionInfoKey, userIdKey, userTraitsKey };
export { anonymousUserIdKey, authTokenKey, getDecryptedCookieBrowser, getDecryptedValue, getDecryptedValueBrowser, getEncryptedValue, getEncryptedValueBrowser, groupIdKey, groupTraitsKey, pageInitialReferrerKey, pageInitialReferringDomainKey, sessionInfoKey, userIdKey, userTraitsKey };

@@ -28,2 +28,10 @@ 'use strict';

*/var base64ToBytes=function base64ToBytes(base64Str){var binString=globalThis.atob(base64Str);var bytes=binString.split('').map(function(char){return char.charCodeAt(0);});return new Uint8Array(bytes);};/**
* Converts a bytes array to base64 encoded string
* @param bytes bytes array to be converted to base64
* @returns base64 encoded string
*/var bytesToBase64=function bytesToBase64(bytes){var binString=Array.from(bytes,function(x){return String.fromCodePoint(x);}).join('');return globalThis.btoa(binString);};/**
* Encodes a string to base64 even with unicode characters
* @param value input string
* @returns base64 encoded string
*/var toBase64=function toBase64(value){return bytesToBase64(new TextEncoder().encode(value));};/**
* Decodes a base64 encoded string

@@ -34,4 +42,2 @@ * @param value base64 encoded string

var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
function _defineProperty(e, r, t) {

@@ -80,3 +86,28 @@ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {

}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
// eslint-disable-next-line func-names
return function(key,value){if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore-next-line
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){return '[Circular Reference]';}ancestors.push(value);return value;};};/**
* Utility method for JSON stringify object excluding null values & circular references
*
* @param {*} value input
* @param {boolean} excludeNull if it should exclude nul or not
* @param {function} logger optional logger methods for warning
* @returns string
*/var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){return null;}};
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
/**

@@ -101,8 +132,11 @@ * Encode.

var decrypt=function decrypt(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};var getDecryptedValue=function getDecryptedValue(value){var fallbackValue=null;try{var decryptedVal=decrypt(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){return fallbackValue;}};var getDecryptedCookie=function getDecryptedCookie(cookieKey){if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValue(cookie(cookieKey));}return null;};
var getEncryptedValueInternal=function getEncryptedValueInternal(value,encryptFn,debug){var fallbackValue=null;try{var strValue=stringifyWithoutCircular(value,false);if(isNull(strValue)){return null;}return encryptFn(strValue);}catch(err){if(debug){console.error('Error occurred during encryption: ',err);}return fallbackValue;}};var getDecryptedValueInternal=function getDecryptedValueInternal(value,decryptFn,debug){var fallbackValue=null;try{var decryptedVal=decryptFn(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){if(debug){console.error('Error occurred during decryption: ',err);}return fallbackValue;}};var encryptBrowser=function encryptBrowser(value){return "".concat(ENCRYPTION_PREFIX_V3).concat(toBase64(value));};var decryptBrowser=function decryptBrowser(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};var getEncryptedValueBrowser=function getEncryptedValueBrowser(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getEncryptedValueInternal(value,encryptBrowser,debug);};var getDecryptedValueBrowser=function getDecryptedValueBrowser(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getDecryptedValueInternal(value,decryptBrowser,debug);};var getDecryptedCookieBrowser=function getDecryptedCookieBrowser(cookieKey){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValueBrowser(cookie(cookieKey),debug);}return null;};var encrypt=function encrypt(value){return "".concat(ENCRYPTION_PREFIX_V3).concat(Buffer.from(value,'utf-8').toString('base64'));};var decrypt=function decrypt(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return Buffer.from(value.substring(ENCRYPTION_PREFIX_V3.length),'base64').toString('utf-8');}return value;};var getDecryptedValue=function getDecryptedValue(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getDecryptedValueInternal(value,decrypt,debug);};var getEncryptedValue=function getEncryptedValue(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getEncryptedValueInternal(value,encrypt,debug);};
exports.anonymousUserIdKey = anonymousUserIdKey;
exports.authTokenKey = authTokenKey;
exports.getDecryptedCookie = getDecryptedCookie;
exports.getDecryptedCookieBrowser = getDecryptedCookieBrowser;
exports.getDecryptedValue = getDecryptedValue;
exports.getDecryptedValueBrowser = getDecryptedValueBrowser;
exports.getEncryptedValue = getEncryptedValue;
exports.getEncryptedValueBrowser = getEncryptedValueBrowser;
exports.groupIdKey = groupIdKey;

@@ -109,0 +143,0 @@ exports.groupTraitsKey = groupTraitsKey;

@@ -26,2 +26,10 @@ /**

*/var base64ToBytes=function base64ToBytes(base64Str){var binString=globalThis.atob(base64Str);var bytes=binString.split('').map(function(char){return char.charCodeAt(0);});return new Uint8Array(bytes);};/**
* Converts a bytes array to base64 encoded string
* @param bytes bytes array to be converted to base64
* @returns base64 encoded string
*/var bytesToBase64=function bytesToBase64(bytes){var binString=Array.from(bytes,function(x){return String.fromCodePoint(x);}).join('');return globalThis.btoa(binString);};/**
* Encodes a string to base64 even with unicode characters
* @param value input string
* @returns base64 encoded string
*/var toBase64=function toBase64(value){return bytesToBase64(new TextEncoder().encode(value));};/**
* Decodes a base64 encoded string

@@ -32,4 +40,2 @@ * @param value base64 encoded string

var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
function _defineProperty(e, r, t) {

@@ -78,3 +84,28 @@ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {

}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
// eslint-disable-next-line func-names
return function(key,value){if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore-next-line
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){return '[Circular Reference]';}ancestors.push(value);return value;};};/**
* Utility method for JSON stringify object excluding null values & circular references
*
* @param {*} value input
* @param {boolean} excludeNull if it should exclude nul or not
* @param {function} logger optional logger methods for warning
* @returns string
*/var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){return null;}};
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
/**

@@ -99,4 +130,4 @@ * Encode.

var decrypt=function decrypt(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};var getDecryptedValue=function getDecryptedValue(value){var fallbackValue=null;try{var decryptedVal=decrypt(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){return fallbackValue;}};var getDecryptedCookie=function getDecryptedCookie(cookieKey){if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValue(cookie(cookieKey));}return null;};
var getEncryptedValueInternal=function getEncryptedValueInternal(value,encryptFn,debug){var fallbackValue=null;try{var strValue=stringifyWithoutCircular(value,false);if(isNull(strValue)){return null;}return encryptFn(strValue);}catch(err){if(debug){console.error('Error occurred during encryption: ',err);}return fallbackValue;}};var getDecryptedValueInternal=function getDecryptedValueInternal(value,decryptFn,debug){var fallbackValue=null;try{var decryptedVal=decryptFn(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){if(debug){console.error('Error occurred during decryption: ',err);}return fallbackValue;}};var encryptBrowser=function encryptBrowser(value){return "".concat(ENCRYPTION_PREFIX_V3).concat(toBase64(value));};var decryptBrowser=function decryptBrowser(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};var getEncryptedValueBrowser=function getEncryptedValueBrowser(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getEncryptedValueInternal(value,encryptBrowser,debug);};var getDecryptedValueBrowser=function getDecryptedValueBrowser(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getDecryptedValueInternal(value,decryptBrowser,debug);};var getDecryptedCookieBrowser=function getDecryptedCookieBrowser(cookieKey){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValueBrowser(cookie(cookieKey),debug);}return null;};var encrypt=function encrypt(value){return "".concat(ENCRYPTION_PREFIX_V3).concat(Buffer.from(value,'utf-8').toString('base64'));};var decrypt=function decrypt(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return Buffer.from(value.substring(ENCRYPTION_PREFIX_V3.length),'base64').toString('utf-8');}return value;};var getDecryptedValue=function getDecryptedValue(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getDecryptedValueInternal(value,decrypt,debug);};var getEncryptedValue=function getEncryptedValue(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getEncryptedValueInternal(value,encrypt,debug);};
export { anonymousUserIdKey, authTokenKey, getDecryptedCookie, getDecryptedValue, groupIdKey, groupTraitsKey, pageInitialReferrerKey, pageInitialReferringDomainKey, sessionInfoKey, userIdKey, userTraitsKey };
export { anonymousUserIdKey, authTokenKey, getDecryptedCookieBrowser, getDecryptedValue, getDecryptedValueBrowser, getEncryptedValue, getEncryptedValueBrowser, groupIdKey, groupTraitsKey, pageInitialReferrerKey, pageInitialReferringDomainKey, sessionInfoKey, userIdKey, userTraitsKey };

@@ -32,2 +32,10 @@ (function (global, factory) {

*/var base64ToBytes=function base64ToBytes(base64Str){var binString=globalThis.atob(base64Str);var bytes=binString.split('').map(function(char){return char.charCodeAt(0);});return new Uint8Array(bytes);};/**
* Converts a bytes array to base64 encoded string
* @param bytes bytes array to be converted to base64
* @returns base64 encoded string
*/var bytesToBase64=function bytesToBase64(bytes){var binString=Array.from(bytes,function(x){return String.fromCodePoint(x);}).join('');return globalThis.btoa(binString);};/**
* Encodes a string to base64 even with unicode characters
* @param value input string
* @returns base64 encoded string
*/var toBase64=function toBase64(value){return bytesToBase64(new TextEncoder().encode(value));};/**
* Decodes a base64 encoded string

@@ -38,4 +46,2 @@ * @param value base64 encoded string

var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
function _defineProperty(e, r, t) {

@@ -84,3 +90,28 @@ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {

}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
// eslint-disable-next-line func-names
return function(key,value){if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore-next-line
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){return '[Circular Reference]';}ancestors.push(value);return value;};};/**
* Utility method for JSON stringify object excluding null values & circular references
*
* @param {*} value input
* @param {boolean} excludeNull if it should exclude nul or not
* @param {function} logger optional logger methods for warning
* @returns string
*/var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){return null;}};
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
/**

@@ -105,8 +136,11 @@ * Encode.

var decrypt=function decrypt(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};var getDecryptedValue=function getDecryptedValue(value){var fallbackValue=null;try{var decryptedVal=decrypt(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){return fallbackValue;}};var getDecryptedCookie=function getDecryptedCookie(cookieKey){if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValue(cookie(cookieKey));}return null;};
var getEncryptedValueInternal=function getEncryptedValueInternal(value,encryptFn,debug){var fallbackValue=null;try{var strValue=stringifyWithoutCircular(value,false);if(isNull(strValue)){return null;}return encryptFn(strValue);}catch(err){if(debug){console.error('Error occurred during encryption: ',err);}return fallbackValue;}};var getDecryptedValueInternal=function getDecryptedValueInternal(value,decryptFn,debug){var fallbackValue=null;try{var decryptedVal=decryptFn(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){if(debug){console.error('Error occurred during decryption: ',err);}return fallbackValue;}};var encryptBrowser=function encryptBrowser(value){return "".concat(ENCRYPTION_PREFIX_V3).concat(toBase64(value));};var decryptBrowser=function decryptBrowser(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};var getEncryptedValueBrowser=function getEncryptedValueBrowser(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getEncryptedValueInternal(value,encryptBrowser,debug);};var getDecryptedValueBrowser=function getDecryptedValueBrowser(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getDecryptedValueInternal(value,decryptBrowser,debug);};var getDecryptedCookieBrowser=function getDecryptedCookieBrowser(cookieKey){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValueBrowser(cookie(cookieKey),debug);}return null;};var encrypt=function encrypt(value){return "".concat(ENCRYPTION_PREFIX_V3).concat(Buffer.from(value,'utf-8').toString('base64'));};var decrypt=function decrypt(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return Buffer.from(value.substring(ENCRYPTION_PREFIX_V3.length),'base64').toString('utf-8');}return value;};var getDecryptedValue=function getDecryptedValue(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getDecryptedValueInternal(value,decrypt,debug);};var getEncryptedValue=function getEncryptedValue(value){var debug=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return getEncryptedValueInternal(value,encrypt,debug);};
exports.anonymousUserIdKey = anonymousUserIdKey;
exports.authTokenKey = authTokenKey;
exports.getDecryptedCookie = getDecryptedCookie;
exports.getDecryptedCookieBrowser = getDecryptedCookieBrowser;
exports.getDecryptedValue = getDecryptedValue;
exports.getDecryptedValueBrowser = getDecryptedValueBrowser;
exports.getEncryptedValue = getEncryptedValue;
exports.getEncryptedValueBrowser = getEncryptedValueBrowser;
exports.groupIdKey = groupIdKey;

@@ -113,0 +147,0 @@ exports.groupTraitsKey = groupTraitsKey;

@@ -30,2 +30,10 @@ 'use strict';

*/const base64ToBytes=base64Str=>{const binString=globalThis.atob(base64Str);const bytes=binString.split('').map(char=>char.charCodeAt(0));return new Uint8Array(bytes);};/**
* Converts a bytes array to base64 encoded string
* @param bytes bytes array to be converted to base64
* @returns base64 encoded string
*/const bytesToBase64=bytes=>{const binString=Array.from(bytes,x=>String.fromCodePoint(x)).join('');return globalThis.btoa(binString);};/**
* Encodes a string to base64 even with unicode characters
* @param value input string
* @returns base64 encoded string
*/const toBase64=value=>bytesToBase64(new TextEncoder().encode(value));/**
* Decodes a base64 encoded string

@@ -36,2 +44,16 @@ * @param value base64 encoded string

const getCircularReplacer=(excludeNull,excludeKeys,logger)=>{const ancestors=[];// Here we do not want to use arrow function to use "this" in function context
// eslint-disable-next-line func-names
return function(key,value){if(typeof value!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore-next-line
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){return '[Circular Reference]';}ancestors.push(value);return value;};};/**
* Utility method for JSON stringify object excluding null values & circular references
*
* @param {*} value input
* @param {boolean} excludeNull if it should exclude nul or not
* @param {function} logger optional logger methods for warning
* @returns string
*/const stringifyWithoutCircular=(value,excludeNull,excludeKeys,logger)=>{try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){return null;}};
const userIdKey='rl_user_id';const userTraitsKey='rl_trait';const anonymousUserIdKey='rl_anonymous_id';const groupIdKey='rl_group_id';const groupTraitsKey='rl_group_trait';const pageInitialReferrerKey='rl_page_init_referrer';const pageInitialReferringDomainKey='rl_page_init_referring_domain';const sessionInfoKey='rl_session';const authTokenKey='rl_auth_token';const COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};const ENCRYPTION_PREFIX_V3='RS_ENC_v3_';

@@ -102,8 +124,11 @@

const decrypt=value=>{if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};const getDecryptedValue=value=>{const fallbackValue=null;try{const decryptedVal=decrypt(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){return fallbackValue;}};const getDecryptedCookie=cookieKey=>{if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValue(cookie(cookieKey));}return null;};
const getEncryptedValueInternal=(value,encryptFn,debug)=>{const fallbackValue=null;try{const strValue=stringifyWithoutCircular(value,false);if(isNull(strValue)){return null;}return encryptFn(strValue);}catch(err){if(debug){console.error('Error occurred during encryption: ',err);}return fallbackValue;}};const getDecryptedValueInternal=(value,decryptFn,debug)=>{const fallbackValue=null;try{const decryptedVal=decryptFn(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){if(debug){console.error('Error occurred during decryption: ',err);}return fallbackValue;}};const encryptBrowser=value=>`${ENCRYPTION_PREFIX_V3}${toBase64(value)}`;const decryptBrowser=value=>{if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};const getEncryptedValueBrowser=(value,debug=false)=>getEncryptedValueInternal(value,encryptBrowser,debug);const getDecryptedValueBrowser=(value,debug=false)=>getDecryptedValueInternal(value,decryptBrowser,debug);const getDecryptedCookieBrowser=(cookieKey,debug=false)=>{if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValueBrowser(cookie(cookieKey),debug);}return null;};const encrypt=value=>`${ENCRYPTION_PREFIX_V3}${Buffer.from(value,'utf-8').toString('base64')}`;const decrypt=value=>{if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return Buffer.from(value.substring(ENCRYPTION_PREFIX_V3.length),'base64').toString('utf-8');}return value;};const getDecryptedValue=(value,debug=false)=>getDecryptedValueInternal(value,decrypt,debug);const getEncryptedValue=(value,debug=false)=>getEncryptedValueInternal(value,encrypt,debug);
exports.anonymousUserIdKey = anonymousUserIdKey;
exports.authTokenKey = authTokenKey;
exports.getDecryptedCookie = getDecryptedCookie;
exports.getDecryptedCookieBrowser = getDecryptedCookieBrowser;
exports.getDecryptedValue = getDecryptedValue;
exports.getDecryptedValueBrowser = getDecryptedValueBrowser;
exports.getEncryptedValue = getEncryptedValue;
exports.getEncryptedValueBrowser = getEncryptedValueBrowser;
exports.groupIdKey = groupIdKey;

@@ -110,0 +135,0 @@ exports.groupTraitsKey = groupTraitsKey;

@@ -26,2 +26,10 @@ /**

*/const base64ToBytes=base64Str=>{const binString=globalThis.atob(base64Str);const bytes=binString.split('').map(char=>char.charCodeAt(0));return new Uint8Array(bytes);};/**
* Converts a bytes array to base64 encoded string
* @param bytes bytes array to be converted to base64
* @returns base64 encoded string
*/const bytesToBase64=bytes=>{const binString=Array.from(bytes,x=>String.fromCodePoint(x)).join('');return globalThis.btoa(binString);};/**
* Encodes a string to base64 even with unicode characters
* @param value input string
* @returns base64 encoded string
*/const toBase64=value=>bytesToBase64(new TextEncoder().encode(value));/**
* Decodes a base64 encoded string

@@ -32,2 +40,16 @@ * @param value base64 encoded string

const getCircularReplacer=(excludeNull,excludeKeys,logger)=>{const ancestors=[];// Here we do not want to use arrow function to use "this" in function context
// eslint-disable-next-line func-names
return function(key,value){if(typeof value!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore-next-line
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){return '[Circular Reference]';}ancestors.push(value);return value;};};/**
* Utility method for JSON stringify object excluding null values & circular references
*
* @param {*} value input
* @param {boolean} excludeNull if it should exclude nul or not
* @param {function} logger optional logger methods for warning
* @returns string
*/const stringifyWithoutCircular=(value,excludeNull,excludeKeys,logger)=>{try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){return null;}};
const userIdKey='rl_user_id';const userTraitsKey='rl_trait';const anonymousUserIdKey='rl_anonymous_id';const groupIdKey='rl_group_id';const groupTraitsKey='rl_group_trait';const pageInitialReferrerKey='rl_page_init_referrer';const pageInitialReferringDomainKey='rl_page_init_referring_domain';const sessionInfoKey='rl_session';const authTokenKey='rl_auth_token';const COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};const ENCRYPTION_PREFIX_V3='RS_ENC_v3_';

@@ -98,4 +120,4 @@

const decrypt=value=>{if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};const getDecryptedValue=value=>{const fallbackValue=null;try{const decryptedVal=decrypt(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){return fallbackValue;}};const getDecryptedCookie=cookieKey=>{if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValue(cookie(cookieKey));}return null;};
const getEncryptedValueInternal=(value,encryptFn,debug)=>{const fallbackValue=null;try{const strValue=stringifyWithoutCircular(value,false);if(isNull(strValue)){return null;}return encryptFn(strValue);}catch(err){if(debug){console.error('Error occurred during encryption: ',err);}return fallbackValue;}};const getDecryptedValueInternal=(value,decryptFn,debug)=>{const fallbackValue=null;try{const decryptedVal=decryptFn(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){if(debug){console.error('Error occurred during decryption: ',err);}return fallbackValue;}};const encryptBrowser=value=>`${ENCRYPTION_PREFIX_V3}${toBase64(value)}`;const decryptBrowser=value=>{if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};const getEncryptedValueBrowser=(value,debug=false)=>getEncryptedValueInternal(value,encryptBrowser,debug);const getDecryptedValueBrowser=(value,debug=false)=>getDecryptedValueInternal(value,decryptBrowser,debug);const getDecryptedCookieBrowser=(cookieKey,debug=false)=>{if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValueBrowser(cookie(cookieKey),debug);}return null;};const encrypt=value=>`${ENCRYPTION_PREFIX_V3}${Buffer.from(value,'utf-8').toString('base64')}`;const decrypt=value=>{if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return Buffer.from(value.substring(ENCRYPTION_PREFIX_V3.length),'base64').toString('utf-8');}return value;};const getDecryptedValue=(value,debug=false)=>getDecryptedValueInternal(value,decrypt,debug);const getEncryptedValue=(value,debug=false)=>getEncryptedValueInternal(value,encrypt,debug);
export { anonymousUserIdKey, authTokenKey, getDecryptedCookie, getDecryptedValue, groupIdKey, groupTraitsKey, pageInitialReferrerKey, pageInitialReferringDomainKey, sessionInfoKey, userIdKey, userTraitsKey };
export { anonymousUserIdKey, authTokenKey, getDecryptedCookieBrowser, getDecryptedValue, getDecryptedValueBrowser, getEncryptedValue, getEncryptedValueBrowser, groupIdKey, groupTraitsKey, pageInitialReferrerKey, pageInitialReferringDomainKey, sessionInfoKey, userIdKey, userTraitsKey };

@@ -32,2 +32,10 @@ (function (global, factory) {

*/const base64ToBytes=base64Str=>{const binString=globalThis.atob(base64Str);const bytes=binString.split('').map(char=>char.charCodeAt(0));return new Uint8Array(bytes);};/**
* Converts a bytes array to base64 encoded string
* @param bytes bytes array to be converted to base64
* @returns base64 encoded string
*/const bytesToBase64=bytes=>{const binString=Array.from(bytes,x=>String.fromCodePoint(x)).join('');return globalThis.btoa(binString);};/**
* Encodes a string to base64 even with unicode characters
* @param value input string
* @returns base64 encoded string
*/const toBase64=value=>bytesToBase64(new TextEncoder().encode(value));/**
* Decodes a base64 encoded string

@@ -38,2 +46,16 @@ * @param value base64 encoded string

const getCircularReplacer=(excludeNull,excludeKeys,logger)=>{const ancestors=[];// Here we do not want to use arrow function to use "this" in function context
// eslint-disable-next-line func-names
return function(key,value){if(typeof value!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore-next-line
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){return '[Circular Reference]';}ancestors.push(value);return value;};};/**
* Utility method for JSON stringify object excluding null values & circular references
*
* @param {*} value input
* @param {boolean} excludeNull if it should exclude nul or not
* @param {function} logger optional logger methods for warning
* @returns string
*/const stringifyWithoutCircular=(value,excludeNull,excludeKeys,logger)=>{try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){return null;}};
const userIdKey='rl_user_id';const userTraitsKey='rl_trait';const anonymousUserIdKey='rl_anonymous_id';const groupIdKey='rl_group_id';const groupTraitsKey='rl_group_trait';const pageInitialReferrerKey='rl_page_init_referrer';const pageInitialReferringDomainKey='rl_page_init_referring_domain';const sessionInfoKey='rl_session';const authTokenKey='rl_auth_token';const COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};const ENCRYPTION_PREFIX_V3='RS_ENC_v3_';

@@ -104,8 +126,11 @@

const decrypt=value=>{if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};const getDecryptedValue=value=>{const fallbackValue=null;try{const decryptedVal=decrypt(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){return fallbackValue;}};const getDecryptedCookie=cookieKey=>{if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValue(cookie(cookieKey));}return null;};
const getEncryptedValueInternal=(value,encryptFn,debug)=>{const fallbackValue=null;try{const strValue=stringifyWithoutCircular(value,false);if(isNull(strValue)){return null;}return encryptFn(strValue);}catch(err){if(debug){console.error('Error occurred during encryption: ',err);}return fallbackValue;}};const getDecryptedValueInternal=(value,decryptFn,debug)=>{const fallbackValue=null;try{const decryptedVal=decryptFn(value);if(isNullOrUndefined(decryptedVal)){return fallbackValue;}return JSON.parse(decryptedVal);}catch(err){if(debug){console.error('Error occurred during decryption: ',err);}return fallbackValue;}};const encryptBrowser=value=>`${ENCRYPTION_PREFIX_V3}${toBase64(value)}`;const decryptBrowser=value=>{if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};const getEncryptedValueBrowser=(value,debug=false)=>getEncryptedValueInternal(value,encryptBrowser,debug);const getDecryptedValueBrowser=(value,debug=false)=>getDecryptedValueInternal(value,decryptBrowser,debug);const getDecryptedCookieBrowser=(cookieKey,debug=false)=>{if(Object.values(COOKIE_KEYS).includes(cookieKey)){return getDecryptedValueBrowser(cookie(cookieKey),debug);}return null;};const encrypt=value=>`${ENCRYPTION_PREFIX_V3}${Buffer.from(value,'utf-8').toString('base64')}`;const decrypt=value=>{if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return Buffer.from(value.substring(ENCRYPTION_PREFIX_V3.length),'base64').toString('utf-8');}return value;};const getDecryptedValue=(value,debug=false)=>getDecryptedValueInternal(value,decrypt,debug);const getEncryptedValue=(value,debug=false)=>getEncryptedValueInternal(value,encrypt,debug);
exports.anonymousUserIdKey = anonymousUserIdKey;
exports.authTokenKey = authTokenKey;
exports.getDecryptedCookie = getDecryptedCookie;
exports.getDecryptedCookieBrowser = getDecryptedCookieBrowser;
exports.getDecryptedValue = getDecryptedValue;
exports.getDecryptedValueBrowser = getDecryptedValueBrowser;
exports.getEncryptedValue = getEncryptedValue;
exports.getEncryptedValueBrowser = getEncryptedValueBrowser;
exports.groupIdKey = groupIdKey;

@@ -112,0 +137,0 @@ exports.groupTraitsKey = groupTraitsKey;

{
"name": "@rudderstack/analytics-js-cookies",
"version": "0.2.0",
"version": "0.3.0",
"description": "RudderStack JavaScript SDK Cookies Utilities",

@@ -5,0 +5,0 @@ "main": "dist/npm/modern/cjs/index.js",

@@ -24,8 +24,10 @@ ## [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](https://www.typescriptlang.org/)

RudderStack JavaScript SDK utility for cookies.
[RudderStack JavaScript SDK](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/) utilities for cookies in browser and Node.js environments. Use the appropriate functions for your environment.
## APIs
### `getDecryptedValue`
### `getDecryptedValueBrowser`
> :warning: Only for browser environments
This function decrypts the provided encrypted RudderStack JavaScript cookie value using the RudderStack JavaScript SDK encryption version "v3".

@@ -35,5 +37,25 @@

> If the provided value is not properly encrypted, the function will throw an exception.
> :warning: Any errors during decryption are swallowed by the function, returning `null`.
```javascript
import { getDecryptedValueBrowser } from '@rudderstack/analytics-js-cookies';
const encryptedCookieValue = 'RS_ENC_v3_InRlc3QtZGF0YSI=';
const decryptedCookieValue = getDecryptedValueBrowser(encryptedCookieValue);
console.log('Decrypted Cookie Value: ', decryptedCookieValue);
// Output:
// Decrypted Cookie Value: test-data
```
### `getDecryptedValue`
> :warning: Only for Node.js environments
This function decrypts the provided encrypted RudderStack JavaScript cookie value using the RudderStack JavaScript SDK encryption version "v3".
> If the provided value is either not encrypted or not properly encrypted, the function returns `null`.
> :warning: Any errors during decryption are swallowed by the function, returning `null`.
```javascript
import { decrypt } from '@rudderstack/analytics-js-cookies';

@@ -44,7 +66,10 @@

console.log('Decrypted Cookie Value: ', decryptedCookieValue);
// Output: Decrypted Cookie Value: test-data
// Output:
// Decrypted Cookie Value: test-data
```
### `getDecryptedCookie`
### `getDecryptedCookieBrowser`
> :warning: Only for browser environments
This function decrypts and returns the RudderStack JavaScript SDK cookie values.

@@ -62,5 +87,5 @@

> Any errors during decryption are swallowed by the function, returning `null`.
> :warning: Any errors during decryption are swallowed by the function, returning `null`.
The following are the available cookie key exports:
The following cookie keys are exported which can be used with this function:

@@ -79,3 +104,3 @@ - `userIdKey`: The key for the user ID cookie.

import {
getDecryptedCookie,
getDecryptedCookieBrowser,
anonymousUserIdKey,

@@ -85,15 +110,36 @@ userTraitsKey,

const anonymousId = getDecryptedCookie(anonymousUserIdKey);
const anonymousId = getDecryptedCookieBrowser(anonymousUserIdKey);
console.log('Anonymous User ID: ', anonymousId);
// Output: Anonymous User ID: 2c5b6d48-ea90-43a2-a2f6-457d27f90328
// Output:
// Anonymous User ID: 2c5b6d48-ea90-43a2-a2f6-457d27f90328
const userTraits = getDecryptedCookie(userTraitsKey);
const userTraits = getDecryptedCookieBrowser(userTraitsKey);
console.log('User Traits: ', userTraits);
// Output: User Traits: {"email":"abc@xyz.com","name":"John Doe"}
// Output:
// User Traits: {"email":"abc@xyz.com","name":"John Doe"}
const invalidCookie = getDecryptedCookie('invalid-cookie-name');
const invalidCookie = getDecryptedCookieBrowser('invalid-cookie-name');
console.log('Invalid Cookie: ', invalidCookie);
// Output: Invalid Cookie: null
// Output:
// Invalid Cookie: null
```
## Debugging
As all the above APIs swallow the errors, you can set the `debug` argument to `true` to log the errors.
```javascript
import { getDecryptedValue } from '@rudderstack/analytics-js-cookies';
const encryptedCookieValue = 'RS_ENC_v3_InRlc3QtZGF0YSI-some-random-data';
// Set the debug flag to true
const decryptedCookieValue = getDecryptedValue(encryptedCookieValue, true);
console.log('Decrypted Cookie Value: ', decryptedCookieValue);
// Output:
// Error occurred during decryption: Unexpected non-whitespace character after JSON at position 11
// Decrypted Cookie Value: null
```
> For detailed documentation on the RudderStack JavaScript SDK, click [**here**](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/).
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