Skip to content

Commit

Permalink
confusion on a slice: fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
sio4 committed Oct 2, 2022
1 parent 3894e97 commit a0a943d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# mw-csrf

[![](https://github.com/gobuffalo/mw-csrf/workflows/Tests/badge.svg)](https://github.com/gobuffalo/mw-csrf/actions)
[![GoDoc](https://godoc.org/github.com/gobuffalo/mw-csrf?status.svg)](https://godoc.org/github.com/gobuffalo/mw-csrf)
[![Standard Test](https://github.com/gobuffalo/mw-csrf/actions/workflows/standard-go-test.yml/badge.svg)](https://github.com/gobuffalo/mw-csrf/actions/workflows/standard-go-test.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/gobuffalo/mw-csrf.svg)](https://pkg.go.dev/github.com/gobuffalo/mw-csrf)

### Requirements

Expand All @@ -14,4 +14,6 @@
$ go get github.com/gobuffalo/mw-csrf
```

---
### Official Middleware Documentation

* https://gobuffalo.io/documentation/request_handling/middleware/
4 changes: 2 additions & 2 deletions csrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ func unmask(issued []byte) []byte {
}

// We now know the length of the byte slice.
otp := issued[tokenLength:]
masked := issued[:tokenLength]
otp := issued[:tokenLength]
masked := issued[tokenLength:]

// Unmask the token by XOR'ing it against the OTP used to mask it.
return xorToken(otp, masked)
Expand Down

0 comments on commit a0a943d

Please sign in to comment.