Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
jrabausch committed Jun 6, 2023
1 parent 20e69d4 commit 0ae0a12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.editorconfig export-ignore
/README.md export-ignore
/spec export-ignore
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: branca
version: 0.3.0
version: 1.0.0

authors:
- Johannes Rabausch <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions src/branca.cr
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Branca

# Use custom nonce if set (only for testing).
nonce = @nonce || Nonce.new.to_slice
header = Slice(UInt8).new(1, VERSION.to_u8) + time + nonce
header = Bytes.new(1, VERSION.to_u8) + time + nonce

ciphertext = Bytes.new(payload.size + Mac.size)
LibMonocypher.aead_lock(
Expand Down Expand Up @@ -103,7 +103,7 @@ class Branca
timestamp = BigEndian.decode(UInt32, header[1..4])
token = Token.new(payload, timestamp)

raise ExpiredTokenError.new token if ttl > 0 && (timestamp + ttl) < Time.utc.to_unix
raise ExpiredTokenError.new(token) if ttl > 0 && (timestamp + ttl) < Time.utc.to_unix
token
end
end

0 comments on commit 0ae0a12

Please sign in to comment.