Added function to peek keyfile

Issue #8 resolved
Anonymous created an issue

I have added an additional function which you may wish to include and before I send a patch for review I'd like to know how you would prefer this to be done... can I submit a patch or would you like a pull request here?

regards, Venzen Khaosan

Comments (6)

  1. Vinay Sajip repo owner

    You can submit a patch. Although I do work with pull requests, for reasons not yet clear, merging messes up my bookmarks. So I (for the moment) prefer to work with patches, but you can submit it as a PR if it's easier for you. Because of my bookmarks problem, I sometimes accept the patch (manually) but decline the PR it came with.

  2. Venzen Khaosan

    Vinay, kindly review. The patch has a description in the header. Because the peek_key() function reuses code from list_keys() I had to place the peek_key() function just before the #Encryption section, in order for diff to output sanely. One aspect I did not implement was keyfile error reporting (such as File Not Found, or Does Not Contain Key Data) because the GnuPG docs do not clearly specify the relevant error codes nor do I see existing status handling for the File Not Found condition (perhaps I overlooked it). For now File Not Found and Invalid Key Data will output an empty result of type 'list' (same as list_keys() ).

  3. Vinay Sajip repo owner

    Thanks for your patch. When looking at it I noticed a fair amount of copy-pasted and changed code, which isn't optimal. Looking further, I realised that there is a lot of commonality between the SearchKeys and ListKeys classes, so I have refactored them to make use of this. That means your patch will not apply cleanly, but don't worry about that. I will also need to add unit tests and make documentation changes, and I will get around to doing that at some point.

  4. Vinay Sajip repo owner

    This should be included in d408800 and later. Note that I have renamed the method to scan_keys() and the implementation is different from your patch (for reasons already given). Thanks very much for your contribution!

  5. Log in to comment