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

@particle-network/common

Package Overview
Dependencies
Maintainers
3
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@particle-network/common - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

lib/types/url-crypto.d.ts
declare type DataEncoding = "base64" | "hex";
export declare function encryptUrlParam(params?: {}): string;
export declare function encryptUrlParam(params?: {}, encoding?: DataEncoding, secretKey?: string): string;
export declare function decryptUrlParam(params: string, encoding?: DataEncoding): string;
export {};

@@ -9,8 +9,11 @@ "use strict";

var uuid_1 = require("uuid");
function encryptUrlParam(params) {
function encryptUrlParam(params, encoding, secretKey) {
if (params === void 0) { params = {}; }
if (encoding === void 0) { encoding = "base64"; }
if (typeof params !== "string") {
params = JSON.stringify(params);
}
var secretKey = (0, uuid_1.v4)().replace(/-/g, "").toUpperCase();
if (!secretKey) {
secretKey = (0, uuid_1.v4)().replace(/-/g, "").toUpperCase();
}
var keyWA = crypto_js_1.default.enc.Utf8.parse(secretKey);

@@ -23,3 +26,8 @@ var cipherText = crypto_js_1.default.AES.encrypt(params, keyWA, {

}).ciphertext;
return encodeURIComponent(crypto_js_1.default.enc.Base64.stringify(cipherText)) + secretKey;
if (encoding === "base64") {
return encodeURIComponent(crypto_js_1.default.enc.Base64.stringify(cipherText)) + secretKey;
}
else {
return crypto_js_1.default.enc.Hex.stringify(cipherText).toUpperCase() + secretKey;
}
}

@@ -26,0 +34,0 @@ exports.encryptUrlParam = encryptUrlParam;

{
"name": "@particle-network/common",
"version": "0.1.1",
"version": "0.1.2",
"files": [

@@ -5,0 +5,0 @@ "lib",

Sorry, the diff of this file is not supported yet

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