public static ProtoBuf.Attribute.Attribute BuildAnchoredAttribute(string name, string value, ContentType contentType, string rawAnchor) { var attribute = new ProtoBuf.Attribute.Attribute { Name = name, ContentType = contentType, Value = ByteString.CopyFromUtf8(value) }; AddAnchorToAttribute(Conversion.Base64ToBytes(rawAnchor), attribute); return(attribute); }
public void ShouldParseExtraDataBytes() { string base64ExtraData = TestData.TestActivityDetails.ExtraData; byte[] extraDataBytes = Conversion.Base64ToBytes(base64ExtraData); ExtraData result = ExtraDataConverter.ParseExtraDataProto(extraDataBytes); string expectedDateTime = "2019-10-15T22:04:05.123Z"; DateTime nonNullableExpiryDate = (DateTime)result.AttributeIssuanceDetails.ExpiryDate; string actualDateTime = nonNullableExpiryDate.ToString(Format.RFC3339PatternMilli, DateTimeFormatInfo.InvariantInfo); Assert.AreEqual(expectedDateTime, actualDateTime); Assert.AreEqual("c29tZUlzc3VhbmNlVG9rZW4=", result.AttributeIssuanceDetails.Token); Assert.AreEqual(2, result.AttributeIssuanceDetails.IssuingAttributes.Count); Assert.AreEqual("com.thirdparty.id", result.AttributeIssuanceDetails.IssuingAttributes[0].Name); Assert.AreEqual("com.thirdparty.other_id", result.AttributeIssuanceDetails.IssuingAttributes[1].Name); }
public static ProtoBuf.Attribute.Attribute CreateProtobufAttributeFromRawAnchor(string rawAnchor) { byte[] attributeBytes = Conversion.Base64ToBytes(rawAnchor); return(ProtoBuf.Attribute.Attribute.Parser.ParseFrom(attributeBytes)); }