Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kkweon/slackverify
Slack API Verification for Go
https://github.com/kkweon/slackverify
Last synced: about 1 month ago
JSON representation
Slack API Verification for Go
- Host: GitHub
- URL: https://github.com/kkweon/slackverify
- Owner: kkweon
- License: mit
- Created: 2018-12-21T06:43:22.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-03T06:06:30.000Z (about 6 years ago)
- Last Synced: 2024-10-29T08:22:47.698Z (3 months ago)
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Slack API HMAC Verification for Go
[![Build Status](https://travis-ci.com/kkweon/slackverify.svg?branch=master)](https://travis-ci.com/kkweon/slackverify)
[![Coverage Status](https://coveralls.io/repos/github/kkweon/slackverify/badge.svg?branch=master)](https://coveralls.io/github/kkweon/slackverify?branch=master)
[![GoDoc](https://godoc.org/github.com/kkweon/slackverify?status.svg)](https://godoc.org/github.com/kkweon/slackverify)Verify Slack Requests
## Getting Started
```bash
go get -u github.com/kkweon/slackverify
```and then
```go
import "github.com/kkweon/slackverify"slackSigningToken := []byte("8f742231b10e8888abcd99yyyzzz85a5")
body := []byte("token=xyzz0WbapA4vBCDEFasx0q6G&team_id=T1DC2JH3J&team_domain=testteamnow&channel_id=G8PSS9T3V&channel_name=foobar&user_id=U2CERLKJA&user_name=roadrunner&command=%2Fwebhook-collect&text=&response_url=https%3A%2F%2Fhooks.slack.com%2Fcommands%2FT1DC2JH3J%2F397700885554%2F96rGlfmibIGlgcZRskXaIFfN&trigger_id=398738663015.47445629121.803a0bc887a14d10d2c447fce8b6703c")
timestamp := int64(1531420618)expectedHex := []byte("v0=a2114d57b48eac39b9ad189dd8316235a7b4a8d21a10bd27519666489c69b503")
ok := slackverify.Verify(slackSigningToken, body, timestamp, expectedHex)
```## Running the tests
```
golangci-lint run
go test -v ./...
```