Skip to content
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

Merged
merged 3 commits into from
Sep 24, 2024

Conversation

masv3971
Copy link
Collaborator

for issuance of sdjwt credential.

@masv3971 masv3971 added this to the 0.4.0 milestone May 23, 2024
@matskramer matskramer self-requested a review May 23, 2024 12:55
Copy link
Contributor

@matskramer matskramer left a 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) {
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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 {
Copy link
Contributor

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)
Copy link
Contributor

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) {
Copy link
Contributor

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"`
Copy link
Contributor

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";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused imports

@masv3971 masv3971 merged commit b3015f8 into main Sep 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants