public Parts(KeyPurpose[] purposes, string name, string description, TagPubKey pubKey, KeyStrength strength, BaseKeyId keyId, IEnumerable <AppPermissions> permissions) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } Version = InterlockKeyVersion; Name = name; Purposes = purposes.Required(); PublicKey = pubKey.Required(); Description = description; Strength = strength; if (Actionable && permissions.None()) { Purposes = Purposes.Where(pu => pu != KeyPurpose.Action).ToArray(); // Remove Action Purpose } Permissions = permissions; Identity = new KeyId(TagHash.HashSha256Of(_hashable)); Id = keyId ?? Identity; }
public static TagHash HashOf(this string s) => TagHash.HashSha256Of(s.UTF8Bytes());