Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling improvements #70

Merged
merged 28 commits into from
Nov 24, 2021
Merged

Error handling improvements #70

merged 28 commits into from
Nov 24, 2021

Commits on Nov 9, 2021

  1. Start work on normalizing keyring names (#60).

    Add get_password_for_target on Windows.
    brotskydotcom committed Nov 9, 2021
    Configuration menu
    Copy the full SHA
    c6e3ca7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8b32038 View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2021

  1. Finish refactoring; fix #60 on Mac

    Keyrings now just keep the platform-specific attributes needed to store and retrieve the corresponding platform keyring item.  This simplifies the platform-specific code and allows the actual keyring implementation to be platform independent (and thus documentable properly).
    
    In addition, you can now create a Keyring by passing in a mapper function which specifies exactly what platform attributes should be used given the service and username.  This allows compatibility with 3rd-party keyring clients.
    adobeDan committed Nov 10, 2021
    Configuration menu
    Copy the full SHA
    4a68211 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3983b55 View commit details
    Browse the repository at this point in the history
  3. Get Linux to compile.

    1. Use Strings rather than strs to simplify lifetime management of the LinuxIdentity attributes.
    2. Remove the mac keychain feature, which cannot be implemented due to deprecation of separate keychains on mac.
    adobeDan committed Nov 10, 2021
    Configuration menu
    Copy the full SHA
    cc397b5 View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2021

  1. Get Windows to a compilable state.

    1. add username into the map
    2. remove platform conditionals in platform-specific files
    adobeDan committed Nov 11, 2021
    Configuration menu
    Copy the full SHA
    9587247 View commit details
    Browse the repository at this point in the history
  2. Fix typo in Windows tests.

    adobeDan committed Nov 11, 2021
    Configuration menu
    Copy the full SHA
    a393a3c View commit details
    Browse the repository at this point in the history
  3. Merge branch 'master' into issue-60

    Get updates to GitHub publish workflow.
    adobeDan committed Nov 11, 2021
    Configuration menu
    Copy the full SHA
    681ef03 View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2021

  1. Update error handling to provide cross platform error codes (start wi…

    …th Mac)
    
    1. Make the error a structure with a code and a cause (underlying error).
    2. Set the code whenever an error is constructed.
    3. Provide the underlying error when there is one.
    
    This work only on Mac for now.
    adobeDan committed Nov 12, 2021
    Configuration menu
    Copy the full SHA
    43475c2 View commit details
    Browse the repository at this point in the history

Commits on Nov 13, 2021

  1. Get windows and linux onto the new error handling.

    Also stopped surfacing the underlying encoding errors, because they can be in both utf8 and utf16 depending on platform, and that doesn't allow for a platform-independent interface.
    adobeDan committed Nov 13, 2021
    Configuration menu
    Copy the full SHA
    da5f00c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0b8a0c4 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'master' into error-handling-improvements

    Merge upstream master to pick up latest release.
    adobeDan committed Nov 13, 2021
    Configuration menu
    Copy the full SHA
    762bf23 View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2021

  1. Finish error work and credential improvements.

    * Add analysis of the errors on each platform.  This fixes #65 and #39 and #54.
    * Change the encoding error to have the raw bytes that couldn't be encoded.  This means we get the same treatment for both UTF-16 and UTF-8 errors.  This fixes #53.
    * Rename `PlatformIdentity` to `PlatformCredential` to make clear what it represents.
    * Update the README and make the code in it be a doctest so it stays up to date.  This fixes #28.
    * Extend `PlatformCredential` so that it has all the attributes in the credential that we set.
    * Change `get_password` to use a mutable clone of the platform credential and have it fill all the fields of the credential from the keychain.
    * Add a variant of `get_password` called `get_password_and_credential` that hands back the platform credential so the client can read all the values.  This fixes #60 including the enhancements requested by @1Dragoon.
    
    What's left to do before we can release this?
    
    1. A lot more tests, especially of error conditions.  I'd like to get to 95% automated coverage or better.
    2. Tests using custom credential mappers for various conditions.
    3. A lot of documentation for all the new features.
    
    I think we are just about ready for a beta release, though.
    adobeDan committed Nov 14, 2021
    Configuration menu
    Copy the full SHA
    5ff53c7 View commit details
    Browse the repository at this point in the history
  2. Fix typo; improve example code.

    1. There was a missing method in the decode_error function on Mac.
    2. Improve the examples to show how errors are described.
    adobeDan committed Nov 14, 2021
    Configuration menu
    Copy the full SHA
    993906a View commit details
    Browse the repository at this point in the history
  3. Fix typo; improve example code.

    1. There was a missing method in the decode_error function on Mac.
    2. Improve the examples to show how errors are described.
    adobeDan committed Nov 14, 2021
    Configuration menu
    Copy the full SHA
    3d16934 View commit details
    Browse the repository at this point in the history
  4. Further fixups and enhancements on Mac

    1. Remove use of bytes crate, so no general depedencies.
    2. Add the keychain domain to the MacCredential, so the user can specify the use of System and Common (and Dynamic) keychains.
    adobeDan committed Nov 14, 2021
    Configuration menu
    Copy the full SHA
    0a3cc66 View commit details
    Browse the repository at this point in the history
  5. Apply last commit changes to Win and Linux

    1. removed use of Bytes dependency
    2. fixed a Windows bug around strings from null pointers.
    adobeDan committed Nov 14, 2021
    Configuration menu
    Copy the full SHA
    107c851 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2021

  1. Review changes and match Linux to Mac.

    1. Add the ability to specify non-default keychains on Linux.
    2. Fix typo in README.
    3. Show how to use destructuring in the example to check for a particular code in the return value.
    adobeDan committed Nov 15, 2021
    Configuration menu
    Copy the full SHA
    e286c76 View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2021

  1. Restructure errors, do renames, and finish docs.

    1. Turned the Error type back into an enum, with underlying platform errors attached to the error codes which indicate a runtime error in the platform.  This really simplified code in a lot of places, and will make it a lot easier for clients to upgrade.
    2. Renamed `Keyring` to `Entry`, since that structure really is one entry in the (global) key ring.  So now you say `keyring::Entry::new(...)` to create a new entry.
    3. Renamed the `attrs` module to `credential` since that's actually what it's about.
    4. Completed a full draft of the code-level documentation.
    
    Once the tests are expanded, this should be ready to release.
    adobeDan committed Nov 16, 2021
    Configuration menu
    Copy the full SHA
    ddf7b01 View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2021

  1. Start fleshing out tests

    1. Move integration tests to a separate file.
    2. Add unit tests for targets.
    3. Add integration tests for target stability.
    adobeDan committed Nov 18, 2021
    Configuration menu
    Copy the full SHA
    543f7c5 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2021

  1. More tests

    1. make default_mapper have the CredentialMapper signature.
    2. add unit tests for input and output validation on Windows.
    brotskydotcom committed Nov 19, 2021
    Configuration menu
    Copy the full SHA
    1bcadf9 View commit details
    Browse the repository at this point in the history
  2. More platform error tests.

    1. refactor map to use a function for decoding passwords.
    2. add encoding error tests on Mac.
    brotskydotcom committed Nov 19, 2021
    Configuration menu
    Copy the full SHA
    f5737d2 View commit details
    Browse the repository at this point in the history
  3. Finish tests.

    Add bad-password test on Linux.
    brotskydotcom committed Nov 19, 2021
    Configuration menu
    Copy the full SHA
    60b607b View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2021

  1. A lot of cleanup based on usage.

    1. Reworked the CLI example to have much better error messages, allow keychain switching, etc.
    2. Based on that rework, revisit the notion of "credential mappers" and change to allowing direct specification of the platform credential for a keyring entry.  This simplified a ton of things, and avoided the whole question of passing closures into the entry creation process.
    3. Having gotten rid of custom mappers, introduce a new constructor to specify a keychain as well as a service and a username.
    4. Simplified the tests to match the simplified interface.
    brotskydotcom committed Nov 21, 2021
    Configuration menu
    Copy the full SHA
    56051c9 View commit details
    Browse the repository at this point in the history
  2. Rename working cli example back to cli.

    I had considered making this example a binary rather than an example, so that it was always available with the package, but the Rust folks haven't figured out the dependency hell around this yet, so I'm saying with it as an example and leaving it published under its current name.
    brotskydotcom committed Nov 21, 2021
    Configuration menu
    Copy the full SHA
    39771fc View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2021

  1. Add verbose mode to the CLI.

    Also remove the `clap` dependency, now that we are using structopt.
    brotskydotcom committed Nov 22, 2021
    Configuration menu
    Copy the full SHA
    01ebb89 View commit details
    Browse the repository at this point in the history
  2. Remove serial testing restriction.

    Now that each of the tests uses a separate credential, there is no collision between testing threads.
    brotskydotcom committed Nov 22, 2021
    Configuration menu
    Copy the full SHA
    1c680a3 View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2021

  1. Clean up based on usage and experimentation.

    1. Rename `new_in_keychain` to `new_with_target` and use the target on all platforms.
    2. Enhacen tests to test the new functionality.
    3. Revamp the CLI example to use new functionality, maintaining backward compatibility.
    4. Revamp the docs and the readme to talk about what happens on each platform.
    5. Test to make sure there is backward compatibility with earlier releases.
    brotskydotcom committed Nov 24, 2021
    Configuration menu
    Copy the full SHA
    9964e87 View commit details
    Browse the repository at this point in the history