assemblies/BitwardenWrapper.cs
using System;
using System.Collections; using System.Security; using System.Runtime.InteropServices; using System.Management.Automation; using Bitwarden.Enum; namespace Bitwarden { namespace Enum { // Two-step Login Methods // Used to specify which Two-step Login method to use when logging in public enum MfaMethod { Authenticator = 0, Email = 1, Yubikey = 2 } // Item Types // Used with the create command to specify a Vault item type public enum ItemType { Undefined = 0, Login = 1, SecureNote = 2, Card = 3, Identity = 4 } // Login URI Match Types // Used with the create and edit commands to specify URI match detection behavior public enum UriMatchType { Domain = 0, Host = 1, StartsWith = 2, Exact = 3, Regex = 4, Never = 5 } // Field Types // Used with the create and edit commands to configure custom fields public enum FieldType { Text = 0, Hidden = 1, Boolean = 2 } // Organization User Types // Indicates a user's type public enum UserType { Owner = 0, Admin = 1, User = 2, Manager = 3 } // Organization User Statuses // Indicates a user's status within the Organization public enum UserStatus { Invited = 0, Accepted = 1, Confirmed = 2 } } public class SecurePassword { private SecureString securePassword__ = new SecureString(); public SecureString Password { get { return securePassword__; } } public SecurePassword( string insecurePassword ) { foreach ( char c in insecurePassword ) securePassword__.AppendChar(c); } public string Reveal() { return Marshal.PtrToStringAuto( Marshal.SecureStringToBSTR( securePassword__ ) ); } } public class PasswordHistory { public DateTime LastUsedDate = new DateTime(); public SecurePassword Password { get; set; } } public class LoginUri { private UriMatchType _Match { get; set; } public UriMatchType Match { get { return _Match; } set { _Match = value ? value : UriMatchType.Domain; } } public System.Uri Uri { get; set; } } public class Login { } } |