-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for local-pw and secret-pw
- Versions have been refactored to be classes instead of modules, and things that are versioned are expected to respond to a .protocol method that returns an instance of a Interface::Version class. An instance of such a class is comparable with other instances of the same, and also with any string that matches the associated version, e.g. "v3". - Enabled sorbet final checks and added final sigs to several classes - IncorrectKeyType is gone in favor of LucidityError. A LucidityError is any violation of Algorithm Lucidity properties. - Replaced most string concatenation operations with interpolation for improved performance - Added local-pw and secret-pw support for both v3 and v4 - Made PIE version detection more robust against absense of RbNaCl - PIE::Version3 -> PIE::PieV3, PIE::Version4 -> PIE::PieV4 - Util.secure_compare now uses libsodium primitives when available for significantly improved performance. - Fixed pattern matching order in Token parsing to have the more specific case first I'm not entirely happy with the interface for accessing PBKW at this point, because it requires explicitly initializing with a version, but it works well enough. The tests for PBKW v4 are SLOW as hell due to the test vectors including parameters with very high memlimit and opslimit values. I'm leaving them enabled for now, but if it eats up too much CI time, they'll be changed to run only on demand. The test vectors have been modified as in ef77549 due to more buggy encoding. See: paseto-standard/paserk#18
- Loading branch information
Showing
52 changed files
with
1,451 additions
and
144 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
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module Paseto | ||
module Interface | ||
module PBKD | ||
extend T::Sig | ||
extend T::Helpers | ||
|
||
abstract! | ||
|
||
sig { abstract.returns(Interface::Version) } | ||
def protocol; end | ||
|
||
sig { abstract.returns(String) } | ||
def local_header; end | ||
|
||
sig { abstract.returns(String) } | ||
def secret_header; end | ||
|
||
sig { abstract.params(key: Key, options: T::Hash[T.untyped, T.untyped]).returns(String) } | ||
def wrap(key, options); end | ||
|
||
sig { abstract.params(header: String, data: String).returns(Key) } | ||
def unwrap(header, data); end | ||
|
||
sig(:final) { returns(String) } | ||
def version | ||
protocol.version | ||
end | ||
|
||
sig(:final) { returns(String) } | ||
def paserk_version | ||
protocol.paserk_version | ||
end | ||
end | ||
end | ||
end |
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.