public void TheTokenFailsToVerifyWithABadSecret()
        {
            DigestTokens.VerifyAndDecodeResult result = new DigestTokens().VerifyAndDecode("bad-secret", _token);

            Assert.False(result.IsVerified());
            Assert.Equal(ECode.BAD_DIGEST, result.GetCode());
            Assert.Null(result.GetValue());
        }
        public void TheTokenSuccessfullyVerifiesWithTheCorrectSecret()
        {
            DigestTokens.VerifyAndDecodeResult result = new DigestTokens().VerifyAndDecode("my-secret", _token);

            Assert.True(result.IsVerified());
            Assert.Equal(ECode.VERIFIED, result.GetCode());
            Assert.NotNull(result.GetValue());
            Assert.Equal("channelAlias:my-channel", result.GetValue().GetValue("requiredTag").ToString());
        }
        public void TheTokenSuccessfullyVerifiesWithTheCorrectSecret()
        {
            DigestTokens.VerifyAndDecodeResult result = new DigestTokens().VerifyAndDecode("my-secret", _token);

            Assert.True(result.IsVerified());
            Assert.Equal(ECode.VERIFIED, result.GetCode());
            Assert.NotNull(result.GetValue());
            Assert.Equal("publish", result.GetValue().GetValue("type").ToString());
            Assert.Equal("channelId:us-northeast#my-application-id#my-channel.134566", result.GetValue().GetValue("requiredTag").ToString());
        }
Ejemplo n.º 4
0
        public void TheTokenSuccessfullyVerifiesWithTheCorrectSecret()
        {
            DigestTokens.VerifyAndDecodeResult result = new DigestTokens().VerifyAndDecode("my-secret", _token);

            Assert.True(result.IsVerified());
            Assert.Equal(ECode.VERIFIED, result.GetCode());
            Assert.NotNull(result.GetValue());
            Assert.Equal("publish", result.GetValue().GetValue("type").ToString());
            Assert.Equal(2, (result.GetValue().GetValue("capabilities") as JArray).Count);
            Assert.Equal("multi-bitrate", (result.GetValue().GetValue("capabilities") as JArray)[0].ToString());
            Assert.Equal("streaming", (result.GetValue().GetValue("capabilities") as JArray)[1].ToString());
        }