Skip to content

Commit

Permalink
decided i do not like the annotated size
Browse files Browse the repository at this point in the history
  • Loading branch information
bannable committed Apr 6, 2024
1 parent 5d34afc commit 2b66561
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/paseto/paserk_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@ class PaserkTypes < T::Enum

sig { params(input: String).returns(Interface::Key) }
def generate(input) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
input_size = input.bytesize
case self
in K3LocalWrap | K3LocalPBKW | K3Local if input_size == V3::Local::KEY_SIZE
in K3LocalWrap | K3LocalPBKW | K3Local if input.size == V3::Local::KEY_SIZE
V3::Local.new(ikm: input)
in K3SecretWrap | K3SecretPBKW | K3Secret if input_size == V4::Public::KEY_SIZE
in K3SecretWrap | K3SecretPBKW | K3Secret if input.size == V4::Public::KEY_SIZE
V3::Public.from_scalar_bytes(input)
in K3Public
V3::Public.from_public_bytes(input)
in K4LocalWrap | K4LocalPBKW | K4Local if Paseto::HAS_RBNACL && input_size == V4::Local::KEY_SIZE
in K4LocalWrap | K4LocalPBKW | K4Local if Paseto::HAS_RBNACL && input.size == V4::Local::KEY_SIZE
V4::Local.new(ikm: input)
in K4SecretWrap | K4SecretPBKW | K4Secret if Paseto::HAS_RBNACL && input_size == V4::Public::KEY_SIZE
in K4SecretWrap | K4SecretPBKW | K4Secret if Paseto::HAS_RBNACL && input.size == V4::Public::KEY_SIZE
V4::Public.from_keypair(input)
in K4Public
V4::Public.from_public_bytes(input)
Expand Down

0 comments on commit 2b66561

Please sign in to comment.