mybase 1.0.45 → 1.0.46
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/README.md +1 -0
- package/mybase.js +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/mybase.js
CHANGED
|
@@ -11,6 +11,10 @@ const { match } = require('assert');
|
|
|
11
11
|
const validator = require('validator')
|
|
12
12
|
const sha512 = require('js-sha512')
|
|
13
13
|
|
|
14
|
+
// create cache folder if not exists
|
|
15
|
+
let vault_cache_folder = '/var/tmp/vault-cache'
|
|
16
|
+
if (!fs.existsSync(vault_cache_folder)) fs.mkdirSync(vault_cache_folder)
|
|
17
|
+
|
|
14
18
|
|
|
15
19
|
Date.prototype.yyyymmdd = function() {
|
|
16
20
|
var mm = this.getMonth() + 1; // getMonth() is zero-based
|
|
@@ -22,6 +26,11 @@ Date.prototype.yyyymmdd = function() {
|
|
|
22
26
|
].join('');
|
|
23
27
|
};
|
|
24
28
|
|
|
29
|
+
function hash_sha512(plain) {
|
|
30
|
+
if (typeof plain==='string') return sha512(plain)
|
|
31
|
+
return false
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
function validHPassword(hpassword) { return (hpassword && hpassword.length === 128 && hpassword.search(/^[a-f0-9]+$/) == 0) }
|
|
26
35
|
function randomHPassword(length=10) {
|
|
27
36
|
let plain = randomString(length)
|
|
@@ -616,5 +625,6 @@ module.exports = {
|
|
|
616
625
|
utcnow,
|
|
617
626
|
Geoip2Paths,
|
|
618
627
|
randomHPassword,
|
|
619
|
-
isURL
|
|
628
|
+
isURL,
|
|
629
|
+
hash_sha512
|
|
620
630
|
}
|