Skip to content

Commit

Permalink
check the checksum (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
jshawl authored Feb 4, 2024
1 parent 3d7e167 commit e5af882
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/minisign/private_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@
it 'parses the checksum' do
expect(@private_key.checksum).to eq([19, 146, 239, 121, 33, 164, 216, 219, 8, 104, 111, 52, 198, 78, 21, 236,
113, 255, 174, 47, 39, 216, 61, 198, 233, 161, 233, 143, 84, 246, 255, 150])

key_data = [
[69, 100],
@private_key.key_id,
@private_key.secret_key,
@private_key.public_key
].inject(&:+).pack('C*')

computed_checksum = RbNaCl::Hash::Blake2b.digest(key_data, { digest_size: 32 }).bytes

expect(@private_key.checksum).to eq(computed_checksum)
end
end

Expand Down

0 comments on commit e5af882

Please sign in to comment.