-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Johan Brichau
committed
Jan 23, 2024
1 parent
ee445dc
commit 35e370b
Showing
5 changed files
with
18 additions
and
24 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
3 changes: 2 additions & 1 deletion
3
repository/Json-WebToken.package/JWT.class/instance/verifySignature.forMessage..st
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,4 +1,5 @@ | ||
private | ||
verifySignature: signatureString forMessage: messageString | ||
|
||
signatureString asByteArray = (self signatureOf: messageString) asByteArray | ||
ifFalse:[self error: 'Signature verification failed'] | ||
ifFalse:[ self error: 'Signature verification failed' ] |
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
14 changes: 6 additions & 8 deletions
14
repository/Json-WebToken.package/JWTTestCase.class/instance/testDefaultEncodeDecode.st
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,15 +1,13 @@ | ||
testing jwt encoding | ||
testDefaultEncodeDecode | ||
|
||
| encodedString key payload encodedJWT decodedJWT | | ||
key := 'secret'. | ||
payload := Dictionary new add: ('some' -> 'payload'); yourself. | ||
|
||
encodedJWT := JWT new | ||
key: key; | ||
payload: payload. | ||
|
||
encodedJWT := JWT new key: key; payload: payload. | ||
encodedString := encodedJWT encodedString. | ||
|
||
decodedJWT := JWT new key: key; fromEncodedString: encodedString. | ||
self assert: decodedJWT headerfields = encodedJWT headerfields. | ||
self assert: decodedJWT payload = encodedJWT payload. | ||
|
||
self assert: decodedJWT headerfields equals: encodedJWT headerfields. | ||
self assert: decodedJWT payload equals: encodedJWT payload |
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