Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Paul Le Cam
    @PaulLeCam
    You’ll need to use the manifestHash of the existing resource, and the path you want to upload to
    Nadeem Bhati
    @nadeemb53
    @PaulLeCam okay, thank you :)
    It worked!
    Nadeem Bhati
    @nadeemb53
    Hi, can I query downloadDirectoryData to return data structure of a particular directory?
    Like here, I only want to print the files inside users directory:
    {
    "list": [
    "sample.json",
    "users/favourites/fav1.csv",
    "users/favourites/fav2.csv",
    "users/sample.json",
    "users/user1.json",
    "users/user2.json"
    ]
    }
    Passing path with hash didn't seem to work here
    Nadeem Bhati
    @nadeemb53
    nevermind, wrote a function to parse object for specific folder path
    Paul Le Cam
    @PaulLeCam
    If you want to list the contents of the manifest you can user the list() method, and the path option to only list entries in a specific folder: https://erebos.js.org/docs/api-bzz#list
    Nadeem Bhati
    @nadeemb53
    I am unable to use createFeedDigest API. I get this response: client.bzz.createFeedDigest is not a function
    Nadeem Bhati
    @nadeemb53
    The createFeedDigest() and createKeyPair() functions have been removed from the @erebos/api-bzz-base and @erebos/swarm packages.
    Okay
    Paul Le Cam
    @PaulLeCam
    createFeedDigest() is a function exported by @erebos/api-bzz-base, not a method of the Bzz class, and createKeyPair() is a function exported by the @erebos/secp256k1 package, as documented here: https://erebos.js.org/docs/secp256k1#createkeypair
    Nadeem Bhati
    @nadeemb53
    @PaulLeCam Thanks!
    Nadeem Bhati
    @nadeemb53
    Hi, how can I download a directory as Tar? I tried setting contentType to application/x-tar and application/zip using downloadTo API, but directory is downloaded as it is. Do I need to set it up such that it's zipped after getting downloaded?
    Thanks again for your help!
    Paul Le Cam
    @PaulLeCam
    Hi, to do this you need to set the accept header in the options so Swarm returns the tar file rather than the manifest, ex: bzz.downloadFileTo('<swarm hash>', '/path/to/archive.tar', {headers: {accept: 'application/x-tar'}})
    Nadeem Bhati
    @nadeemb53
    I tried it, but the files in manifest are downloaded, not the tar
    downloadTarRouter.route('/:hash/:localpath')
    .get((req,res,next) => {
    var localpath = req.params.localpath;
    client.bzz
    .downloadTo(req.params.hash, localpath, {headers: {accept: 'application/x-tar'}})
    .then(res.json({
    msg:'Directory successfully downloaded from swarm at '+localpath
    }))
    .catch((err) => next(err));
    });
    Paul Le Cam
    @PaulLeCam
    Is your localpath an existing file? If not, you should use downloadFileTo() explicitly, as downloadTo() checks if the destination path is a file or folder to act accordingly
    Nadeem Bhati
    @nadeemb53
    Localpath is the path of the folder I want the tar file on
    And it exist
    Paul Le Cam
    @PaulLeCam
    You need to provide a file path, not a folder one if you are downloading a single file (which is the case here with the tar).
    If you replace your client.bzz.downloadTo(req.params.hash, localpath, {headers: {accept: 'application/x-tar'}}) by client.bzz.downloadFileTo(req.params.hash, localpath + '/' + req.params.hash + '.tar', {headers: {accept: 'application/x-tar'}}) for example I think you should get the behaviour you’re looking for
    Nadeem Bhati
    @nadeemb53
    Okay, great. Let me try this out
    Yes, it works!
    Paul Le Cam
    @PaulLeCam
    Nice!
    Nadeem Bhati
    @nadeemb53
    Thank you. I guess now I understood the file handling here.
    Paul Le Cam
    @PaulLeCam
    You’re welcome! Yes it’s a bit tricky with the mix of headers and downloading as a file, I think I’ll add a downloadTarTo() method to cover this use case in a simpler way
    Nadeem Bhati
    @nadeemb53
    Yes, that'll make things easier.
    Attila Gazso
    @agazso
    Are encrypted Timelines supported with Erebos?
    As far as I understand it's possible to use Swarm's encryption for storing the Chapters, in that case Erebos is supposed to handle the references that contain the encryption keys.
    However this is not recommended to use with gateways, because then you hand over the encryption key to the gateway, right?
    Paul Le Cam
    @PaulLeCam
    In theory it should be possible to use Swarm’s built-in encryption by setting the encrypt option (https://erebos.js.org/docs/api-bzz#uploadoptions) when adding chapters, but I’ve never used this as it’s unsafe when using a gateway
    The alternative is to handle the encryption client-side, which can be implemented relatively simply by providing the encode and/or decode functions when creating a Timeline instance: https://erebos.js.org/docs/timeline-api#timelineconfig
    This is what I’ve used in Aegle, see https://github.com/MainframeHQ/aegle/blob/master/packages/sync/src/index.ts#L167-L182 and https://github.com/MainframeHQ/aegle/blob/master/packages/sync/src/index.ts#L262-L278
    Attila Gazso
    @agazso
    thanks!
    thecryptofruit
    @thecryptofruit
    Hi all ... just curious, anybody from erebos team coming to Berlin blockchain week next week?
    Paul Le Cam
    @PaulLeCam
    Hi, no we’re not attending this one, but some of us will be in Osaka for Devcon 5
    thecryptofruit
    @thecryptofruit
    Public API uploadFile() seems to work without providing contentType, however when calling node-specific uploadFileFrom() without it, I get Bad Request. Is that as expected? Took me awhile :)
    Paul Le Cam
    @PaulLeCam
    I think it’s a limitation from Swarm as there’s not specific logic in Erebos related to this. If you provide the content-length header it works, I’ll ask why it’s required for bzz-raw: but not bzz:
    Attila Gazso
    @agazso
    when using the client side encryption, are the references (that are stored in the feeds) encrypted?
    Paul Le Cam
    @PaulLeCam
    @agazso sorry not sure what you mean? Erebos itself doesn’t handle client-side encryption, at most it allows to provide custom encoding and decoding functions (for the Timeline), that the consumer can use to implement the necessary logic
    Attila Gazso
    @agazso
    ok, so by providing encoding to the Timeline I can encrpyt either the content in the Chapter or the Chapter itself?
    Paul Le Cam
    @PaulLeCam
    yes the encoding function gets the full chapter JSON, so you can encrypt only the content and leave the metadata in clear text or you can encrypt the entire chapter, as long as you have a matching decoding function able to handle it and provide the full chapter back to the Timeline instance
    Attila Gazso
    @agazso
    the Timeline is not doing an encoding after this, it just uploads the (possibly encrypted) chapter and stores the hash in the feed, right?
    Paul Le Cam
    @PaulLeCam
    yes exactly
    Attila Gazso
    @agazso
    thanks!
    Paul Le Cam
    @PaulLeCam
    you’re welcome!
    Attila Gazso
    @agazso
    btw I saw that last week you merged in the React Native specific changes, so it means we can start integrating Erebos to the Felfele app
    We are planning to do it after our next release, but in the meanwhile I am trying to implement things in a way that will be compatible with Timelines for example, that's why I'm asking these questions
    Paul Le Cam
    @PaulLeCam
    That’s great! Yes don’t hesitate to ask here!
    Attila Gazso
    @agazso
    I have some questions regarding the type definition of the Timeline. There is a hexValue type and uploading to BZZ returns this type. However the type of previous, id and references is string and not this type. What's the rationale behind this?
    Also what is author supposed to be? I'm storing the user of the feed in it, is that correct?
    Paul Le Cam
    @PaulLeCam
    Hey sorry I've been off since last week. The Timeline APIs use string because that's how it got defined in the spec, but I agree the implementation could use hexValue instead.
    Paul Le Cam
    @PaulLeCam
    The author could be the feed user yes but I imagine it could also be whoever authored the content, for example Bob could post a Chapter on behalf of Alice I suppose. @jpeletier might have other ideas for additional use cases related to EtherGit.