Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
VaultItem.cs
1using System;
2using System.Text.RegularExpressions;
6
8{
12 [CollectionName("VaultItems")]
13 [Index("Account", "Type", "ClientId")]
14 [Index("VaultId")]
15 public class VaultItem
16 {
17 internal static readonly Regex UnitTests = new Regex(@"Waher[.]Service[.]IoTBroker[.]Test[.](LegalIdentitiesTests|SmartContractsTests|AgentTests)",
18 RegexOptions.Compiled | RegexOptions.Singleline);
19 private static readonly ICallStackCheck[] approvedSources = Assert.Convert(new object[]
20 {
21 typeof(XmppServerModule).Assembly,
22 DataStorage.Account.FromSaveUnsaved,
23 DataStorage.Account.FromUpdateObject
24 });
25 private static readonly ICallStackCheck[] approvedSourcesTest = Assert.Convert(new object[]
26 {
27 typeof(XmppServerModule).Assembly,
28 DataStorage.Account.FromSaveUnsaved,
29 DataStorage.Account.FromUpdateObject,
30 "System.Threading.PortableThreadPool+WorkerThread",
31 UnitTests
32 });
33
34 private VaultTag[] tags;
35
39 public VaultItem()
40 {
41 }
42
46 [ObjectId]
47 public string ObjectId { get; set; }
48
52 public string Account { get; set; }
53
57 public string Type { get; set; }
58
62 public string ClientId { get; set; }
63
67 public byte[] VaultId { get; set; }
68
72 public DateTime Created { get; set; }
73
77 public DateTime Updated { get; set; }
78
82 [Encrypted(32)]
83 public VaultTag[] Tags
84 {
85 get
86 {
87 Assert.CallFromSource((DomainConfiguration.Instance?.UseDomainName ?? false) ? approvedSources : approvedSourcesTest);
88 return this.tags;
89 }
90
91 set
92 {
93 Assert.CallFromSource((DomainConfiguration.Instance?.UseDomainName ?? false) ? approvedSources : approvedSourcesTest);
94 this.tags = value;
95 }
96 }
97 }
98}
static DomainConfiguration Instance
Current instance of configuration.
bool UseDomainName
If the server uses a domain name.
Static class containing methods that can be used to make sure calls are made from appropriate locatio...
Definition: Assert.cs:15
static ICallStackCheck[] Convert(params object[] Sources)
Converts an array of objects into an array of ICallStackCheck objects, assuming each listed source is...
Definition: Assert.cs:99
static void CallFromSource(params string[] Sources)
Makes sure the call is made from one of the listed sources.
Definition: Assert.cs:54
Contains information about an item in the Vault.
Definition: VaultItem.cs:16
string ClientId
Client ID (as defined by the agent).
Definition: VaultItem.cs:62
VaultTag[] Tags
Tags containing information about the item.
Definition: VaultItem.cs:84
VaultItem()
Contains information about an item in the Vault.
Definition: VaultItem.cs:39
Contains information about a tag in a vault item.
Definition: VaultTag.cs:7
Service Module hosting the XMPP broker and its components.
Interface for call stack checks.