Skip to content

Commit

Permalink
refactor: corrected signature verification function name of BbsBlsSig…
Browse files Browse the repository at this point in the history
…nature2020
  • Loading branch information
arnabghose997 committed Sep 25, 2023
1 parent e7f86b5 commit 5c8f53b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions cmd/hid-noded/cmd/debug_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func signSchemaDocCmd() *cobra.Command {
return err
}
case types.BbsBlsSignature2020:
signature, err = hidnodecli.GetBBSSignature(argPrivateKey, schemaDocBytes)
signature, err = hidnodecli.GetBbsBlsSignature2020(argPrivateKey, schemaDocBytes)
if err != nil {
return err
}
Expand All @@ -353,7 +353,7 @@ func signSchemaDocCmd() *cobra.Command {
return err
}
default:
panic("recieved unsupported signing-algo. Supported algorithms are: ['ed25519', 'secp256k1', 'recover-eth', 'bbs', 'bjj']")
panic("recieved unsupported signing-algo. Supported algorithms are: [Ed25519Signature2020, EcdsaSecp256k1Signature2019, EcdsaSecp256k1RecoverySignature2020, BbsBlsSignature2020, 'bjj']")
}

_, err = fmt.Fprintln(cmd.OutOrStdout(), signature)
Expand Down Expand Up @@ -405,7 +405,7 @@ func signCredStatusDocCmd() *cobra.Command {
return err
}
case types.BbsBlsSignature2020:
signature, err = hidnodecli.GetBBSSignature(argPrivateKey, credStatusDocBytes)
signature, err = hidnodecli.GetBbsBlsSignature2020(argPrivateKey, credStatusDocBytes)
if err != nil {
return err
}
Expand All @@ -415,7 +415,7 @@ func signCredStatusDocCmd() *cobra.Command {
return err
}
default:
panic("recieved unsupported signing-algo. Supported algorithms are: ['ed25519', 'secp256k1', 'recover-eth', 'bbs', 'bjj']")
panic("recieved unsupported signing-algo. Supported algorithms are: [Ed25519Signature2020, EcdsaSecp256k1Signature2019, EcdsaSecp256k1RecoverySignature2020, BbsBlsSignature2020, 'bjj']")
}

_, err = fmt.Fprintln(cmd.OutOrStdout(), signature)
Expand Down
6 changes: 3 additions & 3 deletions x/ssi/client/cli/tx_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func extractDIDSigningElements(cmdArgs []string) ([]DIDSigningElements, error) {
return didSigningElementsList, nil
}

// GetBBSSignature signs a message and returns a BBS signature
func GetBBSSignature(privateKey string, message []byte) (string, error) {
// GetBbsBlsSignature2020 signs a message and returns a BBS signature
func GetBbsBlsSignature2020(privateKey string, message []byte) (string, error) {
privKeyBytes, err := base64.StdEncoding.DecodeString(privateKey)
if err != nil {
panic(err)
Expand Down Expand Up @@ -200,7 +200,7 @@ func getSignatures(cmd *cobra.Command, didDoc *types.Did, cmdArgs []string) ([]*
return nil, err
}

signInfoList[i].Signature, err = GetBBSSignature(didSigningElementsList[i].SignKey, didDocBytes)
signInfoList[i].Signature, err = GetBbsBlsSignature2020(didSigningElementsList[i].SignKey, didDocBytes)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions x/ssi/verification/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func verify(extendedVm *types.ExtendedVerificationMethod, ssiMsg types.SsiMsg) e
case types.X25519KeyAgreementKeyEIP5630:
return verifyX25519KeyAgreementKeyEIP5630Key(extendedVm)
case types.Bls12381G2Key2020:
return verifyBls12381G2Key2020Key(extendedVm, docBytes)
return verifyBbsBlsSignature2020(extendedVm, docBytes)
case types.BabyJubJubVerificationKey2023:
return verifyBabyJubJubVerificationKey2023Key(extendedVm, docBytes)
default:
Expand Down Expand Up @@ -121,8 +121,8 @@ func verifyBabyJubJubVerificationKey2023Key(extendedVm *types.ExtendedVerificati
return nil
}

// verifyBls12381G2Key2020Key verifies the verification key for verification method type Bls12381G2Key2020
func verifyBls12381G2Key2020Key(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error {
// verifyBbsBlsSignature2020 verifies the verification key for verification method type BbsBlsSignature2020
func verifyBbsBlsSignature2020(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error {
bbsObj := bbs.New()

// Unlike in tranditional cryptographic algorithms where a message is signed as-is, the message in BBS+ Signature
Expand Down

0 comments on commit 5c8f53b

Please sign in to comment.