Skip to content

Commit

Permalink
chore: update function names as per standard
Browse files Browse the repository at this point in the history
  • Loading branch information
Sashwat-K committed May 6, 2024
1 parent 1a39fdf commit 74dc262
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ func HpcrJson(plainJson string) (string, string, error) {
return gen.EncodeToBase64(plainJson), gen.GenerateSha256(plainJson), nil
}

// HpcrEncryptedtext - function to generate encrypted Hyper protect data and SHA256 from plain text
func HpcrEncryptedtext(plainText, encryptionCertificate string) (string, string, error) {
// HpcrTextEncrypted - function to generate encrypted Hyper protect data and SHA256 from plain text
func HpcrTextEncrypted(plainText, encryptionCertificate string) (string, string, error) {
if plainText == "" {
return "", "", fmt.Errorf("input text is empty")
}
return Encrypter(plainText, encryptionCertificate)
}

// HpcrEncryptedJson - function to generate encrypted hyper protect data and SHA256 from plain JSON data
func HpcrEncryptedJson(plainJson, encryptionCertificate string) (string, string, error) {
// HpcrJsonEncrypted - function to generate encrypted hyper protect data and SHA256 from plain JSON data
func HpcrJsonEncrypted(plainJson, encryptionCertificate string) (string, string, error) {
if !gen.IsJSON(plainJson) {
return "", "", fmt.Errorf("contract is not a JSON data")
}
Expand Down
12 changes: 6 additions & 6 deletions contract/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ func TestHpcrJson(t *testing.T) {
assert.Equal(t, sha256, sampleChecksumJson)
}

// Testcase to check if TestHpcrEncryptedtext() is able to encrypt text and generate SHA256
func TestHpcrEncryptedtext(t *testing.T) {
result, sha256, err := HpcrEncryptedtext(sampleStringData, "")
// Testcase to check if TestHpcrTextEncrypted() is able to encrypt text and generate SHA256
func TestHpcrTextEncrypted(t *testing.T) {
result, sha256, err := HpcrTextEncrypted(sampleStringData, "")
if err != nil {
fmt.Println(err)
}
Expand All @@ -162,9 +162,9 @@ func TestHpcrEncryptedtext(t *testing.T) {
assert.Equal(t, sha256, sampleDataChecksum)
}

// Testcase to check if TestHpcrEncryptedJson() is able to encrypt JSON and generate SHA256
func TestHpcrEncryptedJson(t *testing.T) {
result, sha256, err := HpcrEncryptedJson(sampleStringJson, "")
// Testcase to check if TestHpcrJsonEncrypted() is able to encrypt JSON and generate SHA256
func TestHpcrJsonEncrypted(t *testing.T) {
result, sha256, err := HpcrJsonEncrypted(sampleStringJson, "")
if err != nil {
fmt.Println(err)
}
Expand Down

0 comments on commit 74dc262

Please sign in to comment.