Exemple #1
0
 void RemoveAllPushNotificationsFromChannels(PubNub pubnub, string deviceId, PNPushType pnPushType)
 {
     pubnub.RemoveAllPushNotifications().DeviceID(deviceId).PushType(pnPushType).Async((result, status) => {
         Debug.Log("in RemoveAllPushNotificationsFromChannels");
         if (status.Error)
         {
             Debug.Log(string.Format("In Example, RemoveAllPushNotificationsFromChannels Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
         }
         else
         {
             Debug.Log(string.Format("DateTime {0}, In RemoveAllPushNotificationsFromChannels, result: {1}", DateTime.UtcNow, result.Message));
             Display(string.Format("RemoveAllPushNotificationsFromChannels: {0}", result.Message));
         }
     });
     pubnub.RemoveAllPushNotifications().DeviceID(deviceId).PushType(PNPushType.APNS2).Topic("a").Async((result, status) => {
         Debug.Log("in RemoveAllPushNotificationsFromChannels");
         if (status.Error)
         {
             Debug.Log(string.Format("In Example, RemoveAllPushNotificationsFromChannels Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
         }
         else
         {
             Debug.Log(string.Format("DateTime {0}, In RemoveAllPushNotificationsFromChannels, result: {1}", DateTime.UtcNow, result.Message));
             Display(string.Format("RemoveAllPushNotificationsFromChannels: {0}", result.Message));
         }
     });
 }
Exemple #2
0
 void AuditPushChannelProvisions(PubNub pubnub, string deviceId, PNPushType pnPushType)
 {
     pubnub.AuditPushChannelProvisions().DeviceID(deviceId).PushType(pnPushType).Async((result, status) => {
         Debug.Log("in AuditPushChannelProvisions");
         if (status.Error)
         {
             Debug.Log(string.Format("In Example, AuditPushChannelProvisions Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
         }
         else
         {
             Debug.Log(string.Format("DateTime {0}, In AuditPushChannelProvisions, result: {1}", DateTime.UtcNow, (result.Channels != null)?string.Join(",", result.Channels.ToArray()):""));
             Display(string.Format("AuditPushChannelProvisions: {0}", (result.Channels != null)?string.Join(",", result.Channels.ToArray()):""));
         }
     });
     pubnub.AuditPushChannelProvisions().DeviceID(deviceId).PushType(pnPushType).PushType(PNPushType.APNS2).Topic("a").Async((result, status) => {
         Debug.Log("in AuditPushChannelProvisions");
         if (status.Error)
         {
             Debug.Log(string.Format("In Example, AuditPushChannelProvisions Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
         }
         else
         {
             Debug.Log(string.Format("DateTime {0}, In AuditPushChannelProvisions, result: {1}", DateTime.UtcNow, (result.Channels != null)?string.Join(",", result.Channels.ToArray()):""));
             Display(string.Format("AuditPushChannelProvisions: {0}", (result.Channels != null)?string.Join(",", result.Channels.ToArray()):""));
         }
     });
 }
Exemple #3
0
        void Init()
        {
            Debug.Log("Starting");
            PNConfiguration pnConfiguration = new PNConfiguration();

            pnConfiguration.SubscribeKey                = "demo";
            pnConfiguration.PublishKey                  = "demo";
            pnConfiguration.SecretKey                   = "demo";
            pnConfiguration.CipherKey                   = "enigma";
            pnConfiguration.LogVerbosity                = PNLogVerbosity.BODY;
            pnConfiguration.PresenceTimeout             = 19;
            pnConfiguration.PresenceInterval            = 12;
            pnConfiguration.AuthKey                     = "authKey";
            pnConfiguration.HeartbeatNotificationOption = PNHeartbeatNotificationOption.All;

            //TODO: remove
            pnConfiguration.UUID = "PubNubUnityExample";
            Debug.Log("PNConfiguration");
            pubnub = new PubNub(pnConfiguration);

            listChannelGroups = new List <string> ()
            {
                cg1, cg2
            };
            listChannels = new List <string> ()
            {
                ch1, ch2
            };
        }
        void HandleOnTriggerDown(byte controllerId, float value)
        {
            PNConfiguration pnConfiguration = new PNConfiguration();

            pnConfiguration.PublishKey         = "pub-c-86694f64-f8a5-4dea-a382-d99cef5f71e9";
            pnConfiguration.SubscribeKey       = "sub-c-ef60f02c-80b8-11e9-bc4f-82f4a771f4c5";
            pnConfiguration.LogVerbosity       = PNLogVerbosity.BODY;
            pnConfiguration.UUID               = "MagicLeap";
            pnConfiguration.ReconnectionPolicy = PNReconnectionPolicy.LINEAR;
            PubNub pubnub = new PubNub(pnConfiguration);


            pubnub.Publish()
            .Channel("cube")
            .Message("BumperPress")
            .Async((result, status) => {
                if (!status.Error)
                {
                    Debug.Log("Bumper Press");
                }
                else
                {
                    Debug.Log(status.Error);
                    Debug.Log(status.ErrorData.Info);
                }
            });
        }
Exemple #5
0
 void FetchMessages(PubNub pubnub, List <string> listChannels)
 {
     pubnub.FetchMessages().Channels(listChannels).IncludeMeta(true).Async((result, status) => {
         //pubnub.FetchMessages().Channels(new List<string>{"channel2"}).Async ((result, status) => {
         if (status.Error)
         {
             Debug.Log(string.Format("In Example, FetchMessages Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
         }
         else
         {
             Debug.Log(string.Format("In FetchMessages, result: ")); //,result.EndTimetoken, result.Messages[0].ToString()));
             foreach (KeyValuePair <string, List <PNMessageResult> > kvp in result.Channels)
             {
                 Debug.Log("kvp channelname" + kvp.Key);
                 foreach (PNMessageResult pnMessageResut in kvp.Value)
                 {
                     Debug.Log("Channel: " + pnMessageResut.Channel);
                     Debug.Log("payload: " + pnMessageResut.Payload.ToString());
                     Debug.Log("timetoken: " + pnMessageResut.Timetoken.ToString());
                     Display(string.Format("Channel {0}, payload {1}, timetoken {2}", pnMessageResut.Channel, pnMessageResut.Payload.ToString(), pnMessageResut.Timetoken.ToString()));
                 }
             }
         }
     });
 }
Exemple #6
0
        void Init()
        {
            Debug.Log("Starting");
            PNConfiguration pnConfiguration = new PNConfiguration();

            pnConfiguration.SubscribeKey = "demo";
            pnConfiguration.PublishKey   = "demo";
            pnConfiguration.SecretKey    = "demo";
            pnConfiguration.PublishKey   = "pub-c-3ed95c83-12e6-4cda-9d69-c47ba2abb57e";
            pnConfiguration.SubscribeKey = "sub-c-26a73b0a-c3f2-11e9-8b24-569e8a5c3af3";

            pnConfiguration.CipherKey                   = "enigma";
            pnConfiguration.LogVerbosity                = PNLogVerbosity.BODY;
            pnConfiguration.PresenceTimeout             = 120;
            pnConfiguration.PresenceInterval            = 60;
            pnConfiguration.AuthKey                     = "authKey";
            pnConfiguration.HeartbeatNotificationOption = PNHeartbeatNotificationOption.All;

            //TODO: remove
            pnConfiguration.UUID = "PubNubUnityExample";
            Debug.Log("PNConfiguration");
            pubnub = new PubNub(pnConfiguration);

            listChannelGroups = new List <string> ()
            {
                cg1, cg2
            };
            listChannels = new List <string> ()
            {
                ch1, ch2
            };
        }
Exemple #7
0
 void MessageCounts(List <string> listChannels, PubNub pubnub)
 {
     pubnub.MessageCounts().Channels(listChannels).ChannelsTimetoken(new List <long> {
         1549982652
     }).Async((result, status) => {
         if (status.Error)
         {
             Debug.Log(string.Format("In Example, MessageCounts Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
         }
         else
         {
             Debug.Log(string.Format("MessageCounts," + result.Channels.Count));
             foreach (KeyValuePair <string, int> kvp in result.Channels)
             {
                 Display(string.Format("MessageCounts:-> {0}:{1}", kvp.Key, kvp.Value));
             }
         }
     });
     pubnub.MessageCounts().Channels(listChannels).ChannelsTimetoken(new List <long> {
         1551795013294, 155179501329433
     }).Async((result, status) => {
         if (status.Error)
         {
             Debug.Log(string.Format("In Example, MessageCounts Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
         }
         else
         {
             Debug.Log(string.Format("MessageCounts," + result.Channels.Count));
             foreach (KeyValuePair <string, int> kvp in result.Channels)
             {
                 Display(string.Format("MessageCounts:-> {0}:{1}", kvp.Key, kvp.Value));
             }
         }
     });
 }
Exemple #8
0
    // Use this for initialization
    void Start()
    {
        PNConfiguration pnConfiguration = new PNConfiguration();

        pnConfiguration.PublishKey   = "pub-c-270dafe4-6c23-47e4-b9eb-62d9590a9846";
        pnConfiguration.SubscribeKey = "sub-c-2e822568-1d76-11eb-8a07-eaf684f78515";
        pnConfiguration.Secure       = true;
        pubnub = new PubNub(pnConfiguration);
    }
Exemple #9
0
        public void TranslateUnixTimeToDateTime()
        {
            UnityEngine.Debug.Log("Running TranslateUnixTimeToDateTime()");
            //Test for 26th June 2012 GMT
            DateTime expectedDate = new DateTime(2012, 6, 26, 0, 0, 0, DateTimeKind.Utc);
            DateTime actualDate   = PubNub.TranslatePubnubUnixNanoSecondsToDateTime(13406688000000000);

            Assert.True(expectedDate.ToString().Equals(actualDate.ToString()));
        }
Exemple #10
0
        public void TranslateDateTimeToUnixTime()
        {
            UnityEngine.Debug.Log("Running TranslateDateTimeToUnixTime()");
            //Test for 26th June 2012 GMT
            DateTime dt             = new DateTime(2012, 6, 26, 0, 0, 0, DateTimeKind.Utc);
            long     nanoSecondTime = PubNub.TranslateDateTimeToPubnubUnixNanoSeconds(dt);

            Assert.True((13406688000000000).Equals(nanoSecondTime));
        }
Exemple #11
0
        public void TestYayDecryptionBasic()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            string       message      = "q/xJqqN6qbiZMXYmiQC1Fw==";
            //decrypt
            string decrypted = pubnubCrypto.Decrypt(message);

            Assert.True(("yay!").Equals(decrypted));
        }
Exemple #12
0
        public void TestRandomIVGenCommon(string message)
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog, true);
            string       encrypted    = pubnubCrypto.Encrypt(message);
            string       decrypted    = pubnubCrypto.Decrypt(encrypted);

            UnityEngine.Debug.Log(decrypted);
            Assert.True(message.Equals(decrypted));
        }
    void Start()
    {
        PNConfiguration pnConfiguration = new PNConfiguration();

        pnConfiguration.SubscribeKey = subKey;
        pnConfiguration.PublishKey   = pubKey;
        pnConfiguration.UUID         = myID;

        dataServer = new PubNub(pnConfiguration);


        dataServer.Subscribe()
        .Channels(new List <string> ()
        {
            subscribeChannel
        })
        .Execute();

        dataServer.SubscribeCallback += (sender, e) =>

        {
            SubscribeEventEventArgs inMessage = e as SubscribeEventEventArgs;

            if (inMessage.MessageResult != null) //error check to insure the message has contents
            {
                //save the UUID of the last sender
                lastSender = inMessage.MessageResult.IssuingClientId;

                Debug.Log(lastSender);

                //save the message into a Dictionary
                Dictionary <string, object> msg = inMessage.MessageResult.Payload as Dictionary <string, object>;

                //retrieve and convert the value you need using the key name

                /*
                 * convert to integer -  (int)msg["keyName"]
                 * convert to float -  (float)msg["keyName"]
                 * convert to string -  (float)msg["keyName"]
                 *
                 */

                /*list all keys
                 * foreach (string key in msg.Keys)
                 * {
                 * Debug.Log(key);
                 * }
                 */
                xVal = (int)msg["x"];
                yVal = (int)msg["y"];

                transform.position = new Vector3(xVal * 2, 0, yVal * -2);
            }
        };
    }
Exemple #14
0
        public void TestPAMSignature()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto crypto    = new PubnubCrypto("", PNLog);
            string       secretKey = "secret";
            string       message   = "Pubnub Messaging 1";

            string signature = crypto.PubnubAccessManagerSign(secretKey, message);

            Assert.True(("mIoxTVM2WAM5j-M2vlp9bVblDLoZQI5XIoYyQ48U0as=").Equals(signature));
        }
Exemple #15
0
        public void TestGermanCharsEncryptionMiniJson()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            string       message      = "ÜÖ";

            message = Common.SerializeMiniJson(message);
            string encrypted = pubnubCrypto.Encrypt(message);

            Assert.True(("stpgsG1DZZxb44J7mFNSzg==").Equals(encrypted));
        }
        //[ExpectedException (typeof(ArgumentNullException))]
        public void TestNullDecryption()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            //deserialized string
            string message = null;
            //decrypt
            var ex = Assert.Throws <ArgumentNullException>(() => pubnubCrypto.Decrypt(message));

            Assert.That(ex.Message.Contains("Argument cannot be null."), ex.Message, null);
        }
Exemple #17
0
        public void TestUnicodeCharsEncryptionMiniJson()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            string       message      = "漢語";

            message = Common.SerializeMiniJson(message);
            string encrypted = pubnubCrypto.Encrypt(message);

            Assert.That(("+BY5/miAA8aeuhVl4d13Kg==").Equals(encrypted));
        }
Exemple #18
0
        public void TestHashDecryption()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            //deserialized string
            string message = "GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g=";
            //decrypt
            string decrypted = pubnubCrypto.Decrypt(message);

            Assert.True(("{\"foo\":{\"bar\":\"foobar\"}}").Equals(decrypted));
        }
Exemple #19
0
        public void TestStuffcanDecryption()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            //deserialized string
            string message = "zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF";
            //decrypt
            string decrypted = pubnubCrypto.Decrypt(message);

            Assert.True(("{\"this stuff\":{\"can get\":\"complicated!\"}}").Equals(decrypted));
        }
    // Use this for initialization
    void Start()
    {
        // Use this for initialization
        PNConfiguration pnConfiguration = new PNConfiguration();

        pnConfiguration.PublishKey   = "pub-c-efb4a8fe-605a-42e8-866a-facc7271a49d";
        pnConfiguration.SubscribeKey = "sub-c-1bb9d4ac-52f4-11e8-85c6-a6b0a876dba1";

        pnConfiguration.LogVerbosity = PNLogVerbosity.BODY;
        //pnConfiguration.UUID = Random.Range (0f, 999999f).ToString ();

        inputResponse = GameObject.Find("InputObject").GetComponent <InputScript>().UUIDinput.ToString();
        Debug.Log(inputResponse);
        pnConfiguration.UUID = inputResponse;

        pubnub = new PubNub(pnConfiguration);
        Debug.Log(pnConfiguration.UUID);
        UUIDText.text = "UUID: " + pnConfiguration.UUID;

        pubnub.SusbcribeCallback += (sender, e) => {
            SusbcribeEventEventArgs mea = e as SusbcribeEventEventArgs;
            if (mea.Status != null)
            {
            }
            if (mea.MessageResult != null)
            {
                lastClickText.text = "Last Publish Sent by: " + mea.MessageResult.IssuingClientId.ToString();
                if ((int)mea.MessageResult.Payload == 1)
                {
                    CubeObject.GetComponent <Renderer>().material = Pepe;
                }
                if ((int)mea.MessageResult.Payload == 2)
                {
                    CubeObject.GetComponent <Renderer>().material = Pepe2;
                }
                if ((int)mea.MessageResult.Payload == 3)
                {
                    CubeObject.GetComponent <Renderer>().material = Pepe3;
                }
            }
            if (mea.PresenceEventResult != null)
            {
                //lastClickText.text = mea.PresenceEventResult.UUID.ToString();
                Debug.Log("In Example, SusbcribeCallback in presence" + mea.PresenceEventResult.Channel + mea.PresenceEventResult.Occupancy + mea.PresenceEventResult.Event);
            }
        };
        pubnub.Subscribe()
        .Channels(new List <string> ()
        {
            "my_channel"
        })
        .WithPresence()
        .Execute();
    }
Exemple #21
0
    private Vector3 _heading;          // Where the user looking.

    void Start()
    {
        MLEyes.Start();                                                              // Start eye tracking.
        MLInput.Start();                                                             // Start input controller.
        MLInput.OnTriggerDown += HandleOnTriggerDown;                                // Get trigger down event.

        meshRenderer = gameObject.GetComponent <MeshRenderer>();                     // Get the game object.

        PNConfiguration pnConfiguration = new PNConfiguration();                     // Start PubNub

        pnConfiguration.PublishKey   = "pub-c-bb13912e-7007-46ce-a954-74fe4c6cb131"; // YOUR PUBLISH KEY HERE.
        pnConfiguration.SubscribeKey = "sub-c-e14cda48-b857-11e8-b27d-1678d61e8f93"; // YOUR SUBSCRIBE KEY HERE.
        pubnub  = new PubNub(pnConfiguration);
        pn_uuid = pnConfiguration.UUID;                                              // Get the UUID of the PubNub client.

        pubnub.Subscribe()
        .Channels(new List <string>()
        {
            meshRenderer.name     // Subscribe to the channel for the game object.
        })
        .Execute();
        pubnub.SusbcribeCallback += (sender, e) => {
            SusbcribeEventEventArgs message = e as SusbcribeEventEventArgs;
            if (message.Status != null)
            {
                switch (message.Status.Category)
                {
                case PNStatusCategory.PNUnexpectedDisconnectCategory:
                case PNStatusCategory.PNTimeoutCategory:
                    pubnub.Reconnect();
                    break;
                }
            }
            if (message.MessageResult != null)
            {
                // Does the message equal the UUID for this client?
                if (message.MessageResult.Payload.ToString() == pn_uuid) // Message and client UUID are the same.
                {
                    meshRenderer.material = OwnedMaterial;               // The user owns the game object, change material to OwnedMaterial to show.
                    looking = false;
                    owned   = true;
                }
                else                                                // Message and client UUID are NOT the same.
                {
                    if (owned)                                      // Only need to change color if the user owns the game object.
                    {
                        meshRenderer.material = NonFocusedMaterial; // Another user has taken the game object, change material to NonFocusedMaterial to show..
                        owned = false;
                    }
                }
            }
        };
    }
Exemple #22
0
        public void TestGermanCharsDecryptionMiniJson()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            string       message      = "stpgsG1DZZxb44J7mFNSzg==";
            //decrypt
            string decrypted = pubnubCrypto.Decrypt(message);

            //deserialize
            message = Common.DeserializeMiniJson <string> (decrypted);

            Assert.True(("ÜÖ").Equals(message));
        }
Exemple #23
0
        //will fail with minijson
        //[Test]
        public void TestObjectEncryptionMiniJson()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            //create an object
            Object obj = new Object();
            //serialize
            string strObj = Common.SerializeMiniJson(obj);
            //encrypt
            string encrypted = pubnubCrypto.Encrypt(strObj);

            Assert.True(("IDjZE9BHSjcX67RddfCYYg==").Equals(encrypted));
        }
Exemple #24
0
        public void TestArrayEncryptionMiniJson()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);

            //create an empty array object
            object[] objArr = { };
            string   strArr = Common.SerializeMiniJson(objArr);
            //Encrypt
            string encrypted = pubnubCrypto.Encrypt(strArr);

            Assert.True(("Ns4TB41JjT2NCXaGLWSPAQ==").Equals(encrypted));
        }
Exemple #25
0
        public void TestPubNubDecryption2MiniJson()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            //Deserialized string
            string message = "f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54=";
            //Decrypt
            string decrypted = pubnubCrypto.Decrypt(message);

            //Deserialize
            message = Common.DeserializeMiniJson <string> (decrypted);
            Assert.True(("Pubnub Messaging API 2").Equals(message));
        }
Exemple #26
0
        public void TestPubNubDecryption1MiniJson()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            //deserialized string
            string message = "f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=";
            //decrypt
            string decrypted = pubnubCrypto.Decrypt(message);

            //deserialize
            message = Common.DeserializeMiniJson <string> (decrypted);
            Assert.True(("Pubnub Messaging API 1").Equals(message));
        }
Exemple #27
0
        public void TestUnicodeCharsDecryptionMiniJson()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            string       message      = "+BY5/miAA8aeuhVl4d13Kg==";
            //decrypt
            string decrypted = pubnubCrypto.Decrypt(message);

            //deserialize
            message = Common.DeserializeMiniJson <string> (decrypted);

            Assert.True(("漢語").Equals(message));
        }
Exemple #28
0
 void ListAllChannelsOfGroup(PubNub pubnub, string cg)
 {
     pubnub.ListChannelsForChannelGroup().ChannelGroup(cg).Async((result, status) => {
         if (status.Error)
         {
             Debug.Log(string.Format("In Example, ListAllChannelsOfGroup Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
         }
         else
         {
             Debug.Log(string.Format("In Example ListAllChannelsOfGroup, result: {0}", (result.Channels != null)?string.Join(",", result.Channels.ToArray()):""));
             Display(string.Format("ListChannelsForChannelGroup: {0}", (result.Channels != null)?string.Join(",", result.Channels.ToArray()):""));
         }
     });
 }
Exemple #29
0
        public void TestPubNubEncryption2()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            //Deserialized
            string message = "Pubnub Messaging API 2";

            //serialize the message
            message = EditorCommon.Serialize(message);
            //encrypt
            string encrypted = pubnubCrypto.Encrypt(message);

            Assert.True(("f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54=").Equals(encrypted));
        }
Exemple #30
0
        public void TestPubNubEncryption1MiniJson()
        {
            pn = EditorCommon.InitPN(pnConfig);
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            //non serialized string
            string message = "Pubnub Messaging API 1";

            //serialize
            message = Common.SerializeMiniJson(message);
            //encrypt
            string encrypted = pubnubCrypto.Encrypt(message);

            Assert.True(("f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=").Equals(encrypted));
        }