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

Introduce an Identity trait #117

Merged
merged 5 commits into from Jul 12, 2020
Merged

Introduce an Identity trait #117

merged 5 commits into from Jul 12, 2020

Conversation

str4d
Copy link
Owner

@str4d str4d commented Jul 12, 2020

This decouples the identity implementations from the age library, enabling external implementations of identities (leveraging the flexibility of the age format's single joint).

Part of #99.

@codecov
Copy link

codecov bot commented Jul 12, 2020

Codecov Report

Merging #117 into master will decrease coverage by 0.31%.
The diff coverage is 53.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #117      +/-   ##
==========================================
- Coverage   41.56%   41.25%   -0.32%     
==========================================
  Files          25       26       +1     
  Lines        1944     1932      -12     
==========================================
- Hits          808      797      -11     
+ Misses       1136     1135       -1     
Impacted Files Coverage Δ
age/src/cli_common.rs 0.00% <ø> (ø)
age/src/format.rs 49.39% <ø> (+0.58%) ⬆️
age/src/format/plugin.rs 71.42% <ø> (ø)
rage/src/bin/rage-mount/main.rs 0.00% <ø> (ø)
age/src/format/ssh_rsa.rs 45.16% <20.00%> (ø)
age/src/keys.rs 44.92% <25.00%> (-5.82%) ⬇️
age/src/format/scrypt.rs 52.83% <40.00%> (ø)
age/src/format/ssh_ed25519.rs 50.00% <40.00%> (ø)
age/src/format/x25519.rs 57.44% <50.00%> (-0.89%) ⬇️
age/src/identity.rs 51.66% <51.66%> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a4def90...6143d34. Read the comment docs.

This makes the decryption APIs more flexible in where identities are
sourced from.
This decouples the identity implementations from the age library,
enabling external implementations of identities (leveraging the
flexibility of the age format's single joint).

The RecipientStanza enum and its case structs are temporarily made
public. They will be replaced by a common struct that all identities
parse further when handling them, instead of parsing all stanzas
up-front during header parsing.
Parsing of age-native identities is moved to a new IdentityFile struct,
and age::cli_common::read_identities now returns Vec<Box<dyn Identity>>,
as under the hood it now contains both age::IdentityFile and
age::ssh::Identity, which both implement age::Identity.
Identities are now expected to handle any user callbacks themselves.
age::ssh::Identity now has a with_callbacks method that returns an
implementation of age::Identity.
External crates will need to be able to create FileKeys in order to
implement the Identity trait, and will need to be able to to read them
in order to implement the future Recipient trait.

Also adds some additional zeroizing of temporary variables during
FileKey unwrapping.
@str4d str4d added the enhancement New feature or request label Jul 12, 2020
@str4d str4d mentioned this pull request Jul 12, 2020
@str4d str4d marked this pull request as ready for review July 12, 2020 13:36
@str4d
Copy link
Owner Author

str4d commented Jul 12, 2020

Opened #118 for the RecipientStanza refactor (which needs to happen, as we make it public in this PR).

@str4d str4d merged commit 8fac5fc into master Jul 12, 2020
@str4d str4d deleted the identity-refactor branch July 12, 2020 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant