Example #1
0
 public void Strike(TokenPlanchet planchet)
 {
     using (var fiveByFive = Generate5x5UsingFakeAlgorithm())
     {
         planchet.Id   = generator.Next();
         planchet.Code = security.EncryptAsBase64(fiveByFive, salt);
         planchet.Hash = security.HashAsBase64(fiveByFive);
     }
 }
Example #2
0
        IEnumerable <Token> RunJob(int jobId, ITokenDie die, CancellationToken cancellationToken)
        {
            var mintJob        = Data.MintJobs[jobId];
            var sequenceNumber = mintJob.StartOfSequence - 1;
            var builder        = new TokenBuilder().HasMintRequestId(Id).HasCatalogId(Data.CatalogId);

            while (sequenceNumber++ < mintJob.Count && !cancellationToken.IsCancellationRequested)
            {
                var planchet = new TokenPlanchet();

                die.Strike(planchet);
                builder.HasId(planchet.Id);
                builder.HasCode(planchet.Code);
                builder.HasHash(planchet.Hash);
                builder.HasSequenceNumber(sequenceNumber);

                yield return(builder.CreateToken());
            }
        }