Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix code challenge generator
Changed method from #hexdigest to #digest. Includes test to confirm format is as expected according to RFC 7636.
- Loading branch information
Showing
3 changed files
with
23 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
describe Micropublish::Auth do | ||
|
||
before do | ||
# from https://tools.ietf.org/html/rfc7636#appendix-A | ||
@code_verifier = "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk" | ||
@expected_code_challenge = "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM" | ||
end | ||
|
||
context "given a random string as a code verifier" do | ||
describe "#generate_code_challenge" do | ||
it "should generate a code challenge in the expected format" do | ||
code_challenge = Micropublish::Auth.generate_code_challenge(@code_verifier) | ||
expect(code_challenge).to eql(@expected_code_challenge) | ||
end | ||
end | ||
end | ||
|
||
end |