Documentation ¶
Overview ¶
This package represents the GRPC server exposing functions to interoperate with the node components as well as the wallet
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEdDSAVerification = errors.New("crypto/ed25519: verification error")
ErrEdDSAVerification is the error triggered when verification of ed25519 signatures within the JWT is not successful.
Functions ¶
func NewAuth ¶
func NewAuth(j *JWTManager) (*Auth, *AuthInterceptor)
NewAuth is the authorization service to manage the session with a client.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth struct is a bit weird since it contains an array of known public keys, while the client should just be one. Oh well :).
func (*Auth) CreateSession ¶
CreateSession as defined from the grpc service. Calling createSession from an attached client should refreshes the session token (i.e. drop the current one and create a new one).
func (*Auth) DropSession ¶
func (a *Auth) DropSession(ctx context.Context, req *node.EmptyRequest) (*node.GenericResponse, error)
DropSession as defined from the grpc service.
type AuthInterceptor ¶
type AuthInterceptor struct {
// contains filtered or unexported fields
}
AuthInterceptor is the grpc interceptor to authenticate grpc calls before they get forwarded to the relevant services.
func (*AuthInterceptor) Unary ¶
func (ai *AuthInterceptor) Unary() grpc.UnaryServerInterceptor
Unary returns a UnaryServerInterceptor responsible for authentication.
type ClientClaims ¶
type ClientClaims struct { jwt.StandardClaims ClientEdPk string `json:"client-edpk"` }
ClientClaims is a simple extension of jwt.StandardClaims that includes the ED25519 public key of a client.
type JWTManager ¶
type JWTManager struct {
// contains filtered or unexported fields
}
JWTManager is a simple struct for managing the JWT token lifecycle.
func NewJWTManager ¶
func NewJWTManager(duration time.Duration) (*JWTManager, error)
NewJWTManager creates a JWTManager.
func (*JWTManager) Generate ¶
func (m *JWTManager) Generate(edPkBase64 string) (string, error)
Generate a session token used by the client to authenticate.
func (*JWTManager) Verify ¶
func (m *JWTManager) Verify(accessToken string) (*ClientClaims, error)
Verify the session token.
type Setup ¶
type Setup struct { SessionDurationMins uint RequireSession bool EnableTLS bool CertFile string KeyFile string Network string Address string }
Setup is a configuration struct to setup the GRPC with.
type SigningMethodEdDSA ¶
type SigningMethodEdDSA struct{}
SigningMethodEdDSA is the encryption method based on ed25519. It is demanded by the JWT library and implements jwt.SigningMethod interface.
func (*SigningMethodEdDSA) Alg ¶
func (m *SigningMethodEdDSA) Alg() string
Alg complies with jwt.SigningMethod interface.