Skip to content

hogesako/libstns-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libstns-go

It is STNS Client Library for Go.

Usage

package main

import (
	"fmt"

	"github.com/STNS/libstns-go/libstns"
	"github.com/k0kubun/pp"
)

func main() {
	stns, err := libstns.NewSTNS("https://stns.lolipop.io/v1/", nil)
	if err != nil {
		panic(err)
	}

	user, err := stns.GetUserByName("pyama")
	if err != nil {
		panic(err)
	}
	pp.Println(user)

	signature, err := stns.Sign([]byte("secret test"))
	if err != nil {
		panic(err)
	}

	// it is ok
	fmt.Println(stns.VerifyWithUser("pyama", []byte("secret test"), signature))

	// verify error
	fmt.Println(stns.VerifyWithUser("pyama", []byte("make error"), signature))

}

Author

  • pyama

About

STNS client library for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 96.3%
  • Makefile 3.7%