Skip to content

philips-software/go-nih-signer

Repository files navigation

Build Status Go Reference

Go NIH Signer

This package implements the API signing algorithm used in various HSP APIs. You can sign a http.Request instance

Usage

package main

import (
  "github.com/philips-software/go-nih-signer"
  "net/http"
)

func newSigner(sharedKey, secretKey string) func(*http.Request) error {
    s, err := signer.New(sharedKey, secretKey)
    if err != nil {
       return func(req *http.Request) error {
          return err
       }
    }
    return func(req *http.Request) error {
	return s.SignRequest(req)
    }	
}

func main() {
    signRequest := newSigner("myKey", "mySecret")

    req, _ := http.NewRequest("GET", "https://example.com/some/path", nil)
    
    signRequest(req)
     
}

License

Licensed is MIT