Skip to content

Commit

Permalink
Merge pull request #2 from AppsFlyerSDK/hmac-ascii-to-utf
Browse files Browse the repository at this point in the history
HmacSha256Digest encoding - ASCII->UTF8
  • Loading branch information
gilmor-af authored Oct 17, 2023
2 parents 38e64b6 + 4a6a264 commit 3ef2765
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Assets/AppsflyerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private string GenerateGuid()
// generate hmac auth for post requests
private string HmacSha256Digest(string message, string secret)
{
ASCIIEncoding encoding = new ASCIIEncoding();
UTF8Encoding encoding = new UTF8Encoding();
byte[] keyBytes = encoding.GetBytes(secret);
byte[] messageBytes = encoding.GetBytes(message);
System.Security.Cryptography.HMACSHA256 cryptographer =
Expand Down
6 changes: 4 additions & 2 deletions Assets/AppsflyerScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ void Start()
AppsflyerModule afm = new AppsflyerModule(DEV_KEY, APP_ID, this, IS_SANDBOX);
afm.SetCustomerUserId("testTEST12345");
afm.Start();
afm.SetCustomerUserId("testTESTNOPE");
afm.Stop();

// set event name
string event_name = "af_purchase";
Expand All @@ -25,9 +23,13 @@ void Start()
event_parameters.Add("af_currency", "USD");
event_parameters.Add("af_price", 6.66);
event_parameters.Add("af_revenue", 12.12);
event_parameters.Add("goodsName", "新人邀约购物日");
// send logEvent request
afm.LogEvent(event_name, event_parameters);

// afm.SetCustomerUserId("test-willnotwork");
// afm.Stop();

// the creation date in this example is "2023-03-23T08:30:00+00:00"
bool newerDate = afm.IsInstallOlderThanDate("2023-06-13T10:00:00+00:00");
bool olderDate = afm.IsInstallOlderThanDate("2023-02-11T10:00:00+00:00");
Expand Down

0 comments on commit 3ef2765

Please sign in to comment.