jwt-encde 0.0.0 → 1.1.0-pre.9
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 +62 -0
- package/index.js +44 -0
- package/package.json +37 -2
- package/postinstall.js +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# jwt-encde
|
|
2
|
+
|
|
3
|
+
[](https://crates.io/crates/jwt-encde)
|
|
4
|
+
[](https://deps.rs/crate/jwt-encde)
|
|
5
|
+
[](https://github.com/nabbisen/jwt-encde/actions/workflows/release-executable.yaml)
|
|
6
|
+
[](https://github.com/nabbisen/jwt-encde/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
GUI JWT encoder / decoder - Local, private, easy.
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
## Description
|
|
13
|
+
|
|
14
|
+
A lightweight, open-source GUI tool for JWT encoding and decoding, designed to support testing around authentication and authorization in app development.
|
|
15
|
+
|
|
16
|
+
This app allows you to **inspect, analyze, and edit JWT payloads as JSON**, and easily convert test JSON data into JWTs for development and debugging purposes.
|
|
17
|
+
|
|
18
|
+
### Key features
|
|
19
|
+
|
|
20
|
+
- Runs entirely **offline**, unlike online tools
|
|
21
|
+
- It strongly ensures **security and privacy**. No data ever leaves your machine.
|
|
22
|
+
- Built with a **low-memory, high-performance architecture**
|
|
23
|
+
- Available as a **cross-platform binary** for Windows, macOS, and Linux
|
|
24
|
+
|
|
25
|
+
#### Additional features included
|
|
26
|
+
|
|
27
|
+
- Syntax highlighting for JSON to improve readability
|
|
28
|
+
- Disabled states for unavailable actions to prevent accidental operations
|
|
29
|
+
- A built-in helper tool for analyzing UNIX timestamps within JSON data
|
|
30
|
+
|
|
31
|
+
#### Note: This app does **not** support JWT signing or token introspection
|
|
32
|
+
|
|
33
|
+
In real-world systems, signing keys and token validation are typically managed by IDaaS. They should be verified through actual integration with the provider.
|
|
34
|
+
|
|
35
|
+
## Usage options
|
|
36
|
+
|
|
37
|
+
- Install as npm pacakge
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm install -g jwt-encde
|
|
41
|
+
npx jwt-encde
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- Install via Rust cargo
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
cargo install jwt-encde
|
|
48
|
+
jwt-encde
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- Download executable and just run it
|
|
52
|
+
- [Assets](https://github.com/nabbisen/jwt-encde/releases/latest) in GitHub Releases are avalilable
|
|
53
|
+
|
|
54
|
+
## Open-source, with care
|
|
55
|
+
|
|
56
|
+
This project is lovingly built and maintained by volunteers.
|
|
57
|
+
We hope it helps streamline your work.
|
|
58
|
+
Please understand that the project has its own direction — while we welcome feedback, it might not fit every edge case 🌱
|
|
59
|
+
|
|
60
|
+
## Acknowledgements
|
|
61
|
+
|
|
62
|
+
Depends on the crates of [arboard](https://crates.io/crates/arboard), [base64](https://crates.io/crates/base64), [hmac](https://crates.io/crates/hmac), [iced](https://crates.io/crates/iced), [json5](https://crates.io/crates/json5), [serde](https://crates.io/crates/serde), [serde_json](https://crates.io/crates/serde_json), [sha2](https://crates.io/crates/sha2), [webbrowser](https://crates.io/crates/webbrowser).
|
package/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const os = require("os")
|
|
4
|
+
const { join } = require("path")
|
|
5
|
+
const { spawn } = require("child_process")
|
|
6
|
+
|
|
7
|
+
const binaryName = "jwt-encde"
|
|
8
|
+
|
|
9
|
+
function binaryPath() {
|
|
10
|
+
const platform = os.platform()
|
|
11
|
+
let extension = ""
|
|
12
|
+
switch (platform) {
|
|
13
|
+
case "win32":
|
|
14
|
+
extension = ".exe"
|
|
15
|
+
break
|
|
16
|
+
default:
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return join(__dirname, `${binaryName}${extension}`)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function spawnBinary(binaryPath) {
|
|
23
|
+
// passing command line arguments to the executable
|
|
24
|
+
const args = process.argv.slice(2)
|
|
25
|
+
|
|
26
|
+
const child = spawn(binaryPath, args, {
|
|
27
|
+
stdio: "inherit", // sharing std i/o with the parent brings memory efficiency
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
child.on("error", (err) => {
|
|
31
|
+
console.error(`failed to start: ${err.message}`)
|
|
32
|
+
process.exit(1)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
child.on("exit", (code, signal) => {
|
|
36
|
+
if (signal) {
|
|
37
|
+
console.error(`exit by signal: ${signal}`)
|
|
38
|
+
process.exit(1)
|
|
39
|
+
}
|
|
40
|
+
process.exit(code)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
spawnBinary(binaryPath())
|
package/package.json
CHANGED
|
@@ -1,7 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jwt-encde",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0-pre.9",
|
|
4
4
|
"description": "GUI JWT encoder / decoder - Local, private, easy.",
|
|
5
|
+
"author": "nabbisen<nabbisen@scqr.net>",
|
|
5
6
|
"license": "Apache-2.0",
|
|
6
|
-
"
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/nabbisen/jwt-encde.git"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"registry": "https://registry.npmjs.org/"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/nabbisen/jwt-encde/",
|
|
16
|
+
"bin": {
|
|
17
|
+
"jwt-encde": "./index.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"postinstall.js"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"postinstall": "node postinstall.js"
|
|
24
|
+
},
|
|
25
|
+
"optionalDependencies": {
|
|
26
|
+
"@jwt-encde/bin-linux-x64-gnu": "1.1.0-pre.9",
|
|
27
|
+
"@jwt-encde/bin-darwin-arm64": "1.1.0-pre.9",
|
|
28
|
+
"@jwt-encde/bin-win32-x64-msvc": "1.1.0-pre.9"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"jwt",
|
|
32
|
+
"json",
|
|
33
|
+
"auth",
|
|
34
|
+
"test",
|
|
35
|
+
"encryption",
|
|
36
|
+
"security",
|
|
37
|
+
"devtool",
|
|
38
|
+
"developer-tool",
|
|
39
|
+
"testing",
|
|
40
|
+
"simulate"
|
|
41
|
+
]
|
|
7
42
|
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const fs = require("fs")
|
|
2
|
+
const os = require("os")
|
|
3
|
+
const path = require("path")
|
|
4
|
+
|
|
5
|
+
const binaryName = "jwt-encde"
|
|
6
|
+
const platformOrganization = "@jwt-encde"
|
|
7
|
+
|
|
8
|
+
function srcDestBinaryPath() {
|
|
9
|
+
const platform = os.platform()
|
|
10
|
+
|
|
11
|
+
let platformPackage = null
|
|
12
|
+
let extension = ""
|
|
13
|
+
|
|
14
|
+
switch (platform) {
|
|
15
|
+
case "linux":
|
|
16
|
+
platformPackage = "bin-linux-x64-gnu"
|
|
17
|
+
break
|
|
18
|
+
case "darwin":
|
|
19
|
+
platformPackage = "bin-darwin-arm64"
|
|
20
|
+
break
|
|
21
|
+
case "win32":
|
|
22
|
+
platformPackage = "bin-win32-x64-msvc"
|
|
23
|
+
extension = ".exe"
|
|
24
|
+
break
|
|
25
|
+
default:
|
|
26
|
+
console.error(`Unsupported platform: ${platform}`)
|
|
27
|
+
process.exit(1)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const binDir = __dirname
|
|
31
|
+
const srcDir = path.join(binDir, "..", platformOrganization, platformPackage)
|
|
32
|
+
const srcBinary = path.join(srcDir, `${binaryName}${extension}`)
|
|
33
|
+
const destBinary = path.join(binDir, `${binaryName}${extension}`)
|
|
34
|
+
|
|
35
|
+
return [srcBinary, destBinary]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function linkOrCopy(src, dest) {
|
|
39
|
+
try {
|
|
40
|
+
if (fs.existsSync(dest)) {
|
|
41
|
+
fs.rmSync(dest, { force: true })
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Try symbolic link first
|
|
45
|
+
fs.symlinkSync(src, dest, "file")
|
|
46
|
+
fs.chmodSync(src, 0o755)
|
|
47
|
+
console.log(`linked ${src} --> ${dest}`)
|
|
48
|
+
} catch (e) {
|
|
49
|
+
// Fallback to file copy
|
|
50
|
+
console.warn(`symlink failed (${e.message}), falling back to copy.`)
|
|
51
|
+
fs.copyFileSync(src, dest)
|
|
52
|
+
fs.chmodSync(dest, 0o755)
|
|
53
|
+
console.log(`copied ${src} --> ${dest}`)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const [srcBinary, destBinary] = srcDestBinaryPath()
|
|
58
|
+
linkOrCopy(srcBinary, destBinary)
|