pinme 1.1.6-alpha.2 → 1.1.6-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +16 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1523,7 +1523,7 @@ var import_chalk9 = __toESM(require("chalk"));
1523
1523
  var import_figlet3 = __toESM(require("figlet"));
1524
1524
 
1525
1525
  // package.json
1526
- var version = "1.1.6-alpha.2";
1526
+ var version = "1.1.6-alpha.4";
1527
1527
 
1528
1528
  // bin/upload.ts
1529
1529
  var import_path6 = __toESM(require("path"));
@@ -5188,17 +5188,18 @@ async function getMyDomains() {
5188
5188
  var URL2 = "https://pinme.eth.limo/#/preview/";
5189
5189
  var secretKey = "pinme-secret-key";
5190
5190
  checkNodeVersion();
5191
- function encryptHash(hash, key) {
5191
+ function encryptHash(contentHash, key, uid) {
5192
5192
  try {
5193
5193
  if (!key) {
5194
5194
  throw new Error("Secret key not found");
5195
5195
  }
5196
- const encrypted = import_crypto_js.default.RC4.encrypt(hash, key).toString();
5196
+ const combined = uid ? `${contentHash}-${uid}` : contentHash;
5197
+ const encrypted = import_crypto_js.default.RC4.encrypt(combined, key).toString();
5197
5198
  const urlSafe = encrypted.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
5198
5199
  return urlSafe;
5199
5200
  } catch (error) {
5200
5201
  console.error(`Encryption error: ${error.message}`);
5201
- return hash;
5202
+ return contentHash;
5202
5203
  }
5203
5204
  }
5204
5205
  function checkPathSync(inputPath) {
@@ -5221,6 +5222,13 @@ function getDomainFromArgs() {
5221
5222
  }
5222
5223
  return null;
5223
5224
  }
5225
+ function getUid() {
5226
+ const auth = getAuthConfig();
5227
+ if (auth == null ? void 0 : auth.address) {
5228
+ return auth.address;
5229
+ }
5230
+ return getDeviceId();
5231
+ }
5224
5232
  var upload_default = async (options) => {
5225
5233
  try {
5226
5234
  console.log(
@@ -5252,7 +5260,8 @@ var upload_default = async (options) => {
5252
5260
  try {
5253
5261
  const result = await uploadToIpfsSplit_default(absolutePath);
5254
5262
  if (result) {
5255
- const encryptedCID = encryptHash(result.contentHash, secretKey);
5263
+ const uid = getUid();
5264
+ const encryptedCID = encryptHash(result.contentHash, secretKey, uid);
5256
5265
  console.log(
5257
5266
  import_chalk4.default.cyan(
5258
5267
  import_figlet.default.textSync("Successful", { horizontalLayout: "full" })
@@ -5302,7 +5311,8 @@ var upload_default = async (options) => {
5302
5311
  try {
5303
5312
  const result = await uploadToIpfsSplit_default(absolutePath);
5304
5313
  if (result) {
5305
- const encryptedCID = encryptHash(result.contentHash, secretKey);
5314
+ const uid = getUid();
5315
+ const encryptedCID = encryptHash(result.contentHash, secretKey, uid);
5306
5316
  console.log(
5307
5317
  import_chalk4.default.cyan(
5308
5318
  import_figlet.default.textSync("Successful", { horizontalLayout: "full" })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinme",
3
- "version": "1.1.6-alpha.2",
3
+ "version": "1.1.6-alpha.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },