Skip to content

Commit

Permalink
fix: reuse existing verifiable constants
Browse files Browse the repository at this point in the history
  • Loading branch information
martinsaporiti committed Jun 26, 2024
1 parent 2b33e22 commit bf6679c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions api/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion internal/api/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions internal/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit bf6679c

Please sign in to comment.