async sign(event, data) {
let input = {
SessionId: this.state.added_session_id,
SessionStatus: this.state.added_session_status,
Hash: this.state.added_file_hash,
Unsigned: data,
TimeNonce: this.time,
PrivKey: config.PrivKey,
PeerID: config.PeerID
}
const signResponse = this.btfs.sign(input, {})
try {
for await (const response of signResponse) {
}
} catch (err) {
console.error(err)
}
}
// Usage:
sessionId, err := s.StorageUploadOffSign(hash, uts)
// Go Wrapper:
func (s *Shell) StorageUploadOffSign(hash string, uts string, options ...StorageUploadOpts) (string, error) {
var out storageUploadResponse
offlinePeerSessionSignature, err := NewSessionSignature(hash, utils.GetPeerId(), uts, false)
if err != nil {
return "", err
}
rb := s.Request("storage/upload/offline", hash, utils.GetPeerId(), uts, offlinePeerSessionSignature)
for _, option := range options {
_ = option(rb)
}
return out.ID, rb.Exec(context.Background(), &out)
}
curl -X POST "http://localhost:5001/api/v1/storage/upload?arg=QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCf7b&price=750000&storage-length=35"