@oino-ts/hashid 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/dist/cjs/OINOHashid.js +7 -1
- package/dist/esm/OINOHashid.js +7 -1
- package/package.json +3 -3
- package/src/OINOHashid.ts +6 -2
package/dist/cjs/OINOHashid.js
CHANGED
|
@@ -97,7 +97,13 @@ class OINOHashid {
|
|
|
97
97
|
const cryptobytes = Buffer.from(hashidEncoder.decode(cryptotext));
|
|
98
98
|
const decipher = (0, node_crypto_1.createDecipheriv)('aes-128-gcm', this._key, this._iv);
|
|
99
99
|
const plaintext = decipher.update(cryptobytes, undefined, 'utf8');
|
|
100
|
-
|
|
100
|
+
const separator_index = plaintext.indexOf(" ");
|
|
101
|
+
if (separator_index > 0) {
|
|
102
|
+
return plaintext.substring(0, separator_index);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return "";
|
|
106
|
+
}
|
|
101
107
|
}
|
|
102
108
|
}
|
|
103
109
|
exports.OINOHashid = OINOHashid;
|
package/dist/esm/OINOHashid.js
CHANGED
|
@@ -94,6 +94,12 @@ export class OINOHashid {
|
|
|
94
94
|
const cryptobytes = Buffer.from(hashidEncoder.decode(cryptotext));
|
|
95
95
|
const decipher = createDecipheriv('aes-128-gcm', this._key, this._iv);
|
|
96
96
|
const plaintext = decipher.update(cryptobytes, undefined, 'utf8');
|
|
97
|
-
|
|
97
|
+
const separator_index = plaintext.indexOf(" ");
|
|
98
|
+
if (separator_index > 0) {
|
|
99
|
+
return plaintext.substring(0, separator_index);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
98
104
|
}
|
|
99
105
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oino-ts/hashid",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "OINO TS package for hashid's.",
|
|
5
5
|
"author": "Matias Kiviniemi (pragmatta)",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"types": "./dist/types/index.d.ts",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@types/node": "^20.12.7",
|
|
21
|
-
"@oino-ts/common": "1.0.
|
|
21
|
+
"@oino-ts/common": "1.0.2",
|
|
22
22
|
"base-x": "^5.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"typescript": "~5.9.0",
|
|
26
|
-
"@oino-ts/types": "1.0.
|
|
26
|
+
"@oino-ts/types": "1.0.2"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"src/*.ts",
|
package/src/OINOHashid.ts
CHANGED
|
@@ -105,8 +105,12 @@ export class OINOHashid {
|
|
|
105
105
|
const cryptobytes:Buffer = Buffer.from(hashidEncoder.decode(cryptotext))
|
|
106
106
|
const decipher = createDecipheriv('aes-128-gcm', this._key as Uint8Array, this._iv as Uint8Array)
|
|
107
107
|
const plaintext = decipher.update(cryptobytes as Uint8Array, undefined, 'utf8')
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
const separator_index = plaintext.indexOf(" ")
|
|
109
|
+
if (separator_index > 0) {
|
|
110
|
+
return plaintext.substring(0, separator_index)
|
|
111
|
+
} else {
|
|
112
|
+
return ""
|
|
113
|
+
}
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
|