-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from drmathias/feature/ticket-secret
Ticket transaction logging and ticket secrets
- Loading branch information
Showing
48 changed files
with
1,570 additions
and
935 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Ticketbooth.Scanner/Converters/ByteArrayToHexConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
|
||
namespace Ticketbooth.Scanner.Converters | ||
{ | ||
public class ByteArrayToHexConverter : JsonConverter | ||
{ | ||
public override bool CanConvert(Type objectType) | ||
{ | ||
return objectType == typeof(byte[]); | ||
} | ||
|
||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
{ | ||
var hexString = (string)reader.Value; | ||
int characterCount = hexString.Length; | ||
byte[] result = new byte[characterCount / 2]; | ||
for (int i = 0; i < characterCount; i += 2) | ||
{ | ||
result[i / 2] = Convert.ToByte(hexString.Substring(i, 2), 16); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
{ | ||
writer.WriteValue(BitConverter.ToString((byte[])value).Replace("-", string.Empty)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Ticketbooth.Scanner.Data.Dtos | ||
{ | ||
public class BlockDto | ||
{ | ||
public ulong Height { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
using Stratis.SmartContracts; | ||
using static TicketContract; | ||
|
||
namespace Ticketbooth.Scanner.Data.Dtos | ||
{ | ||
public class DigitalTicket | ||
{ | ||
public TicketContract.Seat Seat { get; set; } | ||
public Seat Seat { get; set; } | ||
|
||
public Address Address { get; set; } | ||
public string Secret { get; set; } | ||
|
||
public byte[] SecretKey { get; set; } | ||
|
||
public byte[] SecretIV { get; set; } | ||
|
||
public byte[] NameKey { get; set; } | ||
|
||
public byte[] NameIV { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Ticketbooth.Scanner.Data.Dtos | ||
{ | ||
public class LogDto<T> | ||
{ | ||
public T Log { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
namespace Ticketbooth.Scanner.Data.Dtos | ||
{ | ||
public class Receipt<T> | ||
public class Receipt<TValue, TLog> | ||
{ | ||
public string BlockHash { get; set; } | ||
|
||
public T ReturnValue { get; set; } | ||
public TValue ReturnValue { get; set; } | ||
|
||
public LogDto<TLog>[] Logs { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.