mobiletto 1.0.31 → 1.0.34
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 +3 -3
- package/package.json +1 -1
- package/util/crypt.js +3 -3
package/README.md
CHANGED
|
@@ -12,14 +12,14 @@ Today the supported drivers are:
|
|
|
12
12
|
* `s3`: read/write an Amazon S3 bucket
|
|
13
13
|
* `local`: read/write to local filesystem
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
### mobiletto-cli
|
|
16
16
|
Mobiletto is intended to be used as a library by other JavaScript code.
|
|
17
17
|
|
|
18
18
|
To work with mobiletto at the command-line, use [mobiletto-cli](https://www.npmjs.com/package/mobiletto-cli)
|
|
19
19
|
|
|
20
20
|
### Source
|
|
21
|
-
* [
|
|
22
|
-
* [
|
|
21
|
+
* [mobiletto on GitHub](https://github.com/cobbzilla/mobiletto)
|
|
22
|
+
* [mobiletto on npm](https://www.npmjs.com/package/mobiletto)
|
|
23
23
|
|
|
24
24
|
## TLDR
|
|
25
25
|
A simple example using the mobiletto `s3` driver.
|
package/package.json
CHANGED
package/util/crypt.js
CHANGED
|
@@ -8,13 +8,13 @@ const DEFAULT_CRYPT_ALGO = 'aes-256-cbc';
|
|
|
8
8
|
|
|
9
9
|
function normalizeKey (k) {
|
|
10
10
|
return (typeof k === 'string' && k.trim().length > MIN_KEY_LEN)
|
|
11
|
-
? Buffer.from(shasum(k)).subarray(0, 32)
|
|
11
|
+
? Buffer.from(shasum(k.trim())).subarray(0, 32)
|
|
12
12
|
: null
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function normalizeIV (iv, key) {
|
|
16
|
-
return (typeof iv === 'string')
|
|
17
|
-
? Buffer.from(shasum(iv)).subarray(0, 16)
|
|
16
|
+
return (typeof iv === 'string' && iv.trim().length > 16)
|
|
17
|
+
? Buffer.from(shasum(iv.trim())).subarray(0, 16)
|
|
18
18
|
: key
|
|
19
19
|
? Buffer.from(shasum(key)).subarray(0, 16)
|
|
20
20
|
: null
|