-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the public API to remove footguns, and document it.
This is a significant refactor of the public API of the crate, simplifying the API surface and removing some of the footgun potential noted by Martin in his review at mozilla/application-services#1068. In particular: * The public `encrypt` functions no longer take a `salt` parameter. The right thing to do is to generate a new random `salt` for each encryption so we just do that for you automatically. * Many internal implementation details are now `pub(crate)` rather than `pub`, to avoid potential confusion from consumers. * We refuse to encrypt or decrypt across multiple records, because our only consumer in practice is webpush, and webpush restricts consumers to using only a single record. We still have the code lying around to encrypt/decrypt across record boundaries, but we don't have high confidence that it works correctly and intend to remove it in a future commit. So, may as well adjust the interface to reflect that while we're in here making breaking changes. To go along with the revised interface, this commit also significantly expands to docs in order to help set consumer expectations and context.
- Loading branch information
Showing
9 changed files
with
380 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ece" | ||
version = "1.3.0" | ||
version = "1.4.0-alpha1" | ||
authors = ["Firefox Sync Team <[email protected]>", "JR Conlin <[email protected]>"] | ||
license = "MPL-2.0" | ||
edition = "2018" | ||
|
@@ -12,20 +12,19 @@ keywords = ["http-ece", "web-push"] | |
byteorder = "1.3" | ||
thiserror = "1.0" | ||
base64 = "0.12" | ||
hex = "0.4" | ||
hkdf = { version = "0.9", optional = true } | ||
lazy_static = { version = "1.4", optional = true } | ||
once_cell = "1.4" | ||
openssl = { version = "0.10", optional = true } | ||
serde = { version = "1.0", features = ["derive"], optional = true } | ||
sha2 = { version = "0.9", optional = true } | ||
|
||
[dev-dependencies] | ||
hex = "0.4" | ||
|
||
[features] | ||
default = ["backend-openssl", "serializable-keys"] | ||
serializable-keys = ["serde"] | ||
backend-openssl = ["openssl", "lazy_static", "hkdf", "sha2"] | ||
backend-test-helper = [] | ||
|
||
[package.metadata.release] | ||
no-dev-version = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.