Upstream sync
This commit is contained in:
@@ -46,7 +46,16 @@ func SaveDeviceInfo(c *gin.Context) {
|
||||
|
||||
if deviceContract.Status == models.ContractStatusActive {
|
||||
deviceInfoBytes, _ := json.Marshal(deviceInfo)
|
||||
deviceInfoEncryptedStr, err := shared.NewEncryptionClient(config.AppConfig.Service.BlockchainSecret).Encrypt(string(deviceInfoBytes))
|
||||
if deviceContract.BlockchainSecret == "" {
|
||||
deviceContract.BlockchainSecret = shared.GenerateRandomString(BlockchainSecretLength)
|
||||
_, _, err := contract.UpdateContract(deviceContract)
|
||||
if err != nil {
|
||||
log.Printf("SaveDeviceInfo Update Contract error: %v", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Could not update contract secret"})
|
||||
return
|
||||
}
|
||||
}
|
||||
deviceInfoEncryptedStr, err := shared.NewEncryptionClient(deviceContract.BlockchainSecret).Encrypt(string(deviceInfoBytes))
|
||||
if err != nil {
|
||||
log.Printf("SaveDeviceInfo - Enrypt error : %v", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Could not encrypt device info"})
|
||||
|
||||
Reference in New Issue
Block a user