bytifi 0.1.4 → 0.1.5
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 +4 -4
- package/bin/bytifi.js +1 -1
- package/lib/decrypt.js +4 -4
- package/lib/upload.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ Bytifi uses two different values — don't swap them:
|
|
|
90
90
|
|
|
91
91
|
| Name | Upload JSON field | Example location |
|
|
92
92
|
|------|-------------------|------------------|
|
|
93
|
-
| **Link ID** | `
|
|
93
|
+
| **Link ID** | `link` | `/f/QeVuslvdaP-okMxG`, `link?link=QeVuslvdaP-okMxG` |
|
|
94
94
|
| **Encryption token** | `encryptionToken` | `#token=2LTlmBrDkO4GJg0...` in `shareUrl` |
|
|
95
95
|
|
|
96
96
|
- `--link` = link ID (short, ~16 chars)
|
|
@@ -133,7 +133,7 @@ Note: with `npm exec`, put `--` before the file path so npm does not swallow `--
|
|
|
133
133
|
| Flag | Description |
|
|
134
134
|
|------|-------------|
|
|
135
135
|
| `--token` | Encryption key from `#token=...` (`encryptionToken` in upload JSON) |
|
|
136
|
-
| `--link` | Link ID from upload JSON `
|
|
136
|
+
| `--link` | Link ID from upload JSON `link` field (`/f/LINK_ID`) |
|
|
137
137
|
| `--upload-json` | Upload `--json` output file (recommended for downloaded files) |
|
|
138
138
|
| `--meta` | Saved `clientEncryptionMeta` JSON for offline decrypt |
|
|
139
139
|
| `--share-url` | Share URL to read token/metadata while decrypting a local file |
|
|
@@ -146,9 +146,9 @@ Note: with `npm exec`, put `--` before the file path so npm does not swallow `--
|
|
|
146
146
|
|
|
147
147
|
Exit codes: `0` success, `1` usage error, `2` API error, `3` network error.
|
|
148
148
|
|
|
149
|
-
JSON output (`--json`) for upload includes `shareUrl`, `encryptedFile`, `
|
|
149
|
+
JSON output (`--json`) for upload includes `shareUrl`, `encryptedFile`, `link`, `encryptionToken`, `clientEncryptionMeta`, and `expiresAt`.
|
|
150
150
|
|
|
151
|
-
JSON output for decrypt includes `outputPath`, `originalName`, `size`, `mimeType`, `expiresAt`, `
|
|
151
|
+
JSON output for decrypt includes `outputPath`, `originalName`, `size`, `mimeType`, `expiresAt`, `link`, `storageMode`, and `sourcePath` (for local decrypt).
|
|
152
152
|
|
|
153
153
|
Files over ~100 MB encrypted use multipart upload automatically. Progress prints to stderr unless `--json` or `--quiet` is set.
|
|
154
154
|
|
package/bin/bytifi.js
CHANGED
|
@@ -30,7 +30,7 @@ Upload options:
|
|
|
30
30
|
|
|
31
31
|
Decrypt options:
|
|
32
32
|
--token <token> Encryption key from #token=... (not the link ID)
|
|
33
|
-
--link <
|
|
33
|
+
--link <id> Link ID from upload JSON "link" field (/f/LINK_ID)
|
|
34
34
|
--upload-json <path> Upload --json output (easiest for downloaded files)
|
|
35
35
|
--meta <path> Saved clientEncryptionMeta JSON (offline decrypt)
|
|
36
36
|
--share-url <url> Share URL for token/metadata when decrypting a local file
|
package/lib/decrypt.js
CHANGED
|
@@ -179,7 +179,7 @@ async function resolveEncryptionMeta({
|
|
|
179
179
|
if (!linkToken) {
|
|
180
180
|
throw new Error(
|
|
181
181
|
'Missing link metadata for a downloaded file. Pass --upload-json upload.json, --link LINK_ID, or --meta meta.json.\n'
|
|
182
|
-
+ 'The link ID is the `
|
|
182
|
+
+ 'The link ID is the `link` field in upload JSON (also appears as /f/LINK_ID and link?link=LINK_ID).',
|
|
183
183
|
)
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -506,7 +506,7 @@ function hintTokenConfusion(encryptionToken, linkToken) {
|
|
|
506
506
|
if (token.length <= 20) {
|
|
507
507
|
throw new Error(
|
|
508
508
|
`"${token}" looks like a link ID, not an encryption token.\n`
|
|
509
|
-
+ 'Use --link for the link ID (`
|
|
509
|
+
+ 'Use --link for the link ID (`link` in upload JSON) and --token for the encryption key (`encryptionToken`).\n'
|
|
510
510
|
+ 'Easiest: bytifi decrypt ./file.encrypted --upload-json upload.json',
|
|
511
511
|
)
|
|
512
512
|
}
|
|
@@ -533,7 +533,7 @@ export async function loadUploadJson(uploadJsonPath) {
|
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
return {
|
|
536
|
-
linkToken: String(parsed.token || '').trim(),
|
|
536
|
+
linkToken: String(parsed.link || parsed.token || '').trim(),
|
|
537
537
|
encryptionToken,
|
|
538
538
|
meta,
|
|
539
539
|
originalName: parsed.originalName || 'download',
|
|
@@ -591,7 +591,7 @@ function buildDecryptResult({
|
|
|
591
591
|
size,
|
|
592
592
|
mimeType,
|
|
593
593
|
expiresAt,
|
|
594
|
-
linkToken,
|
|
594
|
+
link: linkToken,
|
|
595
595
|
storageMode,
|
|
596
596
|
sourcePath,
|
|
597
597
|
}
|
package/lib/upload.js
CHANGED
|
@@ -124,7 +124,7 @@ function buildResult(payload, context, shareUrl) {
|
|
|
124
124
|
shareUrl,
|
|
125
125
|
url: payload.url,
|
|
126
126
|
encryptedFile: payload.downloadUrl,
|
|
127
|
-
|
|
127
|
+
link: payload.token,
|
|
128
128
|
encryptionToken: context.token,
|
|
129
129
|
clientEncryptionMeta: context.meta,
|
|
130
130
|
originalName: payload.originalName || context.originalName,
|