summary refs log tree commit diff
path: root/extra/admin-api/Interop/Spacebar.Interop.Cdn.Signing/CdnSignature.cs
blob: b0b2a7e411205c18225fb620476590b73231bd5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace Spacebar.Interop.Cdn.Signing;

public class CdnSignature {
    public string Path { get; set; } = string.Empty;
    public string? IpAddress { get; set; } = string.Empty;
    public string? UserAgent { get; set; } = string.Empty;
}

public class CdnSignatureResult : CdnSignature {
    // hm
    public required string Signature { get; set; }

    // is
    public required DateTimeOffset CreatedAt { get; set; }

    // ex
    public required DateTimeOffset ExpiresAt { get; set; }

    public string GetSignedPath() {
        return $"{Path}?is={CreatedAt.ToUnixTimeMilliseconds():x}&ex={ExpiresAt.ToUnixTimeMilliseconds():x}&hm={Signature}";
    }
}