Skip to content

Commit

Permalink
put more protection on EphemeralMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Confusingboat committed Jun 2, 2023
1 parent daf74d1 commit 236ef65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/Ephemerally/EphemeralMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ namespace Ephemerally;
private const string PrefixValue = "E";

public string FullName { get; } = string.Empty;
public string NamePart { get; init; }
public string Nonce { get; init; }
public bool IsEphemeral { get; init; }
public DateTimeOffset? Expiration { get; init; }
public string NamePart { get; internal init; }
public string Nonce { get; internal init; }
public bool IsEphemeral { get; internal init; }
public DateTimeOffset? Expiration { get; internal init; }

/// <summary>
/// Non-ephemeral constructor
/// </summary>
/// <param name="fullName"></param>
internal EphemeralMetadata(string fullName)
private EphemeralMetadata(string fullName)
{
FullName = fullName;
}
Expand All @@ -25,7 +25,7 @@ internal EphemeralMetadata(string fullName)
/// <param name="expiration"></param>
/// <param name="nonce"></param>
/// <param name="friendlyName"></param>
internal EphemeralMetadata(
private EphemeralMetadata(
DateTimeOffset expiration,
string nonce,
string friendlyName)
Expand Down
2 changes: 1 addition & 1 deletion tests/Ephemerally.Tests/EphemeralMetadataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public string GetFullName_Tests(long expirationTimestamp, string nonce, string n
[TestCase(1684991964, ExpectedResult = true)]
public bool IsExpired_as_of_1684991963(long now)
{
var metadata = new EphemeralMetadata("E_1684991963_ABCDEF_Test")
var metadata = EphemeralMetadata.New("E_1684991963_ABCDEF_Test") with
{
Expiration = DateTimeOffset.FromUnixTimeSeconds(1684991963),
NamePart = "Test",
Expand Down

0 comments on commit 236ef65

Please sign in to comment.