Revert "Update Dependency."

This reverts commit 81581db527a4bcc54350e061def7699e1309873f.
This commit is contained in:
Naoki Kosaka 2020-05-10 14:42:11 +09:00
parent 0f5e4d46ce
commit 13c5d73b8e
3 changed files with 5 additions and 6 deletions

View File

@ -9,10 +9,10 @@ import (
"net/http" "net/http"
"strconv" "strconv"
"github.com/go-fed/httpsig"
"github.com/spf13/viper" "github.com/spf13/viper"
activitypub "github.com/yukimochi/Activity-Relay/ActivityPub" activitypub "github.com/yukimochi/Activity-Relay/ActivityPub"
keyloader "github.com/yukimochi/Activity-Relay/KeyLoader" keyloader "github.com/yukimochi/Activity-Relay/KeyLoader"
"github.com/yukimochi/httpsig"
) )
func decodeActivity(request *http.Request) (*activitypub.Activity, *activitypub.Actor, []byte, error) { func decodeActivity(request *http.Request) (*activitypub.Activity, *activitypub.Actor, []byte, error) {

3
go.mod
View File

@ -1,11 +1,10 @@
module github.com/yukimochi/Activity-Relay module github.com/yukimochi/Activity-Relay
go 1.14 go 1.13
require ( require (
github.com/RichardKnop/machinery v1.7.8 github.com/RichardKnop/machinery v1.7.8
github.com/Songmu/go-httpdate v1.0.0 github.com/Songmu/go-httpdate v1.0.0
github.com/go-fed/httpsig v0.1.1-0.20200204213531-0ef28562fabe
github.com/go-redis/redis v6.15.7+incompatible github.com/go-redis/redis v6.15.7+incompatible
github.com/patrickmn/go-cache v2.1.0+incompatible github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0

View File

@ -11,8 +11,8 @@ import (
"time" "time"
httpdate "github.com/Songmu/go-httpdate" httpdate "github.com/Songmu/go-httpdate"
"github.com/go-fed/httpsig"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/yukimochi/httpsig"
) )
func appendSignature(request *http.Request, body *[]byte, KeyID string, publicKey *rsa.PrivateKey) error { func appendSignature(request *http.Request, body *[]byte, KeyID string, publicKey *rsa.PrivateKey) error {
@ -22,11 +22,11 @@ func appendSignature(request *http.Request, body *[]byte, KeyID string, publicKe
request.Header.Set("Digest", "SHA-256="+base64.StdEncoding.EncodeToString(b)) request.Header.Set("Digest", "SHA-256="+base64.StdEncoding.EncodeToString(b))
request.Header.Set("Host", request.Host) request.Header.Set("Host", request.Host)
signer, _, err := httpsig.NewSigner([]httpsig.Algorithm{httpsig.RSA_SHA256}, httpsig.DigestSha256, []string{httpsig.RequestTarget, "Host", "Date", "Digest", "Content-Type"}, httpsig.Signature) signer, _, err := httpsig.NewSigner([]httpsig.Algorithm{httpsig.RSA_SHA256}, []string{httpsig.RequestTarget, "Host", "Date", "Digest", "Content-Type"}, httpsig.Signature)
if err != nil { if err != nil {
return err return err
} }
err = signer.SignRequest(publicKey, KeyID, request, *body) err = signer.SignRequest(publicKey, KeyID, request)
if err != nil { if err != nil {
return err return err
} }