Documentation ¶
Overview ¶
Package jwt_ed25519 provides ed25519 signing method for dgrijalva/jwt-go. This package masks itself as HS256 internally to satisfy above dependency.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Intentionally vague errors for security. ErrVerification = errors.New("ed25519: verification error") ErrDecryption = errors.New("ed25519: decryption error") )
View Source
var BytesDecoder = func(encoded string) ([]byte, error) {
return jwt.DecodeSegment(encoded)
}
BytesDecoder decodes the base64 bytes to raw bytes.
View Source
var BytesEncoder = func(bytes []byte) string {
return jwt.EncodeSegment(bytes)
}
BytesEncoder encodes the bytes as base64.
View Source
var Ed25519 = &SigningMethodEdDSA{}
Functions ¶
This section is empty.
Types ¶
type SigningMethodEdDSA ¶
type SigningMethodEdDSA struct{}
func (*SigningMethodEdDSA) Alg ¶
func (m *SigningMethodEdDSA) Alg() string
Alg returns HS256, as the JWT library only supports HS256, though HS256's Key types are byte slices, similar to ed25519.
func (*SigningMethodEdDSA) Sign ¶
func (m *SigningMethodEdDSA) Sign(signingString string, key interface{}) (string, error)
Sign signs the signingString with ed25519, encoded with BytesEncoder.
func (*SigningMethodEdDSA) Verify ¶
func (m *SigningMethodEdDSA) Verify(signingString, signature string, key interface{}) error
Verify uses BytesDecoder to decode the signature, then use that as a ed25519 Public key to verify.
Click to show internal directories.
Click to hide internal directories.