Beispiel #1
0
        void DoCreateConnection()
        {
            // Constructor for the Connecting API
            ConnectionsV1_0 handler = Connecting.v1_0("", "");

            handlers.addHandler(
                handler,
                (msgName, message) =>
            {
                if ("request-received".Equals(msgName))
                {
                    requestReceived = true;
                }
                else if ("response-sent".Equals(msgName))
                {
                    startResponse = true;
                }
                else
                {
                    nonHandled(msgName, message);
                }
            }
                );

            WaitFor(ref requestReceived, "Waiting to receive Request");

            WaitFor(ref startResponse, "Responding to connection request");
        }
Beispiel #2
0
 public void testStatus()
 {
     withContext(context =>
     {
         ConnectionsV1_0 testProtocol = Connecting.v1_0(label, base64Url);
         byte[] msg = testProtocol.statusMsgPacked(context);
         JsonObject unpackedMessage = TestHelpers.unpackForwardMessage(context, msg);
         testStatusInviteMessage(unpackedMessage);
     });
 }
Beispiel #3
0
        void DoCreateConnection()
        {
            // handler for messages in Connecting protocol
            ConnectionsV1_0 connecting = Connecting.v1_0("", "");

            handlers.addHandler(
                connecting,
                (msgName, message) =>
            {
                if ("request-received".Equals(msgName))
                {
                    requestReceived = true;
                }
                else if ("response-sent".Equals(msgName))
                {
                    startResponse = true;
                }
                else
                {
                    nonHandled(msgName, message);
                }
            }
                );

            // handler for relationship-reused message which is sent by the ConnectMe app if it is already connected with this example app agent
            OutOfBandV1_0 oob = OutOfBand.v1_0("", "");

            handlers.addHandler(
                oob,
                (msgName, message) =>
            {
                if ("relationship-reused".Equals(msgName))
                {
                    Console.SetOut(App.console);
                    Console.WriteLine();
                    consolePrintMessage(msgName, message);
                    Console.WriteLine("The mobile wallet app signalled that it already has the connection with this example app agent");
                    Console.WriteLine("This example app does not support relationship-reuse since it does not store the data about previous relationships");
                    Console.WriteLine("Please delete existing connection in your mobile wallet and re-run this application");
                    Console.WriteLine("To learn how relationship-reuse can be used check out \"ssi-auth\" or \"out-of-band\" sample apps");
                    Environment.Exit(-1);
                }
                else
                {
                    nonHandled(msgName, message);
                }
            }
                );

            WaitFor(ref requestReceived, "Waiting to receive Request");

            WaitFor(ref startResponse, "Responding to connection request");
        }
Beispiel #4
0
        public void testGetMessageType()
        {
            ConnectionsV1_0 connecting = Connecting.v1_0(label, base64Url);
            string          msgName    = "msg name";

            Assert.AreEqual(
                Util.getMessageType(
                    Util.COMMUNITY_MSG_QUALIFIER,
                    "connections",
                    "1.0",
                    msgName
                    ),
                connecting.messageType(msgName)
                );
        }
Beispiel #5
0
        public void testGetThreadId()
        {
            ConnectionsV1_0 connecting = Connecting.v1_0(label, base64Url);

            Assert.IsNotNull(connecting.getThreadId());
        }