Trough CloudScript I'm trying to connect to Amazon S3, but I have trouble signing my reuqest because I can't use Javascript methods to create SHA-256 hash, is there any workaround? can I link external libraries?
Trough CloudScript I'm trying to connect to Amazon S3, but I have trouble signing my reuqest because I can't use Javascript methods to create SHA-256 hash, is there any workaround? can I link external libraries?
Thanks - that's extremely helpful.
So to be clear, then - you have an S3 bucket to which you're writing custom data from each client. At certain points in gameplay, you want the client to be able to query for the list of games which are specific to that player, presumably so that you can give the player the ability to review past games. And since the signature requires your secret key, this really isn't something you can do on the client.
I was hoping to use the specifics to find an alternate workaround for you, but I can see you've already given this plenty of thought. Right now, Cloud Script does not include the crypto-js (or similar) library, so SHA256 hashing isn't really possible using that route. Just as importantly though, Cloud Script is designed for relatively simple operations - hence, the limits on processing time, script size, and input properties.
We're looking into a C# option for custom hosted logic which may provide a broader range of capabilities as well as the ability to manage deeper logic. But right now, in order to enable a full game playback system (and for others, this would apply to a UGC system as well, since that's a fairly common case), your best bet would be to use a custom game server. We have an example framework for a server that you can download and use in our GitHub, in case you need that as a starting point: https://github.com/PlayFab/PlayFabGameServer
[Edit]
Actually, I don't know why this didn't occur to me when I wrote the above - what you're doing is getting a content list for an individual user, and then providing that content. So why not solve this by storing the information on the content that belongs to the user in their User Data (Read Only or Internal, if you need to, returning that via Cloud Script), and then use our Content service for delivery of the actual S3 content? That way, the signature that is required for the download is secured by our secret key and there's no need for you to compute any of that in Cloud Script.
Can you give us a bit more context, so that we have a clear picture of what the actual goal is? In general, you would not read from S3 into Cloud Script, as the main use case for S3 is the storage of larger data sets - not something that would really be compatible with Cloud Script, as it's intended for simple logic on smaller data sets - hence the limits you'll see in the Limits tab of the Add-ons Marketplace for Cloud Script.
I need to connect to an external S3 storage to read an write some file using Amazon Rest API, my issue is related to authentication process where I need to create SHA-256 hash keys in order to connect, but any JavaScript method to do so (Base64, Crypto) doesn't work.
Understood - sorry, I meant can you please provide context on the feature you're attempting to enable? How much data is it intended to read from S3? What is the data in question and how is it going to be used in the game? What I'd like to do is start from a top-down approach, understanding first your actual goal before proceeding with the implementation details. That way, I can try to identify any alternatives.
The flow is:
Every replay file is a json of very few KB (from 5 up to 15).
No one has followed this question yet.