1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-30 10:25:40 +02:00

More docs docs docs

This commit is contained in:
Philipp Heckel 2022-02-01 23:39:57 -05:00
parent c3a2331b59
commit 1552d8103e
7 changed files with 211 additions and 121 deletions

View file

@ -1,6 +1,7 @@
package util
import (
"encoding/base64"
"errors"
"fmt"
"github.com/gabriel-vasile/mimetype"
@ -240,3 +241,8 @@ func ReadPassword(in io.Reader) ([]byte, error) {
return password, nil
}
// BasicAuth encodes the Authorization header value for basic auth
func BasicAuth(user, pass string) string {
return fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", user, pass))))
}