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

@toruslabs/session-manager

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toruslabs/session-manager - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

dist/lib.cjs/util.js

3

dist/lib.cjs/base.js

@@ -5,2 +5,3 @@ 'use strict';

var httpHelpers = require('@toruslabs/http-helpers');
var util = require('./util.js');

@@ -13,3 +14,3 @@ class BaseSessionManager {

if (!this.sessionId) throw new Error("Session id is required");
this.sessionId = this.sessionId.padStart(64, "0");
this.sessionId = util.padHexString(this.sessionId);
}

@@ -16,0 +17,0 @@

'use strict';
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var constants = require('@toruslabs/constants');
var eccrypto = require('@toruslabs/eccrypto');
var metadataHelpers = require('@toruslabs/metadata-helpers');
var base = require('./base.js');
var util = require('./util.js');

@@ -18,3 +20,3 @@ const DEFAULT_SESSION_TIMEOUT = 86400;

super();
_defineProperty(this, "sessionServerBaseUrl", "https://session.web3auth.io");
_defineProperty(this, "sessionServerBaseUrl", constants.SESSION_SERVER_API_URL);
_defineProperty(this, "sessionNamespace", void 0);

@@ -29,7 +31,11 @@ _defineProperty(this, "allowedOrigin", void 0);

if (sessionTime) this.sessionTime = sessionTime;
if (sessionId) this.sessionId = sessionId.padStart(64, "0");
if (allowedOrigin) this.allowedOrigin = allowedOrigin || "*";
if (sessionId) this.sessionId = util.padHexString(sessionId);
if (allowedOrigin) {
this.allowedOrigin = allowedOrigin;
} else {
this.allowedOrigin = "*";
}
}
static generateRandomSessionKey() {
return eccrypto.generatePrivate().toString("hex").padStart(64, "0");
return util.padHexString(eccrypto.generatePrivate().toString("hex"));
}

@@ -36,0 +42,0 @@ async createSession(data, headers = {}) {

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { patch, put, post, get } from '@toruslabs/http-helpers';
import { padHexString } from './util.js';

@@ -10,3 +11,3 @@ class BaseSessionManager {

if (!this.sessionId) throw new Error("Session id is required");
this.sessionId = this.sessionId.padStart(64, "0");
this.sessionId = padHexString(this.sessionId);
}

@@ -13,0 +14,0 @@

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { SESSION_SERVER_API_URL } from '@toruslabs/constants';
import { generatePrivate, getPublic, sign } from '@toruslabs/eccrypto';
import { encryptData, keccak256, decryptData } from '@toruslabs/metadata-helpers';
import { BaseSessionManager } from './base.js';
import { padHexString } from './util.js';

@@ -16,3 +18,3 @@ const DEFAULT_SESSION_TIMEOUT = 86400;

super();
_defineProperty(this, "sessionServerBaseUrl", "https://session.web3auth.io");
_defineProperty(this, "sessionServerBaseUrl", SESSION_SERVER_API_URL);
_defineProperty(this, "sessionNamespace", void 0);

@@ -27,7 +29,11 @@ _defineProperty(this, "allowedOrigin", void 0);

if (sessionTime) this.sessionTime = sessionTime;
if (sessionId) this.sessionId = sessionId.padStart(64, "0");
if (allowedOrigin) this.allowedOrigin = allowedOrigin || "*";
if (sessionId) this.sessionId = padHexString(sessionId);
if (allowedOrigin) {
this.allowedOrigin = allowedOrigin;
} else {
this.allowedOrigin = "*";
}
}
static generateRandomSessionKey() {
return generatePrivate().toString("hex").padStart(64, "0");
return padHexString(generatePrivate().toString("hex"));
}

@@ -34,0 +40,0 @@ async createSession(data, headers = {}) {

@@ -17,7 +17,10 @@ /******/ (() => { // webpackBootstrap

var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
;// CONCATENATED MODULE: external "@toruslabs/http-helpers"
;// external "@toruslabs/http-helpers"
const http_helpers_namespaceObject = require("@toruslabs/http-helpers");
;// CONCATENATED MODULE: ./src/base.ts
// EXTERNAL MODULE: ./src/util.ts
var util = __webpack_require__(546);
;// ./src/base.ts
class BaseSessionManager {

@@ -29,3 +32,3 @@ constructor() {

if (!this.sessionId) throw new Error("Session id is required");
this.sessionId = this.sessionId.padStart(64, "0");
this.sessionId = (0,util/* padHexString */.i)(this.sessionId);
}

@@ -70,3 +73,3 @@

/***/ 655:
/***/ 979:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

@@ -84,9 +87,13 @@

var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
;// CONCATENATED MODULE: external "@toruslabs/eccrypto"
;// external "@toruslabs/constants"
const constants_namespaceObject = require("@toruslabs/constants");
;// external "@toruslabs/eccrypto"
const eccrypto_namespaceObject = require("@toruslabs/eccrypto");
;// CONCATENATED MODULE: external "@toruslabs/metadata-helpers"
;// external "@toruslabs/metadata-helpers"
const metadata_helpers_namespaceObject = require("@toruslabs/metadata-helpers");
// EXTERNAL MODULE: ./src/base.ts + 1 modules
var base = __webpack_require__(926);
;// CONCATENATED MODULE: ./src/sessionManager.ts
// EXTERNAL MODULE: ./src/util.ts
var util = __webpack_require__(546);
;// ./src/sessionManager.ts

@@ -96,2 +103,4 @@

const DEFAULT_SESSION_TIMEOUT = 86400;

@@ -107,3 +116,3 @@ class SessionManager extends base/* BaseSessionManager */.X {

super();
defineProperty_default()(this, "sessionServerBaseUrl", "https://session.web3auth.io");
defineProperty_default()(this, "sessionServerBaseUrl", constants_namespaceObject.SESSION_SERVER_API_URL);
defineProperty_default()(this, "sessionNamespace", void 0);

@@ -118,7 +127,11 @@ defineProperty_default()(this, "allowedOrigin", void 0);

if (sessionTime) this.sessionTime = sessionTime;
if (sessionId) this.sessionId = sessionId.padStart(64, "0");
if (allowedOrigin) this.allowedOrigin = allowedOrigin || "*";
if (sessionId) this.sessionId = (0,util/* padHexString */.i)(sessionId);
if (allowedOrigin) {
this.allowedOrigin = allowedOrigin;
} else {
this.allowedOrigin = "*";
}
}
static generateRandomSessionKey() {
return (0,eccrypto_namespaceObject.generatePrivate)().toString("hex").padStart(64, "0");
return (0,util/* padHexString */.i)((0,eccrypto_namespaceObject.generatePrivate)().toString("hex"));
}

@@ -219,2 +232,15 @@ async createSession(data, headers = {}) {

/***/ 546:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ i: () => (/* binding */ padHexString)
/* harmony export */ });
const padHexString = hexString => {
return hexString.padStart(64, "0").slice(0, 64);
};
/***/ }),
/***/ 990:

@@ -297,3 +323,3 @@ /***/ ((module) => {

var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
(() => {

@@ -312,3 +338,3 @@ "use strict";

/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
/* harmony import */ var _sessionManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(655);
/* harmony import */ var _sessionManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(979);

@@ -315,0 +341,0 @@

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { patch, put, post, get } from '@toruslabs/http-helpers';
import { SESSION_SERVER_API_URL } from '@toruslabs/constants';
import { generatePrivate, getPublic, sign } from '@toruslabs/eccrypto';
import { encryptData, keccak256, decryptData } from '@toruslabs/metadata-helpers';
const padHexString = hexString => {
return hexString.padStart(64, "0").slice(0, 64);
};
class BaseSessionManager {

@@ -12,3 +17,3 @@ constructor() {

if (!this.sessionId) throw new Error("Session id is required");
this.sessionId = this.sessionId.padStart(64, "0");
this.sessionId = padHexString(this.sessionId);
}

@@ -54,3 +59,3 @@

super();
_defineProperty(this, "sessionServerBaseUrl", "https://session.web3auth.io");
_defineProperty(this, "sessionServerBaseUrl", SESSION_SERVER_API_URL);
_defineProperty(this, "sessionNamespace", void 0);

@@ -65,7 +70,11 @@ _defineProperty(this, "allowedOrigin", void 0);

if (sessionTime) this.sessionTime = sessionTime;
if (sessionId) this.sessionId = sessionId.padStart(64, "0");
if (allowedOrigin) this.allowedOrigin = allowedOrigin || "*";
if (sessionId) this.sessionId = padHexString(sessionId);
if (allowedOrigin) {
this.allowedOrigin = allowedOrigin;
} else {
this.allowedOrigin = "*";
}
}
static generateRandomSessionKey() {
return generatePrivate().toString("hex").padStart(64, "0");
return padHexString(generatePrivate().toString("hex"));
}

@@ -72,0 +81,0 @@ async createSession(data, headers = {}) {

{
"name": "@toruslabs/session-manager",
"version": "3.1.0",
"version": "3.2.0",
"description": "session manager web",

@@ -20,5 +20,9 @@ "sideEffects": false,

"pre-commit": "lint-staged --cwd .",
"prepare": "husky"
"prepare": "husky",
"test": "vitest run --reporter=verbose",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest"
},
"dependencies": {
"@toruslabs/constants": "^14.1.1",
"@toruslabs/eccrypto": "^5.0.4",

@@ -29,9 +33,10 @@ "@toruslabs/http-helpers": "^7.0.0",

"devDependencies": {
"@babel/register": "^7.24.6",
"@babel/runtime": "^7.25.6",
"@babel/register": "^7.25.9",
"@babel/runtime": "^7.26.0",
"@toruslabs/config": "^2.2.0",
"@toruslabs/eslint-config-typescript": "^3.3.3",
"@toruslabs/torus-scripts": "^6.1.2",
"@types/mocha": "^10.0.8",
"@types/node": "^20",
"@toruslabs/eslint-config-typescript": "^3.3.4",
"@toruslabs/torus-scripts": "^6.1.6",
"@types/mocha": "^10.0.9",
"@types/node": "^22",
"@vitest/coverage-v8": "^2.1.4",
"cross-env": "^7.0.3",

@@ -41,10 +46,11 @@ "eslint": "^8.47.0",

"lint-staged": "^15.2.10",
"mocha": "^10.7.3",
"mocha": "^10.8.2",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
"typescript": "^5.6.3",
"vitest": "^2.1.4"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.22.4"
"@rollup/rollup-linux-x64-gnu": "^4.24.4"
},

@@ -51,0 +57,0 @@ "author": "Torus Labs",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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