Control SESAME SmartLock by SESAME v2 API
As a library
go get github.com/ouest/goma
or if you want to use it as a bin command
go >= 1.17
go install github.com/ouest/goma/cmd/goma@latest
go < 1.17
go get github.com/ouest/goma/cmd/goma
Add your application configuration to your .env
file in the root of your project:
SESAME_UUID=YOUR_SESAME_UUID
SESAME_API_KEY=YOUR_SESAME_API_KEY
SESAME_SECRET_KEY=YOUR_SERSAME_SECRET_KEY
Then in your Go app you can do something like
package main
import (
"github.com/ouest/goma"
)
func main() {
// get SESAME state
state := goma.State()
// get SESAME history
history := goma.History(0, 10)
// lock SESAME
goma.Lock("account_name")
// toggle SESAME
goma.Toggle("account_name")
// unlock SESAME
goma.Unlock("account_name")
}
Assuming you've installed the command as above and you've got $GOPATH/bin
in your $PATH
goma state
goma history -p 0 -n 10
goma lock account_name
goma toggle account_name
goma unlock account_name