@hugoalh/github-sodium
v6.0.2
Published
A module to provide an easier and simplified method for encrypt GitHub secrets.
Downloads
672
Readme
GitHub Sodium (ES)
🔗 DistBoard @hugoalh ● GitHub ● JSR ● NPM
An ECMAScript module to provide an easier and simplified method for encrypt GitHub secrets.
🌟 Features
- Support multiple implementations:
- LibSodium: Default; Recommended by GitHub; Bad compatibility with bundler or compiler.
- TweetSodium: Originally created by GitHub but deprecated and unmaintained (Repository), currently maintain here; Good compatibility with bundler or compiler.
🎯 Runtime Targets
Any runtime which support ECMAScript should able to use this; These runtimes are officially supported:
🛡️ Runtime Permissions
This does not request any runtime permission.
#️⃣ Sources & Entrypoints
- GitHub Raw
https://raw.githubusercontent.com/hugoalh/github-sodium-es/{Tag}/mod.ts - JSR
jsr:@hugoalh/github-sodium[@{Tag}] - NPM
npm:@hugoalh/github-sodium[@{Tag}]
| Name | Path | Description |
|:--|:--|:--|
| . | ./mod.ts | Default (LibSodium). |
| ./cli | N/A | CLI for default (LibSodium). |
| ./libsodium | ./libsodium.ts | LibSodium. |
| ./libsodium/cli | ./libsodium/cli.ts | CLI for LibSodium. |
| ./tweetsodium | ./tweetsodium.ts | TweetSodium. |
| ./tweetsodium/cli | ./tweetsodium/cli.ts | CLI for TweetSodium. |
[!NOTE]
- Different runtimes have vary support for the sources and entrypoints, visit the runtime documentation for more information.
- It is recommended to include tag for immutability.
- These are not part of the public APIs hence should not be used:
- Benchmark/Test file (e.g.:
example.bench.ts,example.test.ts).- Entrypoint name or path include any underscore prefix (e.g.:
_example.ts,foo/_example.ts).- Identifier/Namespace/Symbol include any underscore prefix (e.g.:
_example,Foo._example).
🧩 APIs
class GitHubSodiumSealer { constructor(publicKey: string); encrypt(value: string): string; }
[!NOTE]
- For the full or prettier documentation, can visit via:
🧩 CLIs
ghs $PublicKey $SecretValueghs-ls $PublicKey $SecretValueghs-ts $PublicKey $SecretValue
✍️ Examples
new GitHubSodiumSealer("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234").encrypt("plain-text-secret");ghs '2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234' 'plain-text-secret'
