package main

import (
	"crypto/hmac"
	"crypto/sha256"
	"fmt"
	"net/http"
	"strconv"
	"time"
)

func main() {
	urlStr := fmt.Sprintf("%s/internal/registry/%s/@%s/%s", "https://api.github.com/", "npm", "phanatic", "pkgcloud")

	r, _ := http.NewRequest("GET", urlStr, nil)
	timestamp := time.Now().Unix()
	mac := hmac.New(sha256.New, []byte("5ad2218c47a53907b97691c598cf4ce9de96961a6ed233bc31afdf9f1994fff8"))
	mac.Write([]byte(strconv.Itoa(int(timestamp))))
	r.Header.Set("Request-MAC", fmt.Sprintf("%d.%x", timestamp, mac.Sum(nil)))

	fmt.Printf("%d.%x", timestamp, mac.Sum(nil))
}
