From 13fb29c8303be59c9c5168208141bb452379bd34 Mon Sep 17 00:00:00 2001 From: Jean Date: Sat, 30 Mar 2024 11:56:44 +0100 Subject: [PATCH] fix lint warning --- server/test/admin/smc.go | 8 +- server/test/user/database.go | 140 +++++++++++++++++------------------ 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/server/test/admin/smc.go b/server/test/admin/smc.go index af7ec085..023b618d 100644 --- a/server/test/admin/smc.go +++ b/server/test/admin/smc.go @@ -55,9 +55,9 @@ func encodePublickey(pk kyber.Point) string { return hex.EncodeToString(pkbuff) } -func encodeSecret(secret []byte) string { - return hex.EncodeToString(secret) -} +// func encodeSecret(secret []byte) string { +// return hex.EncodeToString(secret) +// } func decodeReencrypted(xhatencstring string) (kyber.Point, error) { xhatencbuff, err := hex.DecodeString(xhatencstring) @@ -65,7 +65,7 @@ func decodeReencrypted(xhatencstring string) (kyber.Point, error) { return nil, err } - var xhatenc kyber.Point + xhatenc := suite.Point() err = xhatenc.UnmarshalBinary(xhatencbuff) if err != nil { return nil, err diff --git a/server/test/user/database.go b/server/test/user/database.go index 6ffdc026..e932ae07 100644 --- a/server/test/user/database.go +++ b/server/test/user/database.go @@ -150,76 +150,76 @@ func RegistrationDelete(docid registry.RegistrationID) error { // --------------------------------------------------------------------------- // The following functions are used to encrypt and decrypt the registration -func encryptRegistrationData(data registry.RegistrationData, symKey []byte) ( - registry.EncryptedData, - error, -) { - // Convert the struct to a byte array - buf := new(bytes.Buffer) - - // encrypt the data.Name - err := binary.Write(buf, binary.LittleEndian, data.Name) - if err != nil { - return registry.EncryptedData{}, err - } - - encName, err := key.Encrypt(symKey, buf.Bytes()) - if err != nil { - return registry.EncryptedData{}, err - } - - // encrypt the data.Passport - err = binary.Write(buf, binary.LittleEndian, data.Name) - if err != nil { - return registry.EncryptedData{}, err - } - - encPassport, err := key.Encrypt(symKey, buf.Bytes()) - if err != nil { - return registry.EncryptedData{}, err - } - - // encrypt the data.Role - err = binary.Write(buf, binary.LittleEndian, data.Role) - if err != nil { - return registry.EncryptedData{}, err - } - - encRole, err := key.Encrypt(symKey, buf.Bytes()) - if err != nil { - return registry.EncryptedData{}, err - } - - // encrypt the data.Picture - err = binary.Write(buf, binary.LittleEndian, data.Picture) - if err != nil { - return registry.EncryptedData{}, err - } - - encPicture, err := key.Encrypt(symKey, buf.Bytes()) - if err != nil { - return registry.EncryptedData{}, err - } - - // encrypt the data.Registered - err = binary.Write(buf, binary.LittleEndian, data.Registered) - if err != nil { - return registry.EncryptedData{}, err - } - - encRegistered, err := key.Encrypt(symKey, buf.Bytes()) - if err != nil { - return registry.EncryptedData{}, err - } - - return registry.EncryptedData{ - Name: encName, - Passport: encPassport, - Picture: encPicture, - Role: encRole, - Registered: encRegistered, - }, nil -} +// func encryptRegistrationData(data registry.RegistrationData, symKey []byte) ( +// registry.EncryptedData, +// error, +// ) { +// // Convert the struct to a byte array +// buf := new(bytes.Buffer) +// +// // encrypt the data.Name +// err := binary.Write(buf, binary.LittleEndian, data.Name) +// if err != nil { +// return registry.EncryptedData{}, err +// } +// +// encName, err := key.Encrypt(symKey, buf.Bytes()) +// if err != nil { +// return registry.EncryptedData{}, err +// } +// +// // encrypt the data.Passport +// err = binary.Write(buf, binary.LittleEndian, data.Name) +// if err != nil { +// return registry.EncryptedData{}, err +// } +// +// encPassport, err := key.Encrypt(symKey, buf.Bytes()) +// if err != nil { +// return registry.EncryptedData{}, err +// } +// +// // encrypt the data.Role +// err = binary.Write(buf, binary.LittleEndian, data.Role) +// if err != nil { +// return registry.EncryptedData{}, err +// } +// +// encRole, err := key.Encrypt(symKey, buf.Bytes()) +// if err != nil { +// return registry.EncryptedData{}, err +// } +// +// // encrypt the data.Picture +// err = binary.Write(buf, binary.LittleEndian, data.Picture) +// if err != nil { +// return registry.EncryptedData{}, err +// } +// +// encPicture, err := key.Encrypt(symKey, buf.Bytes()) +// if err != nil { +// return registry.EncryptedData{}, err +// } +// +// // encrypt the data.Registered +// err = binary.Write(buf, binary.LittleEndian, data.Registered) +// if err != nil { +// return registry.EncryptedData{}, err +// } +// +// encRegistered, err := key.Encrypt(symKey, buf.Bytes()) +// if err != nil { +// return registry.EncryptedData{}, err +// } +// +// return registry.EncryptedData{ +// Name: encName, +// Passport: encPassport, +// Picture: encPicture, +// Role: encRole, +// Registered: encRegistered, +// }, nil +// } func decryptRegistrationData(encrypted registry.EncryptedData, symKey []byte) ( registry.RegistrationData,