Skip to content

Commit b6321d2

Browse files
committed
Use ZKP in instead of generic names
1 parent 0751fda commit b6321d2

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

internal/verifier/apiv1/handlers_verification.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ import (
1212
"vc/pkg/openid4vp"
1313
"vc/pkg/sdjwtvc"
1414

15+
"encoding/hex"
1516
"github.com/google/uuid"
1617
"github.com/lestrrat-go/jwx/v3/jwa"
1718
"github.com/lestrrat-go/jwx/v3/jwe"
18-
19-
"encoding/hex"
20-
"vc/internal/verifier/zk"
21-
19+
"proofs/server/v2/zk"
2220
)
2321

2422
type VerificationRequestObjectRequest struct {
@@ -246,7 +244,7 @@ type VerificationCallbackResponse struct {
246244
CredentialData []sdjwtvc.CredentialCache `json:"credential_data"`
247245
}
248246

249-
type VerifyRequest struct {
247+
type VerifyZKPRequest struct {
250248
Transcript string `json:"Transcript"`
251249
ZKDeviceResponseCBOR string `json:"ZKDeviceResponseCBOR"`
252250
}
@@ -256,7 +254,7 @@ type ClaimElement struct {
256254
ElementValue string `json:"ElementValue"`
257255
}
258256

259-
type VerifyResponse struct {
257+
type VerifyZKPResponse struct {
260258
Status bool `json:"Status"`
261259
Claims map[string][]ClaimElement `json:"Claims"`
262260
}
@@ -276,7 +274,7 @@ func (c *Client) VerificationCallback(ctx context.Context, req *VerificationCall
276274
return reply, nil
277275
}
278276

279-
func (c *Client) Verify(ctx context.Context, req *VerifyRequest) (*VerifyResponse, error) {
277+
func (c *Client) VerifyZKP(ctx context.Context, req *VerifyZKPRequest) (*VerifyZKPResponse, error) {
280278
c.log.Debug("Processing ZK Proof", "transcript_len", len(req.Transcript))
281279
transcriptBytes, err := base64.StdEncoding.DecodeString(req.Transcript)
282280
if err != nil {
@@ -311,7 +309,7 @@ func (c *Client) Verify(ctx context.Context, req *VerifyRequest) (*VerifyRespons
311309
}
312310

313311
//TODO: support more vc types
314-
reply := &VerifyResponse{
312+
reply := &VerifyZKPResponse{
315313
Status: ok,
316314
Claims: map[string][]ClaimElement{
317315
"org.iso.18013.5.1": apiClaims,
@@ -323,4 +321,4 @@ func (c *Client) Verify(ctx context.Context, req *VerifyRequest) (*VerifyRespons
323321
}
324322

325323
return reply, nil
326-
}
324+
}

internal/verifier/httpserver/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type Apiv1 interface {
1919
VerificationRequestObject(ctx context.Context, req *apiv1.VerificationRequestObjectRequest) (string, error)
2020
VerificationDirectPost(ctx context.Context, req *apiv1.VerificationDirectPostRequest) (*apiv1.VerificationDirectPostResponse, error)
2121
VerificationCallback(ctx context.Context, req *apiv1.VerificationCallbackRequest) (*apiv1.VerificationCallbackResponse, error)
22-
Verify(ctx context.Context, req *apiv1.VerifyRequest) (*apiv1.VerifyResponse, error)
22+
VerifyZKP(ctx context.Context, req *apiv1.VerifyZKPRequest) (*apiv1.VerifyZKPResponse, error)
2323

2424
// UI
2525
UIInteraction(ctx context.Context, req *apiv1.UIInteractionRequest) (*apiv1.UIInteractionReply, error)

internal/verifier/httpserver/endpoint_verification.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ func (s *Service) endpointVerificationCallback(ctx context.Context, c *gin.Conte
6767
return nil, nil
6868
}
6969

70-
func (s *Service) endpointVerify(ctx context.Context, c *gin.Context) (any, error) {
70+
func (s *Service) endpointVerifyZKP(ctx context.Context, c *gin.Context) (any, error) {
7171
s.log.Debug("endpointVerificationDirectPost called")
7272
c.Request.Body = http.MaxBytesReader(c.Writer, c.Request.Body, 2*1024*1024)
73-
request := &apiv1.VerifyRequest{}
73+
request := &apiv1.VerifyZKPRequest{}
7474
if err := s.httpHelpers.Binding.Request(ctx, c, request); err != nil {
7575
s.log.Error(err, "binding failed")
7676
return nil, err
7777
}
78-
reply, err := s.apiv1.Verify(ctx, request)
78+
reply, err := s.apiv1.VerifyZKP(ctx, request)
7979
if err != nil {
8080
return nil, err
8181
}
8282

8383
return reply, nil
84-
}
84+
}

internal/verifier/httpserver/service.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ func New(ctx context.Context, cfg *model.Cfg, apiv1 *apiv1.Client, notify *notif
5555
notify: notify,
5656
tracer: tracer,
5757
server: &http.Server{
58-
ReadHeaderTimeout: 300 * time.Second,
59-
ReadTimeout: 300 * time.Second,
58+
ReadHeaderTimeout: 300 * time.Second,
59+
ReadTimeout: 300 * time.Second,
6060
WriteTimeout: 300 * time.Second,
61-
IdleTimeout: 300 * time.Second,
61+
IdleTimeout: 300 * time.Second,
6262
},
6363
sessionsName: "verifier_user_session",
6464
tokenLimiter: middleware.NewRateLimiter(rateLimitConfig.TokenRequestsPerMinute, rateLimitConfig.TokenBurst),
@@ -200,8 +200,8 @@ func New(ctx context.Context, cfg *model.Cfg, apiv1 *apiv1.Client, notify *notif
200200
s.httpHelpers.Server.RegEndpoint(ctx, rgOIDCVerification, http.MethodPost, "confirm/:session_id", http.StatusOK, s.endpointConfirmCredentialDisplay)
201201

202202
// Longfellow-zk verifier
203-
s.httpHelpers.Server.RegEndpoint(ctx, rgOIDCVerification, http.MethodPost, "verify", http.StatusOK, s.endpointVerify)
204-
203+
s.httpHelpers.Server.RegEndpoint(ctx, rgOIDCVerification, http.MethodPost, "verifyzkp", http.StatusOK, s.endpointVerifyZKP)
204+
205205
// UI Endpoints
206206
s.httpHelpers.Server.RegEndpoint(ctx, rgRoot, http.MethodGet, "qr/:session_id", http.StatusOK, s.endpointQRCode)
207207
// TODO(masv): no polling, use WebSocket or Server-Sent Events instead

0 commit comments

Comments
 (0)