Crates.io | paseto_cli |
lib.rs | paseto_cli |
version | 1.0.1-beta.1 |
source | src |
created_at | 2024-07-26 00:30:12.850004 |
updated_at | 2024-07-26 00:30:12.850004 |
description | A command-line tool for generating and validating PASETO v4.local tokens with custom claims and multiple output formats |
homepage | https://github.com/GovCraft/paseto_cli |
repository | https://github.com/GovCraft/paseto_cli |
max_upload_size | |
id | 1315596 |
size | 209,757 |
PASETO CLI generates and validates PASETO v4.local tokens.
// Available on NPM
npm i -g @govcraft/paseto_cli@latest
Or with Cargo or direct install from binary.
echo "your-32-byte-key-in-base64" | paseto_cli generate --subject "user123" --expiration "2h"
echo "your-32-byte-key-in-base64" | paseto_cli validate --token "v4.local.your-token-here" --subject "user123"
You can download the precompiled binary for your system directly from the PASETO CLI Releases page. This is the easiest method to get started quickly.
To install PASETO CLI using npm, run the following command:
npm i -g @govcraft/paseto_cli@latest
This will install the PASETO CLI tool globally on your system.
If you have Rust installed on your system, you can use Cargo, Rust's package manager, to install PASETO CLI. First, ensure you have Rust and Cargo installed (you can get them from rustup.rs), then run:
cargo install paseto_cli
This command will download, compile, and install the PASETO CLI tool on your system.
To build from source:
git clone https://github.com/Govcraft/paseto-cli.git
cd paseto-cli
cargo build --release
The binary will be available at target/release/paseto_cli
.
PASETO CLI provides two main commands: generate
and validate
.
echo "your-32-byte-key-in-base64" | paseto_cli generate [OPTIONS]
Options:
-s, --subject <SUBJECT>
: Sets the subject claim-i, --issuer <ISSUER>
: Sets the issuer claim-a, --audience <AUDIENCE>
: Sets the audience claim--jti <JTI>
: Sets the token identifier claim--expiration <EXPIRATION>
: Sets the expiration time--not-before <NOT_BEFORE>
: Sets the not-before time--issued-at <ISSUED_AT>
: Sets the issued-at time-c, --custom <KEY=VALUE>
: Adds custom claimsecho "your-32-byte-key-in-base64" | paseto_cli validate --token <TOKEN> [OPTIONS]
Options:
-t, --token <TOKEN>
: Specifies the PASETO token to validate (required)-s, --subject <SUBJECT>
: Specifies the expected subject claim-i, --issuer <ISSUER>
: Specifies the expected issuer claim-a, --audience <AUDIENCE>
: Specifies the expected audience claim--jti <JTI>
: Specifies the expected token identifier claim--expiration <EXPIRATION>
: Specifies the expected expiration time--not-before <NOT_BEFORE>
: Specifies the expected not-before time--issued-at <ISSUED_AT>
: Specifies the expected issued-at time-c, --custom <KEY=VALUE>
: Specifies expected custom claims-f, --format <FORMAT>
: Sets the output format (plain, pretty, json)-h, --help
: Prints help information-V, --version
: Prints version informationecho "your-32-byte-key-in-base64" | paseto_cli generate --subject "user123" --expiration "2h" --custom role=admin
echo "your-32-byte-key-in-base64" | paseto_cli --format pretty validate --token "v4.local.your-token-here" --subject "user123"
echo "your-32-byte-key-in-base64" | paseto_cli --format json generate --subject "user123" --expiration "2h"
Contributions are welcome. See Contributing Guidelines for more details.
PASETO CLI is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
I'm @rrrodzilla, a technologist with 30 years of industry experience. I'm a former SOA and cloud architect, and former Principal Technical Product Manager at AWS for the Rust Programming Language. Currently, I'm the owner and operator of Govcraft, building and consulting on Rust and AI solutions.
For more information, visit https://www.govcraft.ai
For issues, feature requests, or questions, open an issue at https://github.com/Govcraft/paseto-cli/issues.