diff --git a/src/github.com/matrix-org/dendrite/clientapi/auth/tokens/tokens.go b/src/github.com/matrix-org/dendrite/clientapi/auth/tokens/tokens.go index abcb59fd3..f65ce5083 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/auth/tokens/tokens.go +++ b/src/github.com/matrix-org/dendrite/clientapi/auth/tokens/tokens.go @@ -63,7 +63,7 @@ func GenerateLoginToken(op TokenOptions) (string, error) { return "", macaroonError(err) } - urlSafeEncode, err := SerializeMacaroon(*mac) + urlSafeEncode, err := serializeMacaroon(*mac) if err != nil { return "", macaroonError(err) } @@ -106,9 +106,9 @@ func macaroonError(err error) error { return fmt.Errorf("Macaroon creation failed: %s", err.Error()) } -// SerializeMacaroon takes a macaroon to be serialized. +// serializeMacaroon takes a macaroon to be serialized. // returns it's base64 encoded string, URL safe, which can be sent via web, email, etc. -func SerializeMacaroon(m macaroon.Macaroon) (string, error) { +func serializeMacaroon(m macaroon.Macaroon) (string, error) { bin, err := m.MarshalBinary() if err != nil { return "", err @@ -118,9 +118,9 @@ func SerializeMacaroon(m macaroon.Macaroon) (string, error) { return urlSafeEncode, nil } -// DeSerializeMacaroon takes a base64 encoded string of a macaroon to be de-serialized. +// deSerializeMacaroon takes a base64 encoded string of a macaroon to be de-serialized. // Returns a macaroon. On failure returns error with description. -func DeSerializeMacaroon(urlSafeEncode string) (macaroon.Macaroon, error) { +func deSerializeMacaroon(urlSafeEncode string) (macaroon.Macaroon, error) { var mac macaroon.Macaroon bin, err := base64.RawURLEncoding.DecodeString(urlSafeEncode) if err != nil { diff --git a/src/github.com/matrix-org/dendrite/clientapi/auth/tokens/tokens_test.go b/src/github.com/matrix-org/dendrite/clientapi/auth/tokens/tokens_test.go index 4c9438df5..7ffe98097 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/auth/tokens/tokens_test.go +++ b/src/github.com/matrix-org/dendrite/clientapi/auth/tokens/tokens_test.go @@ -64,12 +64,12 @@ func TestSerialization(t *testing.T) { t.Errorf(serializationTestError(err)) } - fakeMacaroon, err := DeSerializeMacaroon(fakeToken) + fakeMacaroon, err := deSerializeMacaroon(fakeToken) if err != nil { t.Errorf(serializationTestError(err)) } - sameFakeToken, err := SerializeMacaroon(fakeMacaroon) + sameFakeToken, err := serializeMacaroon(fakeMacaroon) if err != nil { t.Errorf(serializationTestError(err)) }