-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GRPC to issuer from apigw in order to make sdjwt. #64
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issues find by Goland (may be in files not included in this pull request):
File queue_vc_persistent_delete.go has wrong comment in
// VCPersistentSave holds the ladok delete signed queue
type VCPersistentDelete struct {
File error.go has type assertion on erros fails on wrapped errors, user errors.As (4 places)?
File docs/verifier/swagger.json missing required properties 'title' and 'version'
@@ -52,7 +53,7 @@ type CreateCredentialReply struct { | |||
} | |||
|
|||
// CreateCredential creates a credential | |||
func (c *Client) CreateCredential(ctx context.Context, req *CreateCredentialRequest) (*CreateCredentialReply, error) { | |||
func (c *Client) MakeSDJWT(ctx context.Context, req *CreateCredentialRequest) (*CreateCredentialReply, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename comment!
func (c *Client) Revoke(ctx context.Context, req *RevokeRequest) (*RevokeReply, error) { | ||
optInsecure := grpc.WithTransportCredentials(insecure.NewCredentials()) | ||
|
||
conn, err := grpc.Dial(c.cfg.Registry.GRPCServer.Addr, optInsecure) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dial is deprecated: use NewClient instead (inspect in GoLand)
@@ -20,7 +21,7 @@ type Apiv1 interface { | |||
|
|||
// credential endpoints | |||
Revoke(ctx context.Context, req *apiv1.RevokeRequest) (*apiv1.RevokeReply, error) | |||
Credential(ctx context.Context, req *apiv1.CredentialRequest) (*apiv1.CredentialReply, error) | |||
Credential(ctx context.Context, req *apiv1.CredentialRequest) (*apiv1_issuer.MakeSDJWTReply, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove Make in struct name?
// Build SDJWT | ||
var sdjwt *gosdjwt.SDJWT | ||
//var err error | ||
switch req.DocumentType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some duplicate code below, use factory to create generic sdjwt client depending on DocumentType?
@@ -157,7 +127,7 @@ func (c *Client) Revoke(ctx context.Context, req *RevokeRequest) (*RevokeReply, | |||
|
|||
optInsecure := grpc.WithTransportCredentials(insecure.NewCredentials()) | |||
|
|||
conn, err := grpc.Dial(c.cfg.Registry.RPCServer.Addr, optInsecure) | |||
conn, err := grpc.Dial(c.cfg.Registry.GRPCServer.Addr, optInsecure) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dial deprecated
) | ||
|
||
// MakeSDJWT creates an sd-jwt and return it, else error | ||
func (s *Service) MakeSDJWT(ctx context.Context, in *apiv1_issuer.MakeSDJWTRequest) (*apiv1_issuer.MakeSDJWTReply, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in --> req?
// RPCServer holds the rpc configuration | ||
type RPCServer struct { | ||
// GRPCServer holds the rpc configuration | ||
type GRPCServer struct { | ||
Addr string `yaml:"addr" validate:"required"` | ||
Insecure bool `yaml:"insecure"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Insecure --> Secure (more easy to read and understand) but usage must also be switched then?
|
||
option go_package = "vc/internal/gen/issuer/apiv1.issuer"; | ||
|
||
import "google/protobuf/timestamp.proto"; | ||
import "v1-status-model.proto"; | ||
//import "google/protobuf/timestamp.proto"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused imports
for issuance of sdjwt credential.