Giter VIP home page Giter VIP logo

Comments (5)

benjreinhart avatar benjreinhart commented on September 26, 2024

I'm not sure for react specifically, though there are plenty solutions for uploading via web, including Amazon's own client.

This could be extended for the web fairly easily, but I don't have plans to do so at the moment.

from react-native-aws3.

kennetpostigo avatar kennetpostigo commented on September 26, 2024

@benjreinhart if you give me some information about what needs to be extended in the library I will gladly submit a PR as using one lib for both web and native clients would be great. Also great job on this library!

from react-native-aws3.

benjreinhart avatar benjreinhart commented on September 26, 2024

@kennetpostigo I might be missing some things but here is my initial high-level thoughts. For web, I think it'd be pretty easy since we should not be generating signed urls on the client because that would require us to have the IAM user's secret key on the client. So I believe we may need the following features:

  • Support for passing in a pre-signed URL. As @joonhocho pointed out in #3, it is not a good idea to be passing secret keys to clients. This is especially true on web where it is trivial to inspect source and find any information like secret keys if they were passed down to the client either in the JS or HTML. However, this would have to be optional because, for now at least, I'd still like to be able to generate the signed urls on the client in React Native. I may change my mind on this going forward.
  • Would need to consider how far back you want to go with browser support. I'd be inclined to say ignore this, especially for now. Also, the code, as it exists, would probably be mostly compatible with most versions of major browsers but I'm not sure what methods I'm using that may not be available in all versions of all browsers.
  • In addition to the point above, we'd need some build step and have a compiled version of the JS since browsers most definitely do not have full on ES6 support.

I'm guessing I'm missing something but that's what comes to mind.

from react-native-aws3.

joonhocho avatar joonhocho commented on September 26, 2024

@kennetpostigo, I am currently using the following repos on my project.
https://github.com/joonhocho/s3-policy-middleware
https://github.com/joonhocho/s3-policy-v4

I created these repos to generate s3 policy on the server side on Node.js.
s3-policy-v4 is a simply refactored clone of react-native-aws3/src/S3Policy.js (thanks to @benjreinhart).

If you are using express, you can use s3-policy-middleware, which is a simple middleware wrapper around s3-policy-v4.
If you are using node.js, but not express, then you can use s3-policy-v4 and create an endpoint yourself.

On the client side, you need to post to the endpoint with name and contentType (if you are using s3-policy-middleware), and you will receive the policy back in json format.

Then, you need to use the signed url that you receive with the policy to upload to s3 directly on the client side.
I also have some code to upload to s3 using XMLHttpRequest which is available both on react native and web, but I haven't open sourced it yet.
I will do it soon when I get some free time.

from react-native-aws3.

kennetpostigo avatar kennetpostigo commented on September 26, 2024

@benjreinhart Thanks for the information. I'll see if I can whip something up on my spare time.

from react-native-aws3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.