Skip to content

Commit

Permalink
Bump to v5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mdp committed Jun 27, 2019
1 parent c6c24ab commit 15d5104
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Changelog

### 5.0.1
### 5.1.0

- Alias `random_base32` to `random` to avoid breaking
- Create `random_base32` to perform `random` to avoid breaking changes
- Still needed to bump to 5.x due to Base32 cleanup

### 5.0.0
Expand Down
6 changes: 5 additions & 1 deletion lib/rotp/base32.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def random(byte_length = 20)
self.encode(rand_bytes)
end

alias_method :random_base32, :random
# Prevent breaking changes
def random_base32(str_len = 32)
byte_length = str_len * 5/8
random(byte_length)
end

private

Expand Down
2 changes: 1 addition & 1 deletion lib/rotp/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ROTP
VERSION = '5.0.1'.freeze
VERSION = '5.1.0'.freeze
end
5 changes: 3 additions & 2 deletions spec/lib/rotp/base32_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
end

context 'alias to older random_base32' do
let(:base32) { ROTP::Base32.random_base32 }
let(:base32) { ROTP::Base32.random_base32(36) }
it 'is base32 charset' do
expect(base32).to match(/\A[A-Z2-7]+\z/)
expect(base32.length).to eq 36
expect(ROTP::Base32.decode(base32).length).to eq 22
end
end
end
Expand Down

0 comments on commit 15d5104

Please sign in to comment.