passbolt / go-passbolt-cli

A CLI tool to interact with Passbolt, a Open source Password Manager for Teams
https://passbolt.com
MIT License
68 stars 15 forks source link

[feature] Get resource TOTP code (somewhat implemented) #54

Open pbogut opened 6 months ago

pbogut commented 6 months ago

The feature: I would like to be able to generate TOTP code for resource from the cli.

Work done so far: In order to make it work the go-passbolt would have to be updated. I did that in this commit: https://github.com/pbogut/go-passbolt/commit/e8b14eb394e0518a876011748fb2aefecefdcdd9 Then this repo has to be updated to use generated code. I've done it here: https://github.com/pbogut/go-passbolt-cli/commit/02607ccf30bbe63b5a0def50997481c906946576

My change works, and code is displayed when getting resource. Note that I did it just for myself as a proof of concept.

Things up for discussion:

speatzle commented 6 months ago

Hi, i had a quick look. I definitely want to support TOTPs in the CLI, as such renaming and deprecation of some flags and basic handling has already landed.

TOTPs use the "new" Resource Type System. go-passbolt has been around since before that has been a thing an thus some assumptions were made such as that a Resource always has the same fields.

For TOTPs and other Upcoming Resource Types to be Properly supported there have to be some core changes made to go-passbolt. The biggest blocker is how go-passbolt's API surface should look for go-passbolt-cli and others consumers to support new types without needing to know about them (possibility of User Created/Modified Resource Types).

If you have any Ideas how such a API could look that would be much Appreciated.

As for your Current Code Changes, since they change the Signature of for the GetResource helper that would break multiple Project i know about when they update go-passbolt and since we will hit this same scenario again with the next Resource Type i would Rather work on fixing this "Properly" and keep the current GetResource Helper the way it is for the Simple Usecase or Deprecate it in favor of the new Resource Type Generic API.