Skip to content

Commit

Permalink
Change init command to set (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
EndlessTrax authored May 8, 2024
1 parent 15846a9 commit 7ef7e0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions Keeper.WindowsCredentialManager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ public class Program
{
public static async Task<int> Main(string[] args)
{
var initCommand = new Command(
name: "init",
var setCommand = new Command(
name: "set",
description: "Add a KSM Config to Windows Credential Manager."
);

Expand All @@ -28,12 +28,12 @@ public static async Task<int> Main(string[] args)

var rootCommand = new RootCommand("KSM Windows Credential Manager");

rootCommand.AddCommand(initCommand);
rootCommand.AddCommand(setCommand);
rootCommand.AddCommand(getCommand);

initCommand.AddArgument(appName);
initCommand.AddArgument(configArg);
initCommand.SetHandler((appName, configArg) =>
setCommand.AddArgument(appName);
setCommand.AddArgument(configArg);
setCommand.SetHandler((appName, configArg) =>
{
CredentialManager.WriteCredential(appName, Environment.UserName, Parsing.ParseConfig(configArg));
// Exit with success code
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ As mentioned above, this utility is a self-contained executable file. Download t

The executable supports two commands:

1. `init`
1. `set`
2. `get`

Both commands require an application `name` (i.e. the name of the credential in / to be stored in the Windows Credential Manager) as the first argument.

### `init`
### `set`

`init` requires a second argument of the secret to be stored. This can be either a:
`set` requires a second argument of the secret to be stored. This can be either a:

1. BASE64 string
2. JSON string
Expand All @@ -37,9 +37,9 @@ When the secret is saved to Windows Credential Manager it is first encoded into

```shell
# Save a secret
binary_name init APPNAME eyJ1c2VybmFtZSI6ICJnb2xsdW0iLCAicGFzc3dvcmQiOiAiTXlQcmVjaW91cyJ9
wcm set APPNAME eyJ1c2VybmFtZSI6ICJnb2xsdW0iLCAicGFzc3dvcmQiOiAiTXlQcmVjaW91cyJ9
# or
binary_name init APPNAME config.json
wcm set APPNAME config.json

# Retrieve a secret
binary_name get APPNAME
Expand Down

0 comments on commit 7ef7e0c

Please sign in to comment.