From bf6679c6bcb44f9982f2665e3bbbdb2b8ed377c3 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Wed, 26 Jun 2024 08:36:51 -0300 Subject: [PATCH] fix: reuse existing verifiable constants --- api/api.yaml | 4 ++-- internal/api/api.gen.go | 2 +- internal/api/server.go | 7 ++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/api/api.yaml b/api/api.yaml index 851264fa7..c2554d359 100644 --- a/api/api.yaml +++ b/api/api.yaml @@ -680,8 +680,8 @@ components: items: type: string x-omitempty: false - example: "BJJSignatureProof2021" - enum: [ BJJSignatureProof2021, Iden3SparseMerkleTreeProof] + example: "BJJSignature2021" + enum: [ BJJSignature2021, Iden3SparseMerkleTreeProof] example: credentialSchema: "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" type: "KYCAgeCredential" diff --git a/internal/api/api.gen.go b/internal/api/api.gen.go index f4196fc3b..86951c7df 100644 --- a/internal/api/api.gen.go +++ b/internal/api/api.gen.go @@ -23,7 +23,7 @@ const ( // Defines values for CreateClaimRequestProofs. const ( - BJJSignatureProof2021 CreateClaimRequestProofs = "BJJSignatureProof2021" + BJJSignature2021 CreateClaimRequestProofs = "BJJSignature2021" Iden3SparseMerkleTreeProof CreateClaimRequestProofs = "Iden3SparseMerkleTreeProof" ) diff --git a/internal/api/server.go b/internal/api/server.go index 72d0ddb94..0b35502e5 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -151,9 +151,6 @@ func (s *Server) CreateIdentity(ctx context.Context, request CreateIdentityReque // CreateClaim is claim creation controller func (s *Server) CreateClaim(ctx context.Context, request CreateClaimRequestObject) (CreateClaimResponseObject, error) { - const BJJSignatureProof2021 = "BJJSignatureProof2021" - const Iden3SparseMerkleTreeProof = "Iden3SparseMerkleTreeProof" - did, err := w3c.ParseDID(request.Identifier) if err != nil { return CreateClaim400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil @@ -169,11 +166,11 @@ func (s *Server) CreateClaim(ctx context.Context, request CreateClaimRequestObje claimRequestProofs.Iden3SparseMerkleTreeProof = true } else { for _, proof := range *request.Body.Proofs { - if string(proof) == BJJSignatureProof2021 { + if string(proof) == string(verifiable.BJJSignatureProofType) { claimRequestProofs.BJJSignatureProof2021 = true continue } - if string(proof) == Iden3SparseMerkleTreeProof { + if string(proof) == string(verifiable.Iden3SparseMerkleTreeProofType) { claimRequestProofs.Iden3SparseMerkleTreeProof = true continue }