Update Overlay Message to use Explictly Hex Encoded Strings
This commit is contained in:
parent
ade5f944b3
commit
9bff4cef26
|
@ -6,6 +6,7 @@ import (
|
||||||
"cwtch.im/cwtch/model/attr"
|
"cwtch.im/cwtch/model/attr"
|
||||||
"cwtch.im/cwtch/peer"
|
"cwtch.im/cwtch/peer"
|
||||||
"cwtch.im/cwtch/protocol/files"
|
"cwtch.im/cwtch/protocol/files"
|
||||||
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -32,8 +33,8 @@ func FunctionalityGate(experimentMap map[string]bool) (*Functionality, error) {
|
||||||
// This is the format that the UI will parse to display the message
|
// This is the format that the UI will parse to display the message
|
||||||
type OverlayMessage struct {
|
type OverlayMessage struct {
|
||||||
Name string `json:"f"`
|
Name string `json:"f"`
|
||||||
Hash []byte `json:"h"`
|
Hash string `json:"h"`
|
||||||
Nonce []byte `json:"n"`
|
Nonce string `json:"n"`
|
||||||
Size uint64 `json:"s"`
|
Size uint64 `json:"s"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,10 +59,11 @@ func (f *Functionality) ShareFile(filepath string, profile peer.CwtchPeer, handl
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message := OverlayMessage{
|
message := OverlayMessage{
|
||||||
Name: path.Base(manifest.FileName),
|
Name: path.Base(manifest.FileName),
|
||||||
Hash: manifest.RootHash,
|
Hash: hex.EncodeToString(manifest.RootHash),
|
||||||
Nonce: nonce[:],
|
Nonce: hex.EncodeToString(nonce[:]),
|
||||||
Size: manifest.FileSizeInBytes,
|
Size: manifest.FileSizeInBytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue