From ff6fb7e515a736627a7adf345fcac8e7c82b9a25 Mon Sep 17 00:00:00 2001 From: Ivan Schasny Date: Mon, 16 Jan 2023 12:38:50 +0000 Subject: [PATCH] Align with dhstore http api --- api/v0/finder/client/http/dhash_client.go | 4 ++-- api/v0/finder/model/model.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/v0/finder/client/http/dhash_client.go b/api/v0/finder/client/http/dhash_client.go index 4aea311d2..e571ab363 100644 --- a/api/v0/finder/client/http/dhash_client.go +++ b/api/v0/finder/client/http/dhash_client.go @@ -84,7 +84,7 @@ func (c *DHashClient) decryptFindResponse(ctx context.Context, resp *model.FindR // decrypt each value key using the original multihash // then for each decrypted value key fetch provider's addr info - for _, encRes := range resp.EncMultihashResults { + for _, encRes := range resp.EncryptedMultihashResults { mh, found := unhasher[encRes.Multihash.B58String()] if !found { continue @@ -93,7 +93,7 @@ func (c *DHashClient) decryptFindResponse(ctx context.Context, resp *model.FindR mhr := model.MultihashResult{ Multihash: mh, } - for _, evk := range encRes.ValueKeys { + for _, evk := range encRes.EncryptedValueKeys { vk, err := dhash.DecryptValueKey(evk, mh) if err != nil { return err diff --git a/api/v0/finder/model/model.go b/api/v0/finder/model/model.go index fcfcb2229..697bfadc5 100644 --- a/api/v0/finder/model/model.go +++ b/api/v0/finder/model/model.go @@ -34,16 +34,16 @@ type MultihashResult struct { // FindResponse used to answer client queries/requests type FindResponse struct { - MultihashResults []MultihashResult - EncMultihashResults []EncMultihashResult + MultihashResults []MultihashResult + EncryptedMultihashResults []EncryptedMultihashResult // NOTE: This feature is not enabled yet. // Signature []byte // Providers signature. } -// EncMultihashResult aggregates all encrypted value keys for a single multihash -type EncMultihashResult struct { - Multihash multihash.Multihash - ValueKeys [][]byte +// EncryptedMultihashResult aggregates all encrypted value keys for a single multihash +type EncryptedMultihashResult struct { + Multihash multihash.Multihash + EncryptedValueKeys [][]byte } // Equal compares ProviderResult values to determine if they are equal. The