detunized / lastpass-ruby

LastPass Ruby API
MIT License
70 stars 19 forks source link

interpet and expose Secure Notes #16

Closed saraid closed 3 years ago

saraid commented 4 years ago

Hello,

I store some files as Secure Notes and would like to be able to access them using Ruby. This seemed like the best way to do that. I tried to follow your style and design choices, but if there's anything you'd like done differently, please let me know.

I'm not confident in my ability to modify the test data to include Secure Notes, so I haven't touched the tests.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-0.8%) to 94.058% when pulling 43134091ec0407d19426ff3b0a4d1a9b12d712b7 on saraid:saraid/add-secure-notes into 4d9241a7681ed056534ef643331a6b681824b1c5 on detunized:master.

detunized commented 3 years ago

Hi Michael,

Thanks for the pull request. I'll take a look as soon as I can. Most likely today or tomorrow. I would like to try it out myself and then I'll merge it, if it works well. Could explain in one or two sentences how to create a test case for your feature? Where do I have to click to create a note you meant to parse? Thanks.

On Mon, Oct 26, 2020, 23:25 Michael Chui notifications@github.com wrote:

Hello,

I store some files as Secure Notes and would like to be able to access them using Ruby. This seemed like the best way to do that. I tried to follow your style and design choices, but if there's anything you'd like done differently, please let me know.

You can view, comment on, or merge this pull request online at:

https://github.com/detunized/lastpass-ruby/pull/16 Commit Summary

  • interpet and expose Secure Notes

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/detunized/lastpass-ruby/pull/16, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB35EL5SQAEIYXIP3JXAHDSMXZL7ANCNFSM4S77ZQ5A .

saraid commented 3 years ago

Sure.

From the Vault,

  1. I click "Notes" in the left sidebar, then
  2. I click the "+" in the bottom right corner.

This lets me give my note an arbitrary name and folder, as shown here:

Screen Shot 2020-10-27 at 11 36 27 AM
(Tue 11:38:21):~/Developer/github/lastpass-ruby [saraid/add-secure-notes] % bundle exec irb
irb(main):001:0> load 'lib/lastpass.rb'
=> true
irb(main):002:0> vault = LastPass::Vault.open_remote ENV['LASTPASS_USER'], ENV['LASTPASS_PASS']; nil
=> nil
irb(main):003:0> vault.notes.find { |n| n.name == 'test test' }.notes
=> "just a note"
saraid commented 3 years ago

As an aside, all accounts have a "Notes" field; this is something already parsed by Parser.parse_ACCT: but it's dropped when you build the Account object. I chose not to change this, since I wasn't sure about your design decision, but you could pretty easily change that if you wanted.

detunized commented 3 years ago

As an aside, all accounts have a "Notes" field; this is something already parsed by Parser.parse_ACCT: but it's dropped when you build the Account object. I chose not to change this, since I wasn't sure about your design decision, but you could pretty easily change that if you wanted.

This is an oversight. For a while I have not been looking into this library. I'm mainly busy with a grand-grand-son of this library https://github.com/detunized/password-manager-access. I just realized there I'm also discarding them. Thanks for the tip. I can fix that.

detunized commented 3 years ago

Merged. Thanks for the PR! I'll release this soon and will let you know.

saraid commented 3 years ago

Thank you very much!

detunized commented 3 years ago

@saraid, version 1.7.0 pushed to RubyGems. I also added the @notes property to the Account class.