예제 #1
0
        private static string GetConditionUri(string pubKey)
        {
            Asn1lib asn1 = new Asn1lib(Encoders.Base58.DecodeData(pubKey));

            var fingerprint = asn1.GetFingerprint();

            var baseUri     = "ni:///sha-256;";
            var queryParams = "?fpt=ed25519-sha-256&cost=131072";

            return($"{baseUri}{Base64Url.Encode(fingerprint)}{queryParams}");
        }
예제 #2
0
        public void ProvidedPubKey_ShouldGeneratedValidCcUrl()
        {
            var pubKey      = "J7rTDMcY48AfV7b18ptpFRnn1un5s7SYENEqsQHHWAps";
            var expectedUri = "IGzUc6y7uenZWKeOWy_TdkgkTkk2pvwXMwNkBGVOFU8";

            byte[] pubKeyBytes = Encoders.Base58.DecodeData(pubKey);

            var asn1 = new Asn1lib(pubKeyBytes);

            string base64UrlEncoded = Base64Url.Encode(asn1.GetFingerprint());

            Assert.AreEqual(expectedUri, base64UrlEncoded);
        }