Skip to content

Commit 0044cd6

Browse files
πŸ“– [Docs]: Rework README into the standard module landing page (#66)
The Sodium README is now a concise landing page that leads with what the module does and how to use it. - **Usage showcase restored** β€” end-to-end examples for generating a key pair (`New-SodiumKeyPair`), encrypting with a public key (`ConvertTo-SodiumSealedBox`), and decrypting a sealed box (`ConvertFrom-SodiumSealedBox`). - **Attribution restored** β€” the `## Acknowledgements` section crediting the upstream **libsodium** library is back (required by the standard). - **Prerequisites restored** β€” libsodium, cross-platform PowerShell 7.4+ (the module ships a net8.0 binary), and the Windows Visual C++ Redistributable note. - **Installation** uses `Install-PSResource`. - **Documentation** links to psmodule.io/Sodium with a copy-paste-friendly discovery snippet. - Removed the `## Contributing` section (repository governance files are handled by a separate rollout). Documentation only β€” no source or functional changes.
1 parent 39f55e6 commit 0044cd6

1 file changed

Lines changed: 26 additions & 57 deletions

File tree

β€ŽREADME.mdβ€Ž

Lines changed: 26 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
# Sodium
22

3-
A PowerShell module that provides direct bindings to the [`libsodium`](https://github.com/jedisct1/libsodium) cryptographic library.
3+
Sodium is a PowerShell module that provides direct bindings to the [`libsodium`](https://github.com/jedisct1/libsodium)
4+
cryptographic library, enabling libsodium-based encryption and decryption directly from PowerShell.
45

56
This module was initially created to serve the needs of the [GitHub PowerShell module](https://github.com/PSModule/GitHub).
6-
GitHub's method for creating or updating [secrets via the REST API](https://docs.github.com/en/rest/guides/encrypting-secrets-for-the-rest-api?apiVersion=2022-11-28#example-encrypting-a-secret-using-c)
7-
requires that secrets be encrypted using the [libsodium](https://github.com/jedisct1/libsodium) library.
7+
GitHub's method for creating or updating
8+
[secrets via the REST API](https://docs.github.com/en/rest/guides/encrypting-secrets-for-the-rest-api?apiVersion=2022-11-28#example-encrypting-a-secret-using-c)
9+
requires that secrets be encrypted using libsodium.
810

911
## Prerequisites
1012

11-
This module relies on the following external resources:
13+
This module relies on the following:
1214

13-
- The [PSModule framework](https://github.com/PSModule) for building, testing, and publishing the module.
1415
- The [libsodium](https://github.com/jedisct1/libsodium) library for cryptographic operations.
16+
- Cross-platform PowerShell 7.4 or later (the module ships a net8.0 binary).
17+
18+
On Windows, the module also requires the Microsoft Visual C++ Redistributable for Visual Studio 2015 or later.
1519

1620
## Installation
1721

18-
To install the module from the PowerShell Gallery, use the following command:
22+
Install the module from the PowerShell Gallery:
1923

2024
```powershell
2125
Install-PSResource -Name Sodium
2226
Import-Module -Name Sodium
2327
```
2428

25-
## Examples
29+
## Usage
2630

27-
### Example 1: Generate a new key pair
31+
### Example: Generate a new key pair
2832

29-
The module provides functionality to create a new cryptographic key pair.
30-
The keys are returned as a PowerShell custom object with `PublicKey` and `PrivateKey` properties, encoded in base64 format.
31-
For more info on the key pair generation, refer to the [Public-key signatures documentation](https://doc.libsodium.org/public-key_cryptography/public-key_signatures).
33+
Create a new cryptographic key pair. The keys are returned as an object with `PublicKey` and `PrivateKey`
34+
properties, encoded in base64.
3235

3336
```powershell
3437
New-SodiumKeyPair
@@ -38,81 +41,47 @@ PublicKey PrivateKey
3841
9fv51aqi00MYN4UR7Ew/DLXMS9t1NapLs7yyo+vegz4= MiJAFUZxZ1UCbQTwKfH7HY6AhIFYQlnok5fBD2K+y/g=
3942
```
4043

41-
### Example 2: Deterministic Key Pair Generation
44+
### Example: Encrypt a message with a public key
4245

43-
Generate a key pair deterministically using a seed. The same seed will always produce the same key pair.
44-
45-
```powershell
46-
New-SodiumKeyPair -Seed 'MySecureSeed'
47-
48-
PublicKey PrivateKey
49-
-------- - ----------
50-
WQakMx2mIAQMwLqiZteHUTwmMP6mUdK2FL0WEybWgB8= ci5/7eZ0IbGXtqQMaNvxhJ2d9qwFxA8Kjx+vivSTXqU=
51-
```
52-
53-
### Example 3: Encrypt a message using a public key (Sealed Boxes encryption)
54-
55-
After generating a key pair, a message can be encrypted using the associated public key with [Sealed Boxes encryption](https://doc.libsodium.org/public-key_cryptography/sealed_boxes).
56-
Below, a message is encrypted using the public key from the previous example.
46+
Encrypt a message using a recipient's public key with
47+
[sealed boxes](https://doc.libsodium.org/public-key_cryptography/sealed_boxes).
5748

5849
```powershell
5950
$params = @{
60-
Message = "mymessage"
61-
PublicKey = "9fv51aqi00MYN4UR7Ew/DLXMS9t1NapLs7yyo+vegz4="
51+
Message = 'mymessage'
52+
PublicKey = '9fv51aqi00MYN4UR7Ew/DLXMS9t1NapLs7yyo+vegz4='
6253
}
6354
ConvertTo-SodiumSealedBox @params
6455
6556
905j4S/JyP9XBBmOIdHSOXiDu7fUtZo9TFIMnAfBMESgcVBwttLnEyxJn4xPEX5OMKQ+Bc4P6Hg=
6657
```
6758

68-
### Example 4: Decrypt a Sodium-encrypted sealed box string
59+
### Example: Decrypt a sealed box
6960

70-
To decrypt a string that was encrypted using [Sealed Boxes encryption](https://doc.libsodium.org/public-key_cryptography/sealed_boxes), both the private and public keys are required.
61+
Decrypt a sealed box back to the original message. Both the public and private keys are required.
7162

7263
```powershell
7364
$params = @{
7465
SealedBox = '905j4S/JyP9XBBmOIdHSOXiDu7fUtZo9TFIMnAfBMESgcVBwttLnEyxJn4xPEX5OMKQ+Bc4P6Hg='
7566
PublicKey = '9fv51aqi00MYN4UR7Ew/DLXMS9t1NapLs7yyo+vegz4='
76-
PrivateKey = 'MiJAFUZxZ1UCbQTwKfH7HY6AhIFYQlnok5fBD2K+y/g=' #gitleaks:allow
67+
PrivateKey = 'MiJAFUZxZ1UCbQTwKfH7HY6AhIFYQlnok5fBD2K+y/g=' #gitleaks:allow
7768
}
7869
ConvertFrom-SodiumSealedBox @params
7970
8071
mymessage
8172
```
8273

83-
### Finding More Examples
74+
## Documentation
8475

85-
For additional examples, refer to the [examples](examples) folder.
76+
Documentation is published at [psmodule.io/Sodium](https://psmodule.io/Sodium/).
8677

87-
Alternatively, you can use the following command to list all available commands in this module:
78+
Use PowerShell help and command discovery for module details:
8879

8980
```powershell
9081
Get-Command -Module Sodium
82+
Get-Help -Name ConvertTo-SodiumSealedBox -Examples
9183
```
9284

93-
To view examples for a specific command, use:
94-
95-
```powershell
96-
Get-Help <CommandName> -Examples
97-
```
98-
99-
## Contributing
100-
101-
Coder or not, you can contribute to this project! We welcome all contributions.
102-
103-
### For Users
104-
105-
If you don't code, you still have valuable insights that can improve this project.
106-
If the module behaves unexpectedly, throws errors, or lacks functionality, you can help by submitting bug reports and feature requests.
107-
Please check the [issues](https://github.com/PSModule/Sodium/issues) tab and submit a new issue if needed.
108-
109-
### For Developers
110-
111-
If you are a developer, we welcome your contributions.
112-
Please read the [Contribution Guidelines](CONTRIBUTING.md) for more information.
113-
114-
You can help by picking up an existing issue or submitting a new one if you have an idea for a feature or improvement.
115-
11685
## Acknowledgements
11786

11887
This module would not be possible without the following resources:

0 commit comments

Comments
Β (0)