Ejemplo n.º 1
0
        void setupIssuer()
        {
            // constructor for the Issuer Setup protocol
            IssuerSetupV0_6 newIssuerSetup = IssuerSetup.v0_6();

            // handler for created issuer identifier message
            setupIssuerHandler(newIssuerSetup);

            // request that issuer identifier be created
            newIssuerSetup.create(context);

            // wait for request to complete
            WaitFor(ref setup_complete, "Waiting for setup to complete");

            App.consoleOutput("The issuer DID and Verkey must be on the ledger.");
            App.consoleOutput("Issuer DID: " + _issuerDID);
            App.consoleOutput("Issuer Verkey: " + _issuerVerkey);
            App.consoleOutput("The issuer DID and Verkey must be on the ledger.");

            bool automatedRegistration = consoleYesNo("Attempt automated registration via https://selfserve.sovrin.org", true);

            if (automatedRegistration)
            {
                HttpClient client = new HttpClient();

                var request = new HttpRequestMessage(HttpMethod.Post, "https://selfserve.sovrin.org/nym");

                JsonObject payload_builder = new JsonObject();
                payload_builder.Add("network", "stagingnet");
                payload_builder.Add("did", _issuerDID);
                payload_builder.Add("verkey", _issuerVerkey);
                payload_builder.Add("paymentaddr", "");
                string payload = payload_builder.ToString();

                request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
                request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

                var response = client.PostAsync(request.RequestUri, request.Content).GetAwaiter().GetResult();
                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var data = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
                    App.consoleOutput($"Got response from Sovrin portal: {data}");
                }
                else
                {
                    App.consoleOutput("Something went wrong with contactig Sovrin portal");
                    App.consoleOutput($"Please add DID ({_issuerDID}) and Verkey ({_issuerVerkey}) to ledger manually");

                    WaitReturn("Press ENTER when DID is on ledger");
                }
            }
            else
            {
                App.consoleOutput($"Please add DID ({_issuerDID}) and Verkey ({_issuerVerkey}) to ledger manually");

                WaitReturn("Press ENTER when DID is on ledger");
            }
        }
Ejemplo n.º 2
0
 public void testCreate()
 {
     withContext(context =>
     {
         IssuerSetupV0_6 testProtocol = IssuerSetup.v0_6();
         byte[] message             = testProtocol.createMsgPacked(context);
         JsonObject unpackedMessage = TestHelpers.unpackForwardMessage(context, message);
         Assert.AreEqual(
             "did:sov:123456789abcdefghi1234;spec/issuer-setup/0.6/create",
             unpackedMessage.getAsString("@type"));
     });
 }
Ejemplo n.º 3
0
        public void testCreateMessages()
        {
            Context         context = TestHelpers.getContext();
            IssuerSetupV0_6 p       = IssuerSetup.v0_6();
            JsonObject      msg     = p.createMsg(context);

            Assert.AreEqual(
                "did:sov:123456789abcdefghi1234;spec/issuer-setup/0.6/create",
                msg.getAsString("@type")
                );
            Assert.IsNotNull(msg.getAsString("@id"));
        }
Ejemplo n.º 4
0
 public void testCreate()
 {
     withContext(context =>
     {
         IssuerSetupV0_6 testProtocol = IssuerSetup.v0_6();
         byte[] message             = testProtocol.createMsgPacked(context);
         JsonObject unpackedMessage = TestHelpers.unpackForwardMessage(context, message);
         Assert.AreEqual(
             Util.EVERNYM_MSG_QUALIFIER + "/issuer-setup/0.6/create",
             unpackedMessage.getAsString("@type"));
     });
 }
Ejemplo n.º 5
0
        public void testCreateMessages()
        {
            Context         context = TestHelpers.getContext();
            IssuerSetupV0_6 p       = IssuerSetup.v0_6();
            JsonObject      msg     = p.createMsg(context);

            Assert.AreEqual(
                Util.EVERNYM_MSG_QUALIFIER + "/issuer-setup/0.6/create",
                msg.getAsString("@type")
                );
            Assert.IsNotNull(msg.getAsString("@id"));
        }
Ejemplo n.º 6
0
        void issuerIdentifier()
        {
            // constructor for the Issuer Setup protocol
            IssuerSetupV0_6 issuerSetup = IssuerSetup.v0_6();

            issuerIdentifierHandler(issuerSetup);

            // query the current identifier
            issuerSetup.currentPublicIdentifier(context);

            // wait for response from verity-application
            WaitFor(ref issuerComplete, "Waiting for current issuer DID");
        }
Ejemplo n.º 7
0
        public void testGetMessageType()
        {
            string msgName = "msg name";

            IssuerSetupV0_6 t = IssuerSetup.v0_6();

            string expectedType = Util.getMessageType(
                Util.EVERNYM_MSG_QUALIFIER,
                t.family(),
                t.version(),
                msgName);

            Assert.AreEqual(expectedType, t.messageType(msgName));
        }
Ejemplo n.º 8
0
        public void testGetThreadId()
        {
            IssuerSetupV0_6 testProtocol = IssuerSetup.v0_6();

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