Skip to content

Commit

Permalink
Align with dhstore http api
Browse files Browse the repository at this point in the history
  • Loading branch information
ischasny committed Jan 16, 2023
1 parent 2ee0775 commit ff6fb7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions api/v0/finder/client/http/dhash_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions api/v0/finder/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ff6fb7e

Please sign in to comment.