cli: support ECIES encryption for device configs - #223
Conversation
Signed-off-by: Volodymyr Khoroz <volodymyr.khoroz@foundries.io>
|
|
||
| require ( | ||
| github.com/alexflint/go-arg v1.6.0 | ||
| github.com/foundriesio/go-ecies v0.3.0 |
There was a problem hiding this comment.
@doanac There seems to be a way to support ECIES in web UI via https://github.com/ecies/js, but I'm not sure if we should support that. We did not in our cloud solution.
One specific UI problem I see with this is that the "edit" functionality might seem confusing, as there is no way to give a user "something" to edit in case of encrypted files - that's rather a replace operation.
Do you think that's worth an effort?
There was a problem hiding this comment.
Pull request overview
Adds optional ECIES encryption support to the satcli configs set command for device-specific configuration uploads by fetching the device’s stored public key and encrypting config values before submitting them to the server.
Changes:
- Introduces
--encrypt/-eforconfigs setand encrypts config values with ECIES (base64-encoded ciphertext) when used with--device. - Refactors the CLI configs API to use a
SpecificConfigsApiinterface and expands the device API to exposeGetPubkey(). - Updates module dependencies to include
github.com/foundriesio/go-ecies.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Adds github.com/foundriesio/go-ecies dependency. |
| go.sum | Records checksums for the new ECIES dependency. |
| cli/subcommands/configs/set.go | Adds --encrypt/-e, encrypts device config file values via ECIES, and fetches device pubkey for encryption. |
| cli/subcommands/configs/cmd.go | Adjusts device API selection to return the device configs API object (enables pubkey access). |
| cli/api/configs.go | Refactors SpecificConfigsApi into an interface, introduces specificConfigsApi implementation, and adds DeviceConfigsApi.GetPubkey(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if dcapi, ok := capi.(api.DeviceConfigsApi); !ok { | ||
| return errors.New("encrypt can only be used for device configuration") |
There was a problem hiding this comment.
@doanac I like the way a message looks right now, but if you agree with ai, I'll submit.
No description provided.