From a60bb7490bbca8889491cdcd72acc0c42d762fc0 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Tue, 27 Sep 2022 20:51:16 -0400 Subject: [PATCH 1/2] Rename module directory --- .gitignore | 1 - .../BitwardenPS.psd1 | 2 +- .../BitwardenPS.psm1 | 0 .../Private/Invoke/Invoke-PublicApi.ps1 | 0 .../Private/Invoke/Invoke-VaultApi.ps1 | 0 .../Private/Invoke/Invoke-VaultCli.ps1 | 0 .../Collections/Get-PublicCollections.ps1 | 0 .../Public API/Connect/Connect-PublicApi.ps1 | 0 .../Public API/Events/Get-PublicEvents.ps1 | 0 .../Groups/Get-PublicGroupMemberIds.ps1 | 0 .../Public API/Groups/Get-PublicGroups.ps1 | 0 .../Members/Get-PublicMemberGroupIds.ps1 | 0 .../Public API/Members/Get-PublicMembers.ps1 | 0 .../Members/Send-PublicMemberInvite.ps1 | 0 .../Get-VaultAttachment.ps1 | 0 .../Get-VaultItemNotes.ps1 | 0 .../Get-VaultItemPassword.ps1 | 0 .../Get-VaultItemPwExposed.ps1 | 0 .../Get-VaultItemTotp.ps1 | 0 .../Attachments & Fields/Get-VaultItemUri.ps1 | 0 .../Get-VaultItemUsername.ps1 | 0 .../New-VaultAttachment.ps1 | 0 .../Remove-VaultAttachment.ps1 | 0 .../Confirm-VaultOrgMember.ps1 | 0 .../Get-VaultCollections.ps1 | 0 .../Get-VaultOrgCollection.ps1 | 0 .../Get-VaultOrgMembers.ps1 | 0 .../Get-VaultOrgs.ps1 | 0 .../Move-VaultItemToCollection.ps1 | 0 .../New-VaultOrgCollection.ps1 | 0 .../Remove-VaultOrgCollection.ps1 | 0 .../Update-VaultOrgCollection.ps1 | 0 .../Vault API/Folders/Get-VaultFolder.ps1 | 0 .../Vault API/Folders/Remove-VaultFolder.ps1 | 0 .../Vault API/Folders/Update-VaultFolder.ps1 | 0 .../Public/Vault API/Items/Get-VaultItem.ps1 | 0 .../Public/Vault API/Items/New-VaultItem.ps1 | 0 .../Vault API/Items/Remove-VaultItem.ps1 | 0 .../Vault API/Items/Restore-VaultItem.ps1 | 0 .../Vault API/Items/Update-VaultItem.ps1 | 0 .../Vault API/Lock & Unlock/Lock-Vault.ps1 | 0 .../Vault API/Lock & Unlock/Unlock-Vault.ps1 | 0 .../Miscellaneous/Get-VaultStatus.ps1 | 0 .../Miscellaneous/Get-VaultTemplate.ps1 | 0 .../Vault API/Miscellaneous/New-Password.ps1 | 0 .../Vault API/Miscellaneous/Sync-Vault.ps1 | 0 .../Vault API/REST/Start-RestServer.ps1 | 0 .../Public/Vault API/REST/Stop-RestServer.ps1 | 0 .../Public/Vault API/Send/Get-Send.ps1 | 0 .../Public/Vault API/Send/New-Send.ps1 | 0 .../Public/Vault API/Send/Remove-Send.ps1 | 0 .../Public/Vault API/Send/Update-Send.ps1 | 0 Output/BitwardenPS/BitwardenPS.psd1 | 131 + Output/BitwardenPS/BitwardenPS.psm1 | 2111 +++++++++++++++++ README.md | 2 +- build.psd1 | 2 +- 56 files changed, 2245 insertions(+), 4 deletions(-) rename Bitwarden/Bitwarden.psd1 => BitwardenPS/BitwardenPS.psd1 (98%) rename Bitwarden/Bitwarden.psm1 => BitwardenPS/BitwardenPS.psm1 (100%) rename {Bitwarden => BitwardenPS}/Private/Invoke/Invoke-PublicApi.ps1 (100%) rename {Bitwarden => BitwardenPS}/Private/Invoke/Invoke-VaultApi.ps1 (100%) rename {Bitwarden => BitwardenPS}/Private/Invoke/Invoke-VaultCli.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Public API/Collections/Get-PublicCollections.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Public API/Connect/Connect-PublicApi.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Public API/Events/Get-PublicEvents.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Public API/Groups/Get-PublicGroupMemberIds.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Public API/Groups/Get-PublicGroups.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Public API/Members/Get-PublicMemberGroupIds.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Public API/Members/Get-PublicMembers.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Public API/Members/Send-PublicMemberInvite.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Attachments & Fields/Get-VaultAttachment.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Attachments & Fields/Get-VaultItemNotes.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Attachments & Fields/Get-VaultItemPassword.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Attachments & Fields/Get-VaultItemPwExposed.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Attachments & Fields/Get-VaultItemTotp.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Attachments & Fields/Get-VaultItemUri.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Attachments & Fields/Get-VaultItemUsername.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Attachments & Fields/New-VaultAttachment.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Attachments & Fields/Remove-VaultAttachment.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Collections & Organizations/Confirm-VaultOrgMember.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Collections & Organizations/Get-VaultCollections.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Collections & Organizations/Get-VaultOrgCollection.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Collections & Organizations/Get-VaultOrgMembers.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Collections & Organizations/Get-VaultOrgs.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Collections & Organizations/Move-VaultItemToCollection.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Collections & Organizations/New-VaultOrgCollection.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Collections & Organizations/Remove-VaultOrgCollection.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Collections & Organizations/Update-VaultOrgCollection.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Folders/Get-VaultFolder.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Folders/Remove-VaultFolder.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Folders/Update-VaultFolder.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Items/Get-VaultItem.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Items/New-VaultItem.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Items/Remove-VaultItem.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Items/Restore-VaultItem.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Items/Update-VaultItem.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Lock & Unlock/Lock-Vault.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Lock & Unlock/Unlock-Vault.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Miscellaneous/Get-VaultStatus.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Miscellaneous/Get-VaultTemplate.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Miscellaneous/New-Password.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Miscellaneous/Sync-Vault.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/REST/Start-RestServer.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/REST/Stop-RestServer.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Send/Get-Send.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Send/New-Send.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Send/Remove-Send.ps1 (100%) rename {Bitwarden => BitwardenPS}/Public/Vault API/Send/Update-Send.ps1 (100%) create mode 100644 Output/BitwardenPS/BitwardenPS.psd1 create mode 100644 Output/BitwardenPS/BitwardenPS.psm1 diff --git a/.gitignore b/.gitignore index a9b5493..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +0,0 @@ -Output\ \ No newline at end of file diff --git a/Bitwarden/Bitwarden.psd1 b/BitwardenPS/BitwardenPS.psd1 similarity index 98% rename from Bitwarden/Bitwarden.psd1 rename to BitwardenPS/BitwardenPS.psd1 index ea37fcf..117ca70 100644 --- a/Bitwarden/Bitwarden.psd1 +++ b/BitwardenPS/BitwardenPS.psd1 @@ -9,7 +9,7 @@ @{ # Script module or binary module file associated with this manifest. - RootModule = 'Bitwarden.psm1' + RootModule = 'BitwardenPS.psm1' # Version number of this module. ModuleVersion = '1.0.0.0' diff --git a/Bitwarden/Bitwarden.psm1 b/BitwardenPS/BitwardenPS.psm1 similarity index 100% rename from Bitwarden/Bitwarden.psm1 rename to BitwardenPS/BitwardenPS.psm1 diff --git a/Bitwarden/Private/Invoke/Invoke-PublicApi.ps1 b/BitwardenPS/Private/Invoke/Invoke-PublicApi.ps1 similarity index 100% rename from Bitwarden/Private/Invoke/Invoke-PublicApi.ps1 rename to BitwardenPS/Private/Invoke/Invoke-PublicApi.ps1 diff --git a/Bitwarden/Private/Invoke/Invoke-VaultApi.ps1 b/BitwardenPS/Private/Invoke/Invoke-VaultApi.ps1 similarity index 100% rename from Bitwarden/Private/Invoke/Invoke-VaultApi.ps1 rename to BitwardenPS/Private/Invoke/Invoke-VaultApi.ps1 diff --git a/Bitwarden/Private/Invoke/Invoke-VaultCli.ps1 b/BitwardenPS/Private/Invoke/Invoke-VaultCli.ps1 similarity index 100% rename from Bitwarden/Private/Invoke/Invoke-VaultCli.ps1 rename to BitwardenPS/Private/Invoke/Invoke-VaultCli.ps1 diff --git a/Bitwarden/Public/Public API/Collections/Get-PublicCollections.ps1 b/BitwardenPS/Public/Public API/Collections/Get-PublicCollections.ps1 similarity index 100% rename from Bitwarden/Public/Public API/Collections/Get-PublicCollections.ps1 rename to BitwardenPS/Public/Public API/Collections/Get-PublicCollections.ps1 diff --git a/Bitwarden/Public/Public API/Connect/Connect-PublicApi.ps1 b/BitwardenPS/Public/Public API/Connect/Connect-PublicApi.ps1 similarity index 100% rename from Bitwarden/Public/Public API/Connect/Connect-PublicApi.ps1 rename to BitwardenPS/Public/Public API/Connect/Connect-PublicApi.ps1 diff --git a/Bitwarden/Public/Public API/Events/Get-PublicEvents.ps1 b/BitwardenPS/Public/Public API/Events/Get-PublicEvents.ps1 similarity index 100% rename from Bitwarden/Public/Public API/Events/Get-PublicEvents.ps1 rename to BitwardenPS/Public/Public API/Events/Get-PublicEvents.ps1 diff --git a/Bitwarden/Public/Public API/Groups/Get-PublicGroupMemberIds.ps1 b/BitwardenPS/Public/Public API/Groups/Get-PublicGroupMemberIds.ps1 similarity index 100% rename from Bitwarden/Public/Public API/Groups/Get-PublicGroupMemberIds.ps1 rename to BitwardenPS/Public/Public API/Groups/Get-PublicGroupMemberIds.ps1 diff --git a/Bitwarden/Public/Public API/Groups/Get-PublicGroups.ps1 b/BitwardenPS/Public/Public API/Groups/Get-PublicGroups.ps1 similarity index 100% rename from Bitwarden/Public/Public API/Groups/Get-PublicGroups.ps1 rename to BitwardenPS/Public/Public API/Groups/Get-PublicGroups.ps1 diff --git a/Bitwarden/Public/Public API/Members/Get-PublicMemberGroupIds.ps1 b/BitwardenPS/Public/Public API/Members/Get-PublicMemberGroupIds.ps1 similarity index 100% rename from Bitwarden/Public/Public API/Members/Get-PublicMemberGroupIds.ps1 rename to BitwardenPS/Public/Public API/Members/Get-PublicMemberGroupIds.ps1 diff --git a/Bitwarden/Public/Public API/Members/Get-PublicMembers.ps1 b/BitwardenPS/Public/Public API/Members/Get-PublicMembers.ps1 similarity index 100% rename from Bitwarden/Public/Public API/Members/Get-PublicMembers.ps1 rename to BitwardenPS/Public/Public API/Members/Get-PublicMembers.ps1 diff --git a/Bitwarden/Public/Public API/Members/Send-PublicMemberInvite.ps1 b/BitwardenPS/Public/Public API/Members/Send-PublicMemberInvite.ps1 similarity index 100% rename from Bitwarden/Public/Public API/Members/Send-PublicMemberInvite.ps1 rename to BitwardenPS/Public/Public API/Members/Send-PublicMemberInvite.ps1 diff --git a/Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultAttachment.ps1 b/BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultAttachment.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultAttachment.ps1 rename to BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultAttachment.ps1 diff --git a/Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemNotes.ps1 b/BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemNotes.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemNotes.ps1 rename to BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemNotes.ps1 diff --git a/Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemPassword.ps1 b/BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemPassword.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemPassword.ps1 rename to BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemPassword.ps1 diff --git a/Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemPwExposed.ps1 b/BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemPwExposed.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemPwExposed.ps1 rename to BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemPwExposed.ps1 diff --git a/Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemTotp.ps1 b/BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemTotp.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemTotp.ps1 rename to BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemTotp.ps1 diff --git a/Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemUri.ps1 b/BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemUri.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemUri.ps1 rename to BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemUri.ps1 diff --git a/Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemUsername.ps1 b/BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemUsername.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Attachments & Fields/Get-VaultItemUsername.ps1 rename to BitwardenPS/Public/Vault API/Attachments & Fields/Get-VaultItemUsername.ps1 diff --git a/Bitwarden/Public/Vault API/Attachments & Fields/New-VaultAttachment.ps1 b/BitwardenPS/Public/Vault API/Attachments & Fields/New-VaultAttachment.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Attachments & Fields/New-VaultAttachment.ps1 rename to BitwardenPS/Public/Vault API/Attachments & Fields/New-VaultAttachment.ps1 diff --git a/Bitwarden/Public/Vault API/Attachments & Fields/Remove-VaultAttachment.ps1 b/BitwardenPS/Public/Vault API/Attachments & Fields/Remove-VaultAttachment.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Attachments & Fields/Remove-VaultAttachment.ps1 rename to BitwardenPS/Public/Vault API/Attachments & Fields/Remove-VaultAttachment.ps1 diff --git a/Bitwarden/Public/Vault API/Collections & Organizations/Confirm-VaultOrgMember.ps1 b/BitwardenPS/Public/Vault API/Collections & Organizations/Confirm-VaultOrgMember.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Collections & Organizations/Confirm-VaultOrgMember.ps1 rename to BitwardenPS/Public/Vault API/Collections & Organizations/Confirm-VaultOrgMember.ps1 diff --git a/Bitwarden/Public/Vault API/Collections & Organizations/Get-VaultCollections.ps1 b/BitwardenPS/Public/Vault API/Collections & Organizations/Get-VaultCollections.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Collections & Organizations/Get-VaultCollections.ps1 rename to BitwardenPS/Public/Vault API/Collections & Organizations/Get-VaultCollections.ps1 diff --git a/Bitwarden/Public/Vault API/Collections & Organizations/Get-VaultOrgCollection.ps1 b/BitwardenPS/Public/Vault API/Collections & Organizations/Get-VaultOrgCollection.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Collections & Organizations/Get-VaultOrgCollection.ps1 rename to BitwardenPS/Public/Vault API/Collections & Organizations/Get-VaultOrgCollection.ps1 diff --git a/Bitwarden/Public/Vault API/Collections & Organizations/Get-VaultOrgMembers.ps1 b/BitwardenPS/Public/Vault API/Collections & Organizations/Get-VaultOrgMembers.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Collections & Organizations/Get-VaultOrgMembers.ps1 rename to BitwardenPS/Public/Vault API/Collections & Organizations/Get-VaultOrgMembers.ps1 diff --git a/Bitwarden/Public/Vault API/Collections & Organizations/Get-VaultOrgs.ps1 b/BitwardenPS/Public/Vault API/Collections & Organizations/Get-VaultOrgs.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Collections & Organizations/Get-VaultOrgs.ps1 rename to BitwardenPS/Public/Vault API/Collections & Organizations/Get-VaultOrgs.ps1 diff --git a/Bitwarden/Public/Vault API/Collections & Organizations/Move-VaultItemToCollection.ps1 b/BitwardenPS/Public/Vault API/Collections & Organizations/Move-VaultItemToCollection.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Collections & Organizations/Move-VaultItemToCollection.ps1 rename to BitwardenPS/Public/Vault API/Collections & Organizations/Move-VaultItemToCollection.ps1 diff --git a/Bitwarden/Public/Vault API/Collections & Organizations/New-VaultOrgCollection.ps1 b/BitwardenPS/Public/Vault API/Collections & Organizations/New-VaultOrgCollection.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Collections & Organizations/New-VaultOrgCollection.ps1 rename to BitwardenPS/Public/Vault API/Collections & Organizations/New-VaultOrgCollection.ps1 diff --git a/Bitwarden/Public/Vault API/Collections & Organizations/Remove-VaultOrgCollection.ps1 b/BitwardenPS/Public/Vault API/Collections & Organizations/Remove-VaultOrgCollection.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Collections & Organizations/Remove-VaultOrgCollection.ps1 rename to BitwardenPS/Public/Vault API/Collections & Organizations/Remove-VaultOrgCollection.ps1 diff --git a/Bitwarden/Public/Vault API/Collections & Organizations/Update-VaultOrgCollection.ps1 b/BitwardenPS/Public/Vault API/Collections & Organizations/Update-VaultOrgCollection.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Collections & Organizations/Update-VaultOrgCollection.ps1 rename to BitwardenPS/Public/Vault API/Collections & Organizations/Update-VaultOrgCollection.ps1 diff --git a/Bitwarden/Public/Vault API/Folders/Get-VaultFolder.ps1 b/BitwardenPS/Public/Vault API/Folders/Get-VaultFolder.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Folders/Get-VaultFolder.ps1 rename to BitwardenPS/Public/Vault API/Folders/Get-VaultFolder.ps1 diff --git a/Bitwarden/Public/Vault API/Folders/Remove-VaultFolder.ps1 b/BitwardenPS/Public/Vault API/Folders/Remove-VaultFolder.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Folders/Remove-VaultFolder.ps1 rename to BitwardenPS/Public/Vault API/Folders/Remove-VaultFolder.ps1 diff --git a/Bitwarden/Public/Vault API/Folders/Update-VaultFolder.ps1 b/BitwardenPS/Public/Vault API/Folders/Update-VaultFolder.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Folders/Update-VaultFolder.ps1 rename to BitwardenPS/Public/Vault API/Folders/Update-VaultFolder.ps1 diff --git a/Bitwarden/Public/Vault API/Items/Get-VaultItem.ps1 b/BitwardenPS/Public/Vault API/Items/Get-VaultItem.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Items/Get-VaultItem.ps1 rename to BitwardenPS/Public/Vault API/Items/Get-VaultItem.ps1 diff --git a/Bitwarden/Public/Vault API/Items/New-VaultItem.ps1 b/BitwardenPS/Public/Vault API/Items/New-VaultItem.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Items/New-VaultItem.ps1 rename to BitwardenPS/Public/Vault API/Items/New-VaultItem.ps1 diff --git a/Bitwarden/Public/Vault API/Items/Remove-VaultItem.ps1 b/BitwardenPS/Public/Vault API/Items/Remove-VaultItem.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Items/Remove-VaultItem.ps1 rename to BitwardenPS/Public/Vault API/Items/Remove-VaultItem.ps1 diff --git a/Bitwarden/Public/Vault API/Items/Restore-VaultItem.ps1 b/BitwardenPS/Public/Vault API/Items/Restore-VaultItem.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Items/Restore-VaultItem.ps1 rename to BitwardenPS/Public/Vault API/Items/Restore-VaultItem.ps1 diff --git a/Bitwarden/Public/Vault API/Items/Update-VaultItem.ps1 b/BitwardenPS/Public/Vault API/Items/Update-VaultItem.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Items/Update-VaultItem.ps1 rename to BitwardenPS/Public/Vault API/Items/Update-VaultItem.ps1 diff --git a/Bitwarden/Public/Vault API/Lock & Unlock/Lock-Vault.ps1 b/BitwardenPS/Public/Vault API/Lock & Unlock/Lock-Vault.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Lock & Unlock/Lock-Vault.ps1 rename to BitwardenPS/Public/Vault API/Lock & Unlock/Lock-Vault.ps1 diff --git a/Bitwarden/Public/Vault API/Lock & Unlock/Unlock-Vault.ps1 b/BitwardenPS/Public/Vault API/Lock & Unlock/Unlock-Vault.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Lock & Unlock/Unlock-Vault.ps1 rename to BitwardenPS/Public/Vault API/Lock & Unlock/Unlock-Vault.ps1 diff --git a/Bitwarden/Public/Vault API/Miscellaneous/Get-VaultStatus.ps1 b/BitwardenPS/Public/Vault API/Miscellaneous/Get-VaultStatus.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Miscellaneous/Get-VaultStatus.ps1 rename to BitwardenPS/Public/Vault API/Miscellaneous/Get-VaultStatus.ps1 diff --git a/Bitwarden/Public/Vault API/Miscellaneous/Get-VaultTemplate.ps1 b/BitwardenPS/Public/Vault API/Miscellaneous/Get-VaultTemplate.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Miscellaneous/Get-VaultTemplate.ps1 rename to BitwardenPS/Public/Vault API/Miscellaneous/Get-VaultTemplate.ps1 diff --git a/Bitwarden/Public/Vault API/Miscellaneous/New-Password.ps1 b/BitwardenPS/Public/Vault API/Miscellaneous/New-Password.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Miscellaneous/New-Password.ps1 rename to BitwardenPS/Public/Vault API/Miscellaneous/New-Password.ps1 diff --git a/Bitwarden/Public/Vault API/Miscellaneous/Sync-Vault.ps1 b/BitwardenPS/Public/Vault API/Miscellaneous/Sync-Vault.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Miscellaneous/Sync-Vault.ps1 rename to BitwardenPS/Public/Vault API/Miscellaneous/Sync-Vault.ps1 diff --git a/Bitwarden/Public/Vault API/REST/Start-RestServer.ps1 b/BitwardenPS/Public/Vault API/REST/Start-RestServer.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/REST/Start-RestServer.ps1 rename to BitwardenPS/Public/Vault API/REST/Start-RestServer.ps1 diff --git a/Bitwarden/Public/Vault API/REST/Stop-RestServer.ps1 b/BitwardenPS/Public/Vault API/REST/Stop-RestServer.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/REST/Stop-RestServer.ps1 rename to BitwardenPS/Public/Vault API/REST/Stop-RestServer.ps1 diff --git a/Bitwarden/Public/Vault API/Send/Get-Send.ps1 b/BitwardenPS/Public/Vault API/Send/Get-Send.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Send/Get-Send.ps1 rename to BitwardenPS/Public/Vault API/Send/Get-Send.ps1 diff --git a/Bitwarden/Public/Vault API/Send/New-Send.ps1 b/BitwardenPS/Public/Vault API/Send/New-Send.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Send/New-Send.ps1 rename to BitwardenPS/Public/Vault API/Send/New-Send.ps1 diff --git a/Bitwarden/Public/Vault API/Send/Remove-Send.ps1 b/BitwardenPS/Public/Vault API/Send/Remove-Send.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Send/Remove-Send.ps1 rename to BitwardenPS/Public/Vault API/Send/Remove-Send.ps1 diff --git a/Bitwarden/Public/Vault API/Send/Update-Send.ps1 b/BitwardenPS/Public/Vault API/Send/Update-Send.ps1 similarity index 100% rename from Bitwarden/Public/Vault API/Send/Update-Send.ps1 rename to BitwardenPS/Public/Vault API/Send/Update-Send.ps1 diff --git a/Output/BitwardenPS/BitwardenPS.psd1 b/Output/BitwardenPS/BitwardenPS.psd1 new file mode 100644 index 0000000..2fa7d36 --- /dev/null +++ b/Output/BitwardenPS/BitwardenPS.psd1 @@ -0,0 +1,131 @@ +# +# Module manifest for module 'Bitwarden' +# +# Generated by: John Duprey +# +# Generated on: 9/27/2022 +# + +@{ + + # Script module or binary module file associated with this manifest. + RootModule = 'BitwardenPS.psm1' + + # Version number of this module. + ModuleVersion = '1.0.0.0' + + # Supported PSEditions + # CompatiblePSEditions = @() + + # ID used to uniquely identify this module + GUID = 'd0d54383-4174-44a2-94c4-e21b5213a83f' + + # Author of this module + Author = 'John Duprey' + + # Company or vendor of this module + CompanyName = '' + + # Copyright statement for this module + Copyright = '2022 John Duprey' + + # Description of the functionality provided by this module + Description = 'Bitwarden REST API module' + + # Minimum version of the PowerShell engine required by this module + PowerShellVersion = '7.0' + + # Name of the PowerShell host required by this module + # PowerShellHostName = '' + + # Minimum version of the PowerShell host required by this module + # PowerShellHostVersion = '' + + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # DotNetFrameworkVersion = '' + + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # ClrVersion = '' + + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' + + # Modules that must be imported into the global environment prior to importing this module + #RequiredModules = @('') + + # Assemblies that must be loaded prior to importing this module + # RequiredAssemblies = @() + + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + ScriptsToProcess = @() + + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = @() + + # Format files (.ps1xml) to be loaded when importing this module + # FormatsToProcess = @() + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + # NestedModules = @() + + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = @('Get-PublicCollections','Connect-PublicApi','Get-PublicEvents','Get-PublicGroupMemberIds','Get-PublicGroups','Get-PublicMemberGroupIds','Get-PublicMembers','Send-PublicMemberInvite','Get-VaultAttachment','Get-VaultItemNotes','Get-VaultItemPassword','Get-VaultItemPwExposed','Get-VaultItemTotp','Get-VaultItemUri','Get-VaultItemUsername','New-VaultAttachment','Remove-VaultAttachment','Confirm-VaultOrgMember','Get-VaultCollections','Get-VaultOrgCollection','Get-VaultOrgMembers','Get-VaultOrgs','Move-VaultItemToCollection','New-VaultOrgCollection','Remove-VaultOrgCollection','Update-VaultOrgCollection','Get-VaultFolder','Remove-VaultFolder','Update-VaultFolder','Get-VaultItem','New-VaultItem','Remove-VaultItem','Restore-VaultItem','Update-VaultItem','Lock-Vault','Unlock-Vault','Get-VaultStatus','Get-VaultTemplate','New-Password','Sync-Vault','Start-RestServer','Stop-RestServer','Get-Send','New-Send','Remove-Send','Update-Send') + + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + #CmdletsToExport = '*' + + # Variables to export from this module + #VariablesToExport = '*' + + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + #AliasesToExport = '*' + + # DSC resources to export from this module + # DscResourcesToExport = @() + + # List of all modules packaged with this module + # ModuleList = @() + + # List of all files packaged with this module + # FileList = @() + + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + # Tags = @() + + # A URL to the license for this module. + # LicenseUri = '' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/johnduprey/BitwardenPS' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + # Prerelease string of this module + # Prerelease = '' + + # Flag to indicate whether the module requires explicit user acceptance for install/update/save + # RequireLicenseAcceptance = $false + + # External dependent modules of this module + #ExternalModuleDependencies = @() + + } # End of PSData hashtable + + } # End of PrivateData hashtable + + # HelpInfo URI of this module + # HelpInfoURI = '' + + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + DefaultCommandPrefix = 'Bw' + +} diff --git a/Output/BitwardenPS/BitwardenPS.psm1 b/Output/BitwardenPS/BitwardenPS.psm1 new file mode 100644 index 0000000..ea2bafc --- /dev/null +++ b/Output/BitwardenPS/BitwardenPS.psm1 @@ -0,0 +1,2111 @@ +#Region '.\Private\Invoke\Invoke-PublicApi.ps1' 0 +function Invoke-PublicApi { + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Endpoint, + [ValidateSet('Get', 'Put', 'Post', 'Delete')] + $Method = 'Get', + $Body = '' + ) + + if (!$script:BwPublicApi) { + Write-Error 'Not connected to Bitwarden Public API' + return $false + } + + $Uri = 'https://{0}/{1}' -f $script:BwPublicApi.Server, $Endpoint + + $Headers = @{ + Authorization = ('Bearer {0}' -f $script:BwPublicApi.Token) + 'Content-Type' = 'application/json' + } + + if ($Method -eq 'Post') { + if ($Body -ne '') { + $RestMethod.Body = $Body + } + } + + $RestMethod = @{ + Uri = $Uri + Method = $Method + Headers = $Headers + } + + Write-Verbose ($RestMethod | ConvertTo-Json) + $Response = Invoke-RestMethod @RestMethod -SkipHttpErrorCheck + if ($Response.data) { + $Response.data + } + else { + $Response + } +} +#EndRegion '.\Private\Invoke\Invoke-PublicApi.ps1' 44 +#Region '.\Private\Invoke\Invoke-VaultApi.ps1' 0 +function Invoke-VaultApi { + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Endpoint, + [ValidateSet('Get', 'Put', 'Post', 'Delete')] + $Method = 'Get', + $QueryParams = '', + $Body = '', + $ContentType = 'application/json', + $OutFile = '' + ) + + if (!$script:BwRestServer.Hostname) { + Start-BwRestServer | Out-Null + } + + $Uri = 'http://{0}:{1}/{2}' -f $script:BwRestServer.Hostname, $script:BwRestServer.Port, $Endpoint + + if ($QueryParams -ne '') { + $UriBuilder = [System.UriBuilder]$Uri + $UriBuilder.Query = $QueryParams.ToString() + $Uri = $UriBuilder.Uri.OriginalString + } + + Write-Verbose $Uri + + $Headers = @{ + 'Accept' = 'application/json' + } + $RestMethod = @{ + Uri = $Uri + Method = $Method + } + + if ($Method -eq 'Post' -or $Method -eq 'Put') { + $headers.'Content-Type' = $ContentType + if ($Body -ne '') { + $RestMethod.Body = $Body + } + $RestMethod.Headers = $Headers + } + Write-Verbose ($Headers | ConvertTo-Json) + + if ($OutFile) { + Invoke-WebRequest @RestMethod -OutFile $OutFile + } + else { + Invoke-RestMethod @RestMethod -SkipHttpErrorCheck + } +} +#EndRegion '.\Private\Invoke\Invoke-VaultApi.ps1' 52 +#Region '.\Private\Invoke\Invoke-VaultCli.ps1' 0 +function Invoke-VaultCli { + <# + .SYNOPSIS + Runs Bitwarden Cli commands + + .DESCRIPTION + Calls bw command + + #> + [cmdletbinding()] + Param( + $Arguments + ) + + $bw = Get-Command bw + if (!$bw) { + Write-Error 'Bitwarden CLI is not installed' + return $false + } + + $pinfo = New-Object System.Diagnostics.ProcessStartInfo + $pinfo.FileName = $bw.Path + $pinfo.RedirectStandardError = $false + $pinfo.RedirectStandardOutput = $true + $pinfo.UseShellExecute = $false + $pinfo.Arguments = $Arguments + $p = New-Object System.Diagnostics.Process + $p.StartInfo = $pinfo + $p.Start() | Out-Null + $p.WaitForExit() + $stdout = $p.StandardOutput.ReadToEnd() + $stdout | ConvertFrom-Json +} +#EndRegion '.\Private\Invoke\Invoke-VaultCli.ps1' 34 +#Region '.\Public\Public API\Collections\Get-PublicCollections.ps1' 0 +function Get-PublicCollections { + [CmdletBinding()] + Param( + $Id = '' + ) + $Endpoint = 'public/collections' + + if ($Id -ne '') { + $Endpoint = '{0}/{1}' -f $Endpoint, $Id + } + Invoke-PublicApi -Endpoint $Endpoint +} +#EndRegion '.\Public\Public API\Collections\Get-PublicCollections.ps1' 13 +#Region '.\Public\Public API\Connect\Connect-PublicApi.ps1' 0 +function Connect-PublicApi { + <# + .SYNOPSIS + Connects to Bitwarden Public API + + .DESCRIPTION + Generates OAuth token to interact with public API + + .PARAMETER Credentials + Client ID and Secret in PSCredential object + + .PARAMETER Server + Bitwarden identity server hostname, default identity.bitwarden.com + + #> + [CmdletBinding()] + Param( + [pscredential]$Credentials = (Get-Credential -Message 'Enter ClientID and Secret'), + $Server = 'identity.bitwarden.com' + ) + + if ($Server -eq 'identity.bitwarden.com') { + $ApiServer = 'api.bitwarden.com' + $Uri = 'https://{0}/connect/token' -f $Server + } + else { + $ApiServer = $Server + $Uri = 'https://{0}/identity/connect/token' -f $Server + } + $AuthRequest = @{ + Uri = $Uri + ContentType = 'application/x-www-form-urlencoded' + Body = @{ + grant_type = 'client_credentials' + scope = 'api.organization' + client_id = $Credentials.GetNetworkCredential().UserName + client_secret = $Credentials.GetNetworkCredential().Password + } + } + + $Response = Invoke-RestMethod @AuthRequest -Method Post -SkipHttpErrorCheck + + if ($Response) { + Write-Verbose 'Connected to the Bitwarden Public API' + $script:BwPublicApi = @{ + Token = $Response.access_token + Server = $ApiServer + } + $true + } + else { + Write-Error $Response + $false + } + +} +#EndRegion '.\Public\Public API\Connect\Connect-PublicApi.ps1' 57 +#Region '.\Public\Public API\Events\Get-PublicEvents.ps1' 0 +function Get-PublicEvents { + <# + .SYNOPSIS + Gets Bitwarden events + + .DESCRIPTION + Calls the /public/events endpoint to retrieve audit trail + + #> + [CmdletBinding()] + Param() + + $EventMsg = [PSCustomObject]@{ + '1000' = 'Logged In' + '1001' = 'Changed account password' + '1002' = 'Enabled/updated two-step login' + '1003' = 'Disabled two-step login' + '1004' = 'Recovered account from two-step login' + '1005' = 'Login attempted failed with incorrect password' + '1006' = 'Login attempt failed with incorrect two-step login' + '1007' = 'User exported their individual vault items' + '1008' = 'User updated a password issued through Admin Password Reset' + '1009' = 'User migrated their decryption key with Key Connector' + '1100' = 'Created item item-identifier' + '1101' = 'Edited item item-identifier' + '1102' = 'Permanently Deleted item item-identifier' + '1103' = 'Created attachment for item item-identifier' + '1104' = 'Deleted attachment for item item-identifier' + '1105' = 'Shared item item-identifier' + '1106' = 'Edited collections for item item-identifier' + '1107' = 'Viewed item item-identifier' + '1108' = 'Viewed password for item item-identifier' + '1109' = 'Viewed hidden field for item item-identifier' + '1110' = 'Viewed security code for item item-identifier' + '1111' = 'Copied password for item item-identifier' + '1112' = 'Copied hidden field for item item-identifier' + '1113' = 'Copied security code for item item-identifier' + '1114' = 'Auto-filled item item-identifier' + '1115' = 'Sent item item-identifier to trash' + '1116' = 'Restored item item-identifier' + '1117' = 'Viewed Card Number for item item-identifier' + '1300' = 'Created collection collection-identifier' + '1301' = 'Edited collection collection-identifier' + '1302' = 'Deleted collection collection-identifier' + '1400' = 'Created group group-identifier' + '1401' = 'Edited group group-identifier' + '1402' = 'Deleted group group-identifier' + '1500' = 'Invited user user-identifier' + '1501' = 'Confirmed user user-identifier' + '1502' = 'Edited user user-identifier' + '1503' = 'Removed user user-identifier' + '1504' = 'Edited groups for user user-identifier' + '1505' = 'Unlinked SSO' + '1506' = 'user-identifier enrolled in Master Password Reset' + '1507' = 'user-identifier withdrew from Master Password Reset' + '1508' = 'Master Password was reset for user-identifier' + '1509' = 'Reset SSO link for user user-identifier' + '1510' = 'user-identifer logged in using SSO for the first time' + '1511' = 'Revoked organization access for user-identifier' + '1512' = 'Restores organization access for user-identifier' + '1600' = 'Edited organization settings' + '1601' = 'Purged organization vault' + '1603' = 'Organization Vault access by a managing Provider' + '1604' = 'Organization enabled SSO' + '1605' = 'Organization disabled SSO' + '1606' = 'Organization enabled Key Connector' + '1607' = 'Organization disabled Key Connector' + '1608' = 'Families Sponsorships synced' + '1700' = 'Updated a Policy' + } + + $Endpoint = 'public/events' + $Events = Invoke-PublicApi -Endpoint $Endpoint + $Members = Get-PublicMembers + $Groups = Get-PublicGroups + + foreach ($Event in $Events) { + if ($Event.groupId) { $GroupName = ($Groups | Where-Object { $_.id -eq $Event.groupId }).name } + if ($Event.memberId) { $MemberEmail = ($Members | Where-Object { $_.userId -eq $Event.memberId }).email } + $ActingUser = ($Members | Where-Object { $_.userId -eq $Event.actingUserId }).email + $TypeId = $Event.type + $Message = $EventMsg.$TypeId -replace 'item-identifier', $Event.itemId -replace 'collection-identifier', $Event.collectionId -replace 'group-identifier', $GroupName -replace 'member-identifier', $MemberEmail -replace 'user-identifier', $ActingUser + + [PSCustomObject]@{ + message = $Message + type = $Event.type + itemId = $Event.itemId + collectionId = $Event.collectionId + groupId = $Event.groupId + policyId = $Event.policyId + memberId = $Event.memberId + actingUserId = $Event.actingUserId + actingUser = $ActingUser + date = $Event.date + ipAddress = $Event.ipAddress + } + } +} +#EndRegion '.\Public\Public API\Events\Get-PublicEvents.ps1' 99 +#Region '.\Public\Public API\Groups\Get-PublicGroupMemberIds.ps1' 0 +function Get-PublicGroupMemberIds { + <# + .SYNOPSIS + Short description + + .DESCRIPTION + Long description + + .PARAMETER Id + Parameter description + + .EXAMPLE + An example + + .NOTES + General notes + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Endpoint = 'public/groups/{0}/member-ids' -f $Id + Invoke-PublicApi -Endpoint $Endpoint +} +#EndRegion '.\Public\Public API\Groups\Get-PublicGroupMemberIds.ps1' 27 +#Region '.\Public\Public API\Groups\Get-PublicGroups.ps1' 0 +function Get-PublicGroups { + [CmdletBinding()] + Param( + $Id = '' + ) + $Endpoint = 'public/groups' + if ($Id -ne '') { + $Endpoint = '{0}/{1}' -f $Endpoint, $Id + } + Invoke-PublicApi -Endpoint $Endpoint +} +#EndRegion '.\Public\Public API\Groups\Get-PublicGroups.ps1' 12 +#Region '.\Public\Public API\Members\Get-PublicMemberGroupIds.ps1' 0 +function Get-PublicMemberGroupIds { + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Endpoint = 'public/members/{0}/group-ids' -f $Id + Invoke-PublicApi -Endpoint $Endpoint +} +#EndRegion '.\Public\Public API\Members\Get-PublicMemberGroupIds.ps1' 11 +#Region '.\Public\Public API\Members\Get-PublicMembers.ps1' 0 +function Get-PublicMembers { + [CmdletBinding()] + Param( + $Id = '' + ) + $Endpoint = 'public/members' + if ($Id -ne '') { + $Endpoint = '{0}/{1}' -f $Endpoint, $Id + } + Invoke-PublicApi -Endpoint $Endpoint +} +#EndRegion '.\Public\Public API\Members\Get-PublicMembers.ps1' 12 +#Region '.\Public\Public API\Members\Send-PublicMemberInvite.ps1' 0 +function Send-PublicMemberInvite { + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + $Endpoint = 'public/members/{0}/reinvite' -f $id + + Invoke-PublicApi -Endpoint $Endpoint -Method Post +} +#EndRegion '.\Public\Public API\Members\Send-PublicMemberInvite.ps1' 11 +#Region '.\Public\Vault API\Attachments & Fields\Get-VaultAttachment.ps1' 0 +function Get-VaultAttachment { + <# + .SYNOPSIS + Gets Bitwarden Vault Attachments + + .DESCRIPTION + Calls Get /object/attachment/{id} to download attachments + + .PARAMETER Id + Attachment id + + .PARAMETER ItemId + Item Guid + + .PARAMETER FilePath + Path to save file + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id, + [Parameter(Mandatory = $true)] + $ItemId, + $FilePath = '' + ) + + $Endpoint = 'object/attachment/{0}' -f $Id + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + $QueryParams.Add('itemid', $ItemId) | Out-Null + + $VaultApi = @{ + Endpoint = $Endpoint + QueryParams = $QueryParams + } + + if ($FilePath) { + $VaultApi.OutFile = $FilePath + } + + Invoke-VaultApi @VaultApi +} +#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultAttachment.ps1' 46 +#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemNotes.ps1' 0 +function Get-VaultItemNotes { + <# + .SYNOPSIS + Returns Notes of a vault item + + .DESCRIPTION + Calls /object/notes/{id} endpoint to retrieve notes + + .PARAMETER Id + Item guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Request = Invoke-VaultApi -Endpoint ('object/notes/{0}' -f $Id) + if ($Request.success) { + $Request.data.data + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemNotes.ps1' 31 +#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemPassword.ps1' 0 +function Get-VaultItemPassword { + <# + .SYNOPSIS + Returns password of a vault item + + .DESCRIPTION + Calls /object/password/{id} endpoint to retrieve password + + .PARAMETER Id + Item guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Request = Invoke-VaultApi -Endpoint ('object/password/{0}' -f $Id) + if ($Request.success) { + $Request.data.data + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemPassword.ps1' 31 +#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemPwExposed.ps1' 0 +function Get-VaultItemPwExposed { + <# + .SYNOPSIS + Returns count of times a vault item password has been exposed + + .DESCRIPTION + Calls /object/exposed/{id} endpoint to retrieve count + + .PARAMETER Id + Item guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Request = Invoke-VaultApi -Endpoint ('object/exposed/{0}' -f $Id) + if ($Request.success) { + $Request.data.data + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemPwExposed.ps1' 31 +#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemTotp.ps1' 0 +function Get-VaultItemTotp { + <# + .SYNOPSIS + Returns TOTP of a vault item + + .DESCRIPTION + Calls /object/totp/{id} endpoint to retrieve TOTP + + .PARAMETER Id + Item guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Request = Invoke-VaultApi -Endpoint ('object/totp/{0}' -f $Id) + if ($Request.success) { + $Request.data.data + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemTotp.ps1' 31 +#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemUri.ps1' 0 +function Get-VaultItemUri { + <# + .SYNOPSIS + Returns URI of a vault item + + .DESCRIPTION + Calls /object/uri/{id} endpoint to retrieve URI + + .PARAMETER Id + Item guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Request = Invoke-VaultApi -Endpoint ('object/uri/{0}' -f $Id) + if ($Request.success) { + $Request.data.data + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemUri.ps1' 31 +#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemUsername.ps1' 0 +function Get-VaultItemUsername { + <# + .SYNOPSIS + Returns username of a vault item + + .DESCRIPTION + Calls /object/username/{id} endpoint to retrieve username + + .PARAMETER Id + Item guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Request = Invoke-VaultApi -Endpoint ('object/username/{0}' -f $Id) + if ($Request.success) { + $Request.data.data + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemUsername.ps1' 31 +#Region '.\Public\Vault API\Attachments & Fields\New-VaultAttachment.ps1' 0 +function New-VaultAttachment { + <# + .SYNOPSIS + Creates attachment in vault + + .DESCRIPTION + POSTS multipart form data to /attachment + + .PARAMETER ItemId + Item guid + + .PARAMETER Content + String contents of file + + .PARAMETER FileName + Name of file to create + + .PARAMETER Path + Path to file instead of string contents + + #> + [cmdletbinding(DefaultParameterSetName = 'Content')] + Param ( + [parameter(Mandatory = $true)] + $ItemId, + + [parameter(ParameterSetName = 'Content', Mandatory = $True)] + [string]$Content, + [parameter(ParameterSetName = 'Content', Mandatory = $True)] + [string]$FileName, + + [validatescript({ Test-Path -PathType Leaf -Path $_ })] + [parameter(ParameterSetName = 'File', Mandatory = $True)] + [string]$Path + ) + Process { + $MultipartContent = [System.Net.Http.MultipartFormDataContent]::new() + $FileHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new('form-data') + $FileHeader.Name = 'file' + + if ($Content) { + $ByteArray = [System.Text.Encoding]::UTF8.GetBytes($Content) + $FileStream = New-Object -TypeName 'System.IO.MemoryStream' -ArgumentList (, $ByteArray) + } + else { + $FileName = Split-Path -Path $Path -Leaf + $FileStream = [System.IO.FileStream]::new($Path, [System.IO.FileMode]::Open) + } + + $FileContent = [System.Net.Http.StreamContent]::new($FileStream) + $FileHeader.FileName = $FileName + $FileContent.Headers.ContentDisposition = $fileHeader + $FileContent.Headers.ContentType = [System.Net.Http.Headers.MediaTypeHeaderValue]::Parse('multipart/form-data') + $MultipartContent.Add($FileContent) + + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + $QueryParams.Add('itemid', $ItemId) | Out-Null + + try { + $response = Invoke-VaultApi -Endpoint 'attachment' -QueryParams $QueryParams -Method Post -Body $MultipartContent -ContentType 'multipart/form-data' + } + catch { + Write-Error "Upload attachment failed: $_" + throw $_ + } + finally { + $fileStream.Close() + } + $response + } +} +#EndRegion '.\Public\Vault API\Attachments & Fields\New-VaultAttachment.ps1' 72 +#Region '.\Public\Vault API\Attachments & Fields\Remove-VaultAttachment.ps1' 0 +function Remove-VaultAttachment { + <# + .SYNOPSIS + Deletes Bitwarden Vault Attachments + + .DESCRIPTION + Calls DELETE /object/item/{id} to move items to the trash + + .PARAMETER Id + Attachment id + + .PARAMETER ItemId + Item Guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id, + [Parameter(Mandatory = $true)] + $ItemId + ) + + $Endpoint = 'object/attachment/{0}' -f $Id + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + $QueryParams.Add('itemid', $ItemId) | Out-Null + + $VaultApi = @{ + Method = 'Delete' + Endpoint = $Endpoint + Body = $Body + QueryParams = $QueryParams + } + + Invoke-VaultApi @VaultApi +} +#EndRegion '.\Public\Vault API\Attachments & Fields\Remove-VaultAttachment.ps1' 40 +#Region '.\Public\Vault API\Collections & Organizations\Confirm-VaultOrgMember.ps1' 0 +function Confirm-VaultOrgMember { + <# + .SYNOPSIS + Gets Bitwarden Vault Org Collections + + .DESCRIPTION + Calls /list/object/org-members + + .PARAMETER Id + Guid of Org Member + + .PARAMETER OrganizationId + Guid of Organization + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id, + [Parameter(Mandatory = $true)] + $OrganizationId + ) + + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + $QueryParams.Add('organizationid', $OrganizationId) | Out-Null + + $Endpoint = 'confirm/org-member/{0}' -f $Id + Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams +} +#EndRegion '.\Public\Vault API\Collections & Organizations\Confirm-VaultOrgMember.ps1' 33 +#Region '.\Public\Vault API\Collections & Organizations\Get-VaultCollections.ps1' 0 +function Get-VaultCollections { + <# + .SYNOPSIS + Gets Bitwarden Vault Collections + + .DESCRIPTION + Calls /list/object/collections + + .PARAMETER Search + Organization name to search for + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + $Search = '' + ) + + $Endpoint = 'list/object/collections' + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + if ($Search -ne '') { + $QueryParams.Add('search', $Search) | Out-Null + } + $Request = Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams + + if ($Request.success) { + $Request.data.data + } + else { + Write-Host $Request.message + $Request.success + } + +} +#EndRegion '.\Public\Vault API\Collections & Organizations\Get-VaultCollections.ps1' 37 +#Region '.\Public\Vault API\Collections & Organizations\Get-VaultOrgCollection.ps1' 0 +function Get-VaultOrgCollection { + <# + .SYNOPSIS + Gets Bitwarden Vault Org Collections + + .DESCRIPTION + Calls /list/object/org-collections or /object/org-collection/{id} + + .PARAMETER Id + Guid of Collection + + .PARAMETER OrganizationId + Guid of Organization + + .PARAMETER Search + Search parameters + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding(DefaultParameterSetName = 'List')] + Param( + [Parameter(ParameterSetName = 'Single', Mandatory = $true)] + $Id, + + [Parameter(ParameterSetName = 'Single', Mandatory = $true)] + [Parameter(ParameterSetName = 'List', Mandatory = $true)] + $OrganizationId, + + [Parameter(ParameterSetName = 'List')] + $Search = '' + ) + + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + $QueryParams.Add('organizationid', $OrganizationId) | Out-Null + + switch ($PSCmdlet.ParameterSetName) { + 'List' { + $Endpoint = 'list/object/org-collections' + + if ($Search -ne '') { + $QueryParams.Add('search', $Search) | Out-Null + } + + } + 'Single' { + $Endpoint = 'object/org-collection/{0}' -f $Id + } + } + $Request = Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams + + if ($Request.success) { + if ($Request.data.data) { + $Request.data.data + } + elseif ($Request.data) { + $Request.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Collections & Organizations\Get-VaultOrgCollection.ps1' 66 +#Region '.\Public\Vault API\Collections & Organizations\Get-VaultOrgMembers.ps1' 0 +function Get-VaultOrgMembers { + <# + .SYNOPSIS + Gets Bitwarden Vault Org Collections + + .DESCRIPTION + Calls /list/object/org-members + + .PARAMETER OrganizationId + Guid of Organization + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $OrganizationId + ) + + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + $QueryParams.Add('organizationid', $OrganizationId) | Out-Null + + $Endpoint = 'list/object/org-members' + $Request = Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams + + if ($Request.success) { + if ($Request.data.data) { + $Request.data.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Collections & Organizations\Get-VaultOrgMembers.ps1' 38 +#Region '.\Public\Vault API\Collections & Organizations\Get-VaultOrgs.ps1' 0 +function Get-VaultOrgs { + <# + .SYNOPSIS + Gets Bitwarden Vault Organizations + + .DESCRIPTION + Calls /list/object/organizations + + .PARAMETER Search + Organization name to search for + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + $Search = '' + ) + + $Endpoint = 'list/object/organizations' + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + if ($Search -ne '') { + $QueryParams.Add('search', $Search) | Out-Null + } + $Request = Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams + + if ($Request.success) { + $Request.data.data + } + else { + Write-Host $Request.message + $Request.success + } + +} +#EndRegion '.\Public\Vault API\Collections & Organizations\Get-VaultOrgs.ps1' 37 +#Region '.\Public\Vault API\Collections & Organizations\Move-VaultItemToCollection.ps1' 0 +function Move-VaultItemToCollection { + <# + .SYNOPSIS + Moves Bitwarden Vault Item to Collection + + .DESCRIPTION + Calls /move/{itemid}/{organizationid} + + .PARAMETER ItemId + Guid of Item + + .PARAMETER OrganizationId + Guid of Organization + + .PARAMETER CollectionIds + List of CollectionIds + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $ItemId, + [Parameter(Mandatory = $true)] + $OrganizationId, + [Parameter(Mandatory = $true)] + [string[]]$CollectionIds + ) + + $Endpoint = 'move/{0}/{1}' -f $ItemId, $OrganizationId + $Body = @($CollectionIds) | ConvertTo-Json + + $VaultApi = @{ + Endpoint = $Endpoint + Body = $Body + Method = 'Post' + } + + $Request = Invoke-VaultApi @VaultApi + + if ($Request.success) { + $Request.data + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Collections & Organizations\Move-VaultItemToCollection.ps1' 51 +#Region '.\Public\Vault API\Collections & Organizations\New-VaultOrgCollection.ps1' 0 +function New-VaultOrgCollection { + <# + .SYNOPSIS + Creates Bitwarden Vault Org Collections + + .DESCRIPTION + Calls POST /object/org-collection to create new org collections + + .PARAMETER OrgCollection + Full item object in pscustoobject or json format + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(ValueFromPipeline, Mandatory = $true)] + $OrgCollection + ) + + $OrgCollectionValid = $false + + if ($OrgCollection.GetType().Name -eq 'pscustomobject') { + $Body = $OrgCollection | ConvertTo-Json -Depth 10 + $OrgCollectionValid = $true + } + elseif (Test-Json -Json $OrgCollection) { + $Body = $OrgCollection + $OrgCollectionValid = $true + } + + if (-not $OrgCollectionValid) { + Write-Error "Input validation failed for 'OrgCollection', valid types are pscustomobject or JSON string" + return + } + + $VaultApi = @{ + Method = 'POST' + Endpoint = 'object/org-collection' + Body = $Body + } + + $Request = Invoke-VaultApi @VaultApi + + if ($Request.success) { + if ($Request.data) { + $Request.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Collections & Organizations\New-VaultOrgCollection.ps1' 56 +#Region '.\Public\Vault API\Collections & Organizations\Remove-VaultOrgCollection.ps1' 0 +function Remove-VaultOrgCollection { + <# + .SYNOPSIS + Deletes Bitwarden Org Collections Items + + .DESCRIPTION + Calls DELETE /object/org-collection/{id} to move organization collections to the trash, this does not delete the items inside + + .PARAMETER Id + OrgCollection guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id, + [Parameter(Mandatory = $true)] + $OrganizationId + ) + + $Endpoint = 'object/org-collection/{0}' -f $Id + + $VaultApi = @{ + Method = 'Delete' + Endpoint = $Endpoint + } + + Invoke-VaultApi @VaultApi +} +#EndRegion '.\Public\Vault API\Collections & Organizations\Remove-VaultOrgCollection.ps1' 33 +#Region '.\Public\Vault API\Collections & Organizations\Update-VaultOrgCollection.ps1' 0 +function Update-VaultOrgCollection { + <# + .SYNOPSIS + Updates Bitwarden Vault Items + + .DESCRIPTION + PUT /object/item/{id} + + .PARAMETER Id + Item guid + + .PARAMETER Item + Full item object in pscustoobject or json format + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding(DefaultParameterSetName = 'BodyUpdate')] + Param( + [Parameter(ParameterSetName = 'BodyUpdate', Mandatory = $true)] + $Id, + + [Parameter(ParameterSetName = 'BodyUpdate')] + [Parameter(ValueFromPipeline, ParameterSetName = 'FullObject')] + $OrgCollection + ) + + $OrgCollectonValid = $false + + if ($OrgCollection.GetType().Name -eq 'pscustomobject') { + $Body = $OrgCollection | ConvertTo-Json -Depth 10 + if ($OrgCollection.id) { $Id = $Item.id } + $OrgCollectonValid = $true + } + elseif (Test-Json -Json $OrgCollection) { + $Object = $OrgCollection | ConvertFrom-Json + if ($Object.id) { + $Id = $Object.id + } + $Body = $OrgCollection + $OrgCollectonValid = $true + } + + if (-not $Id -or -not $OrgCollectonValid) { + Write-Error "Input validation failed for 'OrgCollection', valid types are pscustomobject or JSON string and and id property must be specified" + return + } + + $Endpoint = 'object/org-collection/{0}' -f $Id + + $VaultApi = @{ + Method = 'Put' + Endpoint = $Endpoint + Body = $Body + } + + $Request = Invoke-VaultApi @VaultApi + + if ($Request.success) { + if ($Request.data) { + $Request.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Collections & Organizations\Update-VaultOrgCollection.ps1' 70 +#Region '.\Public\Vault API\Folders\Get-VaultFolder.ps1' 0 +function Get-VaultFolder { + <# + .SYNOPSIS + Gets Bitwarden Vault Folder + + .DESCRIPTION + Calls /list/object/folders or /object/folder/{id} to retrieve vault folders + + .PARAMETER Id + Folder guid + + .PARAMETER Search + Search terms + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding(DefaultParameterSetName = 'List')] + Param( + [Parameter(ParameterSetName = 'Single', Mandatory = $true)] + $Id, + [Parameter(ParameterSetName = 'List')] + $Search = '' + ) + + switch ($PSCmdlet.ParameterSetName) { + 'List' { + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + + $Endpoint = 'list/object/folders' + if ($Search -ne '') { + $QueryParams.Add('search', $Search) | Out-Null + } + $VaultApi = @{ + Endpoint = $Endpoint + QueryParams = $QueryParams + } + } + 'Single' { + $Endpoint = 'object/folder/{0}' -f $Id + + $VaultApi = @{ + Endpoint = $Endpoint + } + } + } + + $Request = Invoke-VaultApi @VaultApi + + if ($Request.success) { + if ($Request.data.data) { + $Request.data.data + } + elseif ($Request.data) { + $Request.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Folders\Get-VaultFolder.ps1' 64 +#Region '.\Public\Vault API\Folders\Remove-VaultFolder.ps1' 0 +function Remove-VaultFolder { + <# + .SYNOPSIS + Deletes Bitwarden Vault Folder + + .DESCRIPTION + Calls DELETE /object/item/{id} to move items to the trash + + .PARAMETER Id + Item guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Endpoint = 'object/folder/{0}' -f $Id + + $VaultApi = @{ + Method = 'Delete' + Endpoint = $Endpoint + } + + Invoke-VaultApi @VaultApi +} +#EndRegion '.\Public\Vault API\Folders\Remove-VaultFolder.ps1' 31 +#Region '.\Public\Vault API\Folders\Update-VaultFolder.ps1' 0 +function Update-VaultItem { + <# + .SYNOPSIS + Updates Bitwarden Vault Folder + + .DESCRIPTION + PUT /object/folder/{id} + + .PARAMETER Id + Item guid + + .PARAMETER Name + Name of folder + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id, + [Parameter(Mandatory = $true)] + $Name + ) + + $Body = @{ + name = $Name + } | ConvertTo-Json + + $Endpoint = 'object/folder/{0}' -f $Id + + $VaultApi = @{ + Method = 'Put' + Endpoint = $Endpoint + Body = $Body + } + + $Request = Invoke-VaultApi @VaultApi + + if ($Request.success) { + if ($Request.data) { + $Request.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Folders\Update-VaultFolder.ps1' 51 +#Region '.\Public\Vault API\Items\Get-VaultItem.ps1' 0 +function Get-VaultItem { + <# + .SYNOPSIS + Gets Bitwarden Vault Items + + .DESCRIPTION + Calls /list/object/items or /object/item/{id} to retrieve vault items + + .PARAMETER Id + Item guid + + .PARAMETER AsCredential + Returns login property as credential object + + .PARAMETER OrganizationId + Organization Guid + + .PARAMETER CollectionId + Collection Guid + + .PARAMETER FolderId + Folder Guid + + .PARAMETER Search + Search terms + + .PARAMETER Url + Search for matching Urls + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding(DefaultParameterSetName = 'List')] + Param( + [Parameter(ParameterSetName = 'Single', Mandatory = $true)] + $Id, + [Parameter(ParameterSetName = 'Single')] + [switch]$AsCredential, + + [Parameter(ParameterSetName = 'List')] + $OrganizationId = '', + [Parameter(ParameterSetName = 'List')] + $CollectionId = '', + [Parameter(ParameterSetName = 'List')] + $FolderId = '', + [Parameter(ParameterSetName = 'List')] + $Search = '', + [Parameter(ParameterSetName = 'List')] + $Url = '' + ) + + switch ($PSCmdlet.ParameterSetName) { + 'List' { + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + + $Endpoint = 'list/object/items' + if ($Search -ne '') { + $QueryParams.Add('search', $Search) | Out-Null + } + if ($OrganizationId -ne '') { + $QueryParams.Add('organizationid', $OrganizationId) | Out-Null + } + if ($CollectionId -ne '') { + $QueryParams.Add('collectionid', $CollectionId) | Out-Null + } + if ($FolderId -ne '') { + $QueryParams.Add('folderid', $FolderId) | Out-Null + } + if ($Url -ne '') { + $QueryParams.Add('url', $Url) | Out-Null + } + + $VaultApi = @{ + Endpoint = $Endpoint + QueryParams = $QueryParams + } + } + 'Single' { + $Endpoint = 'object/item/{0}' -f $Id + + $VaultApi = @{ + Endpoint = $Endpoint + } + } + } + + $Request = Invoke-VaultApi @VaultApi + + if ($Request.success) { + if ($Request.data.data) { + $Request.data.data + } + elseif ($Request.data) { + if ($AsCredential) { + [securestring]$Password = ConvertTo-SecureString -String $Request.data.login.password -AsPlainText -Force + New-Object System.Management.Automation.PSCredential ($Request.data.login.username, $Password) + } + else { + $Request.data + } + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Items\Get-VaultItem.ps1' 109 +#Region '.\Public\Vault API\Items\New-VaultItem.ps1' 0 +function New-VaultItem { + <# + .SYNOPSIS + Creates Bitwarden Vault Items + + .DESCRIPTION + Calls POST /object/item to create vault items + + .PARAMETER Item + Full item object in pscustoobject or json format + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(ValueFromPipeline, Mandatory = $true)] + $Item + ) + + $ItemValid = $false + + if ($Item.GetType().Name -eq 'pscustomobject') { + $Body = $Item | ConvertTo-Json -Depth 10 + $ItemValid = $true + } + elseif (Test-Json -Json $Item) { + $Body = $Item + $ItemValid = $true + } + + if (-not $ItemValid) { + Write-Error "Input validation failed for 'Item', valid types are pscustomobject or JSON string and and id property must be specified" + return + } + + $VaultApi = @{ + Method = 'POST' + Endpoint = 'object/item' + Body = $Body + } + + $Request = Invoke-VaultApi @VaultApi + + if ($Request.success) { + if ($Request.data) { + $Request.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Items\New-VaultItem.ps1' 56 +#Region '.\Public\Vault API\Items\Remove-VaultItem.ps1' 0 +function Remove-VaultItem { + <# + .SYNOPSIS + Deletes Bitwarden Vault Items + + .DESCRIPTION + Calls DELETE /object/item/{id} to move items to the trash + + .PARAMETER Id + Item guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Endpoint = 'object/item/{0}' -f $Id + + $VaultApi = @{ + Method = 'Delete' + Endpoint = $Endpoint + } + + Invoke-VaultApi @VaultApi +} +#EndRegion '.\Public\Vault API\Items\Remove-VaultItem.ps1' 31 +#Region '.\Public\Vault API\Items\Restore-VaultItem.ps1' 0 +function Restore-VaultItem { + <# + .SYNOPSIS + Restores deleted Bitwarden Vault Items + + .DESCRIPTION + PUT /restore/item/{id} + + .PARAMETER Id + Item guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Endpoint = 'restore/item/{0}' -f $Id + + $VaultApi = @{ + Method = 'Post' + Endpoint = $Endpoint + Body = $Body + } + + Invoke-VaultApi @VaultApi +} +#EndRegion '.\Public\Vault API\Items\Restore-VaultItem.ps1' 32 +#Region '.\Public\Vault API\Items\Update-VaultItem.ps1' 0 +function Update-VaultItem { + <# + .SYNOPSIS + Updates Bitwarden Vault Items + + .DESCRIPTION + PUT /object/item/{id} + + .PARAMETER Id + Item guid + + .PARAMETER Item + Full item object in pscustoobject or json format + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding(DefaultParameterSetName = 'BodyUpdate')] + Param( + [Parameter(ParameterSetName = 'BodyUpdate', Mandatory = $true)] + $Id, + + [Parameter(ParameterSetName = 'BodyUpdate')] + [Parameter(ValueFromPipeline, ParameterSetName = 'FullObject')] + $Item + ) + + $ItemValid = $false + + if ($Item.GetType().Name -eq 'pscustomobject') { + $Body = $Item | ConvertTo-Json -Depth 10 + $Id = $Item.id + $ItemValid = $true + } + elseif (Test-Json -Json $Item) { + $Object = $Item | ConvertFrom-Json + $Id = $Object.id + $Body = $Item + $ItemValid = $true + } + + if (-not $Id -or -not $ItemValid) { + Write-Error "Input validation failed for 'Item', valid types are pscustomobject or JSON string and and id property must be specified" + return + } + + $Endpoint = 'object/item/{0}' -f $Id + + $VaultApi = @{ + Method = 'Put' + Endpoint = $Endpoint + Body = $Body + } + + $Request = Invoke-VaultApi @VaultApi + + if ($Request.success) { + if ($Request.data) { + $Request.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Items\Update-VaultItem.ps1' 68 +#Region '.\Public\Vault API\Lock & Unlock\Lock-Vault.ps1' 0 +function Lock-Vault { + <# + .SYNOPSIS + Locks Bitwarden Vault + + .DESCRIPTION + Calls the /lock endpoint to clean up session + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param() + $Request = Invoke-VaultApi -Endpoint 'lock' -Method Post + [Environment]::SetEnvironmentVariable('BW_SESSION', $null) + Write-Host $Request.data.title +} +#EndRegion '.\Public\Vault API\Lock & Unlock\Lock-Vault.ps1' 19 +#Region '.\Public\Vault API\Lock & Unlock\Unlock-Vault.ps1' 0 +function Unlock-Vault { + <# + .SYNOPSIS + Unlocks Bitwarden Vault + + .DESCRIPTION + Calls the /unlock endpoint to open the vault + + .PARAMETER Credential + Vault credential object for the master password + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [PSCredential]$Credential = (Get-Credential -UserName 'Master Password' ) + ) + + $Body = @{ + password = $Credential.GetNetworkCredential().Password + } | ConvertTo-Json -Compress + + $Request = Invoke-VaultApi -Endpoint 'unlock' -Method 'Post' -Body $Body + + # Set session variable for cli commands + [Environment]::SetEnvironmentVariable('BW_SESSION', $Request.data.raw) + + Write-Host $Request.data.title + $Request.success +} +#EndRegion '.\Public\Vault API\Lock & Unlock\Unlock-Vault.ps1' 33 +#Region '.\Public\Vault API\Miscellaneous\Get-VaultStatus.ps1' 0 +function Get-VaultStatus { + <# + .SYNOPSIS + Returns REST server status + + .DESCRIPTION + Calls /status endpoint to check if vault is logged in + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param() + $Request = Invoke-VaultApi -Endpoint 'status' + $Request.data.template +} +#EndRegion '.\Public\Vault API\Miscellaneous\Get-VaultStatus.ps1' 18 +#Region '.\Public\Vault API\Miscellaneous\Get-VaultTemplate.ps1' 0 +function Get-VaultTemplate { + <# + .SYNOPSIS + Returns vault template object + + .DESCRIPTION + Calls /template/{type} endpoint + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param( + [Parameter(Mandatory = $true)] + [ValidateSet('item', 'item.field', 'item.login', 'item.login.uri', 'item.card', 'item.identity', 'item.securenote', 'folder', 'collection', 'item-collections', 'org-collection')] + $Type + ) + + #API method not available yet + #Invoke-VaultApi -Endpoint ('template/{0}' -f $Type) + + $Arguments = @( + 'get' + 'template' + $Type + ) + + Invoke-VaultCli -Arguments $Arguments +} +#EndRegion '.\Public\Vault API\Miscellaneous\Get-VaultTemplate.ps1' 31 +#Region '.\Public\Vault API\Miscellaneous\New-Password.ps1' 0 +function New-Password { + <# + .SYNOPSIS + Creates a new password + + .DESCRIPTION + Calls the /generate endpoint to create a new password + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param() + $Request = Invoke-VaultApi -Endpoint 'generate' + if ($Request) { + $Request.data.data | ConvertTo-SecureString -AsPlainText -Force + } + else { + Write-Error 'Unable to generate password' + } +} +#EndRegion '.\Public\Vault API\Miscellaneous\New-Password.ps1' 23 +#Region '.\Public\Vault API\Miscellaneous\Sync-Vault.ps1' 0 +function Sync-Vault { + <# + .SYNOPSIS + Syncs local Bitwarden vault with server + + .DESCRIPTION + Calls /sync endpoint to synchronize local vault + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [cmdletbinding()] + Param() + $Request = Invoke-VaultApi -Endpoint 'sync' -Method Post + Write-Host $Request.data.title + $Request +} +#EndRegion '.\Public\Vault API\Miscellaneous\Sync-Vault.ps1' 19 +#Region '.\Public\Vault API\REST\Start-RestServer.ps1' 0 +function Start-RestServer { + <# + .SYNOPSIS + Starts Bitwarden REST server + + .DESCRIPTION + Uses `bw serve` to run local REST server + + .PARAMETER Port + Port to run server on, default 8087 + + .PARAMETER Hostname + Hostname to run server on, default localhost + + .LINK + https://bitwarden.com/help/cli/#serve + + #> + [cmdletbinding()] + Param( + $Port = 8087, + $Hostname = 'localhost' + ) + + $RunningCli = Get-Process bw -ErrorAction SilentlyContinue + if ($RunningCli -and -not $script:BwRestServer) { + $RunningCli | Stop-Process + } + + $Arguments = @( + 'serve' + "--port $Port" + "--hostname $Hostname" + ) + + try { + $bw = Get-Command bw + if (!$bw) { + Write-Error 'Bitwarden CLI is not installed' + return $false + } + $Proc = Start-Process -FilePath $bw.Path -ArgumentList $Arguments -NoNewWindow -PassThru -ErrorAction Stop + + $OldProgPref = $global:ProgressPreference + $global:ProgressPreference = 'SilentlyContinue' + + do { + $VaultRest = Test-NetConnection -ComputerName $Hostname -Port $Port -InformationLevel Quiet -WarningAction SilentlyContinue + Start-Sleep -Seconds 1 + } while (-not $VaultRest) + + $global:ProgressPreference = $OldProgPref + + $script:BwRestServer = [PSCustomObject]@{ + PID = $Proc.Id + Port = $Port + Hostname = $Hostname + } + $script:BwRestServer + } + catch { + Write-Error 'Could not start REST server' + } +} +#EndRegion '.\Public\Vault API\REST\Start-RestServer.ps1' 65 +#Region '.\Public\Vault API\REST\Stop-RestServer.ps1' 0 +function Stop-RestServer { + <# + .SYNOPSIS + Stops Bitwarden REST server + + .DESCRIPTION + Stops bw process if found running + + .LINK + https://bitwarden.com/help/cli/#serve + + #> + [cmdletbinding()] + Param() + + $RunningCli = Get-Process bw -ErrorAction SilentlyContinue + if ($RunningCli) { + Write-Host 'Stopping REST server' + $RunningCli | Stop-Process + } + +} +#EndRegion '.\Public\Vault API\REST\Stop-RestServer.ps1' 23 +#Region '.\Public\Vault API\Send\Get-Send.ps1' 0 +function Get-Send { + <# + .SYNOPSIS + Gets Bitwarden Sends + + .DESCRIPTION + Calls /list/object/send or /object/send/{id} + + .PARAMETER Id + Guid of Collection + + .PARAMETER Search + Search parameters + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding(DefaultParameterSetName = 'List')] + Param( + [Parameter(ParameterSetName = 'Single', Mandatory = $true)] + $Id, + + [Parameter(ParameterSetName = 'List')] + $Search = '' + ) + + switch ($PSCmdlet.ParameterSetName) { + 'List' { + $Endpoint = 'list/object/send' + $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + if ($Search -ne '') { + $QueryParams.Add('search', $Search) | Out-Null + } + + } + 'Single' { + $Endpoint = 'object/send/{0}' -f $Id + } + } + $Request = Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams + + if ($Request.success) { + if ($Request.data.data) { + $Request.data.data + } + elseif ($Request.data) { + $Request.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Send\Get-Send.ps1' 56 +#Region '.\Public\Vault API\Send\New-Send.ps1' 0 +function New-Send { + <# + .SYNOPSIS + Creates Bitwarden Send + + .DESCRIPTION + Calls POST /object/send to create a new send + + .PARAMETER OrgCollection + Full item object in pscustoobject or json format + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding(DefaultParameterSetName = 'SendParams')] + Param( + [Parameter(ParameterSetName = 'SendParams', Mandatory = $true)] + $Name, + [Parameter(ParameterSetName = 'SendParams')] + $Notes = '', + [Parameter(ParameterSetName = 'SendParams')] + $SendPass = '', + [Parameter(ParameterSetName = 'SendParams', Mandatory = $true)] + $Text, + [Parameter(ParameterSetName = 'SendParams')] + [int]$Days = 7, + [Parameter(ParameterSetName = 'SendParams')] + [int]$MaxAccessCount = 3, + [Parameter(ParameterSetName = 'SendParams')] + [switch]$HideText, + [Parameter(ParameterSetName = 'SendParams')] + [switch]$HideEmail, + [Parameter(ParameterSetName = 'FullObject', ValueFromPipeline, Mandatory = $true)] + $Send + ) + + $SendValid = $false + switch ($PSCmdlet.ParameterSetName) { + 'FullObject' { + if ($Send.GetType().Name -eq 'pscustomobject') { + $Body = $Send | ConvertTo-Json -Depth 10 + $SendValid = $true + } + elseif (Test-Json -Json $Send) { + $Body = $Send + $SendValid = $true + } + if (-not $SendValid) { + Write-Error "Input validation failed for 'Send', valid types are pscustomobject or JSON string" + return + } + } + 'SendParams' { + $Send = [pscustomobject]@{ + name = $Name + notes = $Notes + type = 0 + text = @{ + text = $Text + hidden = $HideText.IsPresent + } + file = $null + maxAccessCount = $MaxAccessCount + deletionDate = (Get-Date).AddDays($Days).ToUniversalTime() + expirationDate = (Get-Date).AddDays($Days).ToUniversalTime() + hideEmail = $HideEmail.IsPresent + disabled = $false + + } + if ($SendPass) { $Send.password = $SendPass } + + $Body = $Send | ConvertTo-Json + Write-Verbose $Body + } + } + + + $VaultApi = @{ + Method = 'POST' + Endpoint = 'object/send' + Body = $Body + } + + $Request = Invoke-VaultApi @VaultApi + + if ($Request.success) { + if ($Request.data) { + $Request.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Send\New-Send.ps1' 97 +#Region '.\Public\Vault API\Send\Remove-Send.ps1' 0 +function Remove-Send { + <# + .SYNOPSIS + Deletes Bitwarden Send + + .DESCRIPTION + Calls DELETE /object/send/{id} to move items to the trash + + .PARAMETER Id + Send guid + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding()] + Param( + [Parameter(Mandatory = $true)] + $Id + ) + + $Endpoint = 'object/send/{0}' -f $Id + + $VaultApi = @{ + Method = 'Delete' + Endpoint = $Endpoint + } + + Invoke-VaultApi @VaultApi +} +#EndRegion '.\Public\Vault API\Send\Remove-Send.ps1' 31 +#Region '.\Public\Vault API\Send\Update-Send.ps1' 0 +function Update-Send { + <# + .SYNOPSIS + Updates Bitwarden Send + + .DESCRIPTION + PUT /object/send/{id} + + .PARAMETER Id + Send guid + + .PARAMETER Send + Full Send object in pscustoobject or json format + + .LINK + https://bitwarden.com/help/vault-management-api/ + + #> + [CmdletBinding(DefaultParameterSetName = 'BodyUpdate')] + Param( + [Parameter(ParameterSetName = 'BodyUpdate', Mandatory = $true)] + $Id, + + [Parameter(ParameterSetName = 'BodyUpdate')] + [Parameter(ValueFromPipeline, ParameterSetName = 'FullObject')] + $Send + ) + + $SendValid = $false + + if ($Send.GetType().Name -eq 'pscustomobject') { + $Body = $Send | ConvertTo-Json -Depth 10 + $Id = $Send.id + $SendValid = $true + } + elseif (Test-Json -Json $Send) { + $Object = $Send | ConvertFrom-Json + $Id = $Object.id + $Body = $Send + $SendValid = $true + } + + if (-not $Id -or -not $SendValid) { + Write-Error "Input validation failed for 'Item', valid types are pscustomobject or JSON string and and id property must be specified" + return + } + + $Endpoint = 'object/send/{0}' -f $Id + + $VaultApi = @{ + Method = 'Put' + Endpoint = $Endpoint + Body = $Body + } + + $Request = Invoke-VaultApi @VaultApi + + if ($Request.success) { + if ($Request.data) { + $Request.data + } + } + else { + Write-Host $Request.message + $Request.success + } +} +#EndRegion '.\Public\Vault API\Send\Update-Send.ps1' 68 diff --git a/README.md b/README.md index c96786a..095f6c4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Bitwarden +# BitwardenPS Module This module interacts with the Bitwarden Public API and the Vault API. diff --git a/build.psd1 b/build.psd1 index de15e91..a3df36e 100644 --- a/build.psd1 +++ b/build.psd1 @@ -1,7 +1,7 @@ # Use this file to override the default parameter values used by the `Build-Module` # command when building the module (see `Get-Help Build-Module -Full` for details). @{ - ModuleManifest = 'Bitwarden\Bitwarden.psd1' + ModuleManifest = 'BitwardenPS\BitwardenPS.psd1' # Subsequent relative paths are to the ModuleManifest OutputDirectory = '..\Output\' VersionedOutputDirectory = $false From 756619dc37488b911aaa7dbde9c9aeb49a6ce000 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Tue, 27 Sep 2022 20:55:48 -0400 Subject: [PATCH 2/2] Update docs --- Docs/Confirm-BwVaultOrgMember.md | 75 + Docs/Connect-BwPublicApi.md | 6 +- Docs/Get-BwPublicCollections.md | 6 +- Docs/Get-BwPublicEvents.md | 6 +- Docs/Get-BwPublicGroupMemberIds.md | 6 +- Docs/Get-BwPublicGroups.md | 6 +- Docs/Get-BwPublicMemberGroupIds.md | 6 +- Docs/Get-BwPublicMembers.md | 6 +- Docs/Get-BwSend.md | 81 + Docs/Get-BwVaultAttachment.md | 90 ++ Docs/Get-BwVaultCollections.md | 60 + Docs/Get-BwVaultFolder.md | 81 + Docs/Get-BwVaultItem.md | 4 +- Docs/Get-BwVaultItemNotes.md | 60 + Docs/Get-BwVaultItemPassword.md | 60 + Docs/Get-BwVaultItemPwExposed.md | 60 + Docs/Get-BwVaultItemTotp.md | 60 + Docs/Get-BwVaultItemUri.md | 60 + Docs/Get-BwVaultItemUsername.md | 60 + Docs/Get-BwVaultOrgCollection.md | 96 ++ Docs/Get-BwVaultOrgMembers.md | 60 + Docs/Get-BwVaultOrgs.md | 60 + Docs/Get-BwVaultStatus.md | 4 +- Docs/Get-BwVaultTemplate.md | 4 +- Docs/Lock-BwVault.md | 4 +- Docs/Move-BwVaultItemToCollection.md | 91 ++ Docs/New-BwPassword.md | 4 +- Docs/New-BwSend.md | 187 +++ Docs/New-BwVaultAttachment.md | 4 +- Docs/New-BwVaultItem.md | 4 +- Docs/New-BwVaultOrgCollection.md | 60 + Docs/Remove-BwSend.md | 60 + Docs/Remove-BwVaultAttachment.md | 75 + Docs/Remove-BwVaultFolder.md | 60 + Docs/Remove-BwVaultItem.md | 4 +- Docs/Remove-BwVaultOrgCollection.md | 75 + Docs/Restore-BwVaultItem.md | 4 +- Docs/Send-BwPublicMemberInvite.md | 4 +- Docs/Start-BwRestServer.md | 4 +- Docs/Stop-BwRestServer.md | 4 +- Docs/Sync-BwVault.md | 4 +- Docs/Unlock-BwVault.md | 4 +- Docs/Update-BwSend.md | 93 ++ Docs/Update-BwVaultItem.md | 4 +- Docs/Update-BwVaultOrgCollection.md | 93 ++ Output/Bitwarden/Bitwarden.psd1 | 131 -- Output/Bitwarden/Bitwarden.psm1 | 2111 -------------------------- 47 files changed, 1808 insertions(+), 2293 deletions(-) create mode 100644 Docs/Confirm-BwVaultOrgMember.md create mode 100644 Docs/Get-BwSend.md create mode 100644 Docs/Get-BwVaultAttachment.md create mode 100644 Docs/Get-BwVaultCollections.md create mode 100644 Docs/Get-BwVaultFolder.md create mode 100644 Docs/Get-BwVaultItemNotes.md create mode 100644 Docs/Get-BwVaultItemPassword.md create mode 100644 Docs/Get-BwVaultItemPwExposed.md create mode 100644 Docs/Get-BwVaultItemTotp.md create mode 100644 Docs/Get-BwVaultItemUri.md create mode 100644 Docs/Get-BwVaultItemUsername.md create mode 100644 Docs/Get-BwVaultOrgCollection.md create mode 100644 Docs/Get-BwVaultOrgMembers.md create mode 100644 Docs/Get-BwVaultOrgs.md create mode 100644 Docs/Move-BwVaultItemToCollection.md create mode 100644 Docs/New-BwSend.md create mode 100644 Docs/New-BwVaultOrgCollection.md create mode 100644 Docs/Remove-BwSend.md create mode 100644 Docs/Remove-BwVaultAttachment.md create mode 100644 Docs/Remove-BwVaultFolder.md create mode 100644 Docs/Remove-BwVaultOrgCollection.md create mode 100644 Docs/Update-BwSend.md create mode 100644 Docs/Update-BwVaultOrgCollection.md delete mode 100644 Output/Bitwarden/Bitwarden.psd1 delete mode 100644 Output/Bitwarden/Bitwarden.psm1 diff --git a/Docs/Confirm-BwVaultOrgMember.md b/Docs/Confirm-BwVaultOrgMember.md new file mode 100644 index 0000000..817b4a2 --- /dev/null +++ b/Docs/Confirm-BwVaultOrgMember.md @@ -0,0 +1,75 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Confirm-BwVaultOrgMember + +## SYNOPSIS +Gets Bitwarden Vault Org Collections + +## SYNTAX + +``` +Confirm-BwVaultOrgMember [-Id] [-OrganizationId] [] +``` + +## DESCRIPTION +Calls /list/object/org-members + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Guid of Org Member + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrganizationId +Guid of Organization + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Connect-BwPublicApi.md b/Docs/Connect-BwPublicApi.md index edb4d6a..3ae3a18 100644 --- a/Docs/Connect-BwPublicApi.md +++ b/Docs/Connect-BwPublicApi.md @@ -1,7 +1,7 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden -online version: +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Get-BwPublicCollections.md b/Docs/Get-BwPublicCollections.md index 92d8fce..d838b7f 100644 --- a/Docs/Get-BwPublicCollections.md +++ b/Docs/Get-BwPublicCollections.md @@ -1,7 +1,7 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden -online version: +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Get-BwPublicEvents.md b/Docs/Get-BwPublicEvents.md index 5e5d564..c4d8e92 100644 --- a/Docs/Get-BwPublicEvents.md +++ b/Docs/Get-BwPublicEvents.md @@ -1,7 +1,7 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden -online version: +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Get-BwPublicGroupMemberIds.md b/Docs/Get-BwPublicGroupMemberIds.md index 8d8d95e..4f1ef27 100644 --- a/Docs/Get-BwPublicGroupMemberIds.md +++ b/Docs/Get-BwPublicGroupMemberIds.md @@ -1,7 +1,7 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden -online version: +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Get-BwPublicGroups.md b/Docs/Get-BwPublicGroups.md index bd2c551..8ff2d93 100644 --- a/Docs/Get-BwPublicGroups.md +++ b/Docs/Get-BwPublicGroups.md @@ -1,7 +1,7 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden -online version: +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Get-BwPublicMemberGroupIds.md b/Docs/Get-BwPublicMemberGroupIds.md index 86e58af..9b29516 100644 --- a/Docs/Get-BwPublicMemberGroupIds.md +++ b/Docs/Get-BwPublicMemberGroupIds.md @@ -1,7 +1,7 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden -online version: +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Get-BwPublicMembers.md b/Docs/Get-BwPublicMembers.md index 6d5be05..0b8ac7f 100644 --- a/Docs/Get-BwPublicMembers.md +++ b/Docs/Get-BwPublicMembers.md @@ -1,7 +1,7 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden -online version: +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Get-BwSend.md b/Docs/Get-BwSend.md new file mode 100644 index 0000000..e02abe7 --- /dev/null +++ b/Docs/Get-BwSend.md @@ -0,0 +1,81 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwSend + +## SYNOPSIS +Gets Bitwarden Sends + +## SYNTAX + +### List (Default) +``` +Get-BwSend [-Search ] [] +``` + +### Single +``` +Get-BwSend -Id [] +``` + +## DESCRIPTION +Calls /list/object/send or /object/send/{id} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Guid of Collection + +```yaml +Type: Object +Parameter Sets: Single +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Search +Search parameters + +```yaml +Type: Object +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultAttachment.md b/Docs/Get-BwVaultAttachment.md new file mode 100644 index 0000000..d1a30dd --- /dev/null +++ b/Docs/Get-BwVaultAttachment.md @@ -0,0 +1,90 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultAttachment + +## SYNOPSIS +Gets Bitwarden Vault Attachments + +## SYNTAX + +``` +Get-BwVaultAttachment [-Id] [-ItemId] [[-FilePath] ] [] +``` + +## DESCRIPTION +Calls Get /object/attachment/{id} to download attachments + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Attachment id + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ItemId +Item Guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FilePath +Path to save file + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultCollections.md b/Docs/Get-BwVaultCollections.md new file mode 100644 index 0000000..d5bb08d --- /dev/null +++ b/Docs/Get-BwVaultCollections.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultCollections + +## SYNOPSIS +Gets Bitwarden Vault Collections + +## SYNTAX + +``` +Get-BwVaultCollections [[-Search] ] [] +``` + +## DESCRIPTION +Calls /list/object/collections + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Search +Organization name to search for + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultFolder.md b/Docs/Get-BwVaultFolder.md new file mode 100644 index 0000000..3a85d7a --- /dev/null +++ b/Docs/Get-BwVaultFolder.md @@ -0,0 +1,81 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultFolder + +## SYNOPSIS +Gets Bitwarden Vault Folder + +## SYNTAX + +### List (Default) +``` +Get-BwVaultFolder [-Search ] [] +``` + +### Single +``` +Get-BwVaultFolder -Id [] +``` + +## DESCRIPTION +Calls /list/object/folders or /object/folder/{id} to retrieve vault folders + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Folder guid + +```yaml +Type: Object +Parameter Sets: Single +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Search +Search terms + +```yaml +Type: Object +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultItem.md b/Docs/Get-BwVaultItem.md index 37b9cd0..8b80232 100644 --- a/Docs/Get-BwVaultItem.md +++ b/Docs/Get-BwVaultItem.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Get-BwVaultItemNotes.md b/Docs/Get-BwVaultItemNotes.md new file mode 100644 index 0000000..0548c61 --- /dev/null +++ b/Docs/Get-BwVaultItemNotes.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultItemNotes + +## SYNOPSIS +Returns Notes of a vault item + +## SYNTAX + +``` +Get-BwVaultItemNotes [-Id] [] +``` + +## DESCRIPTION +Calls /object/notes/{id} endpoint to retrieve notes + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Item guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultItemPassword.md b/Docs/Get-BwVaultItemPassword.md new file mode 100644 index 0000000..147f764 --- /dev/null +++ b/Docs/Get-BwVaultItemPassword.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultItemPassword + +## SYNOPSIS +Returns password of a vault item + +## SYNTAX + +``` +Get-BwVaultItemPassword [-Id] [] +``` + +## DESCRIPTION +Calls /object/password/{id} endpoint to retrieve password + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Item guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultItemPwExposed.md b/Docs/Get-BwVaultItemPwExposed.md new file mode 100644 index 0000000..f7fa335 --- /dev/null +++ b/Docs/Get-BwVaultItemPwExposed.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultItemPwExposed + +## SYNOPSIS +Returns count of times a vault item password has been exposed + +## SYNTAX + +``` +Get-BwVaultItemPwExposed [-Id] [] +``` + +## DESCRIPTION +Calls /object/exposed/{id} endpoint to retrieve count + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Item guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultItemTotp.md b/Docs/Get-BwVaultItemTotp.md new file mode 100644 index 0000000..9fede7c --- /dev/null +++ b/Docs/Get-BwVaultItemTotp.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultItemTotp + +## SYNOPSIS +Returns TOTP of a vault item + +## SYNTAX + +``` +Get-BwVaultItemTotp [-Id] [] +``` + +## DESCRIPTION +Calls /object/totp/{id} endpoint to retrieve TOTP + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Item guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultItemUri.md b/Docs/Get-BwVaultItemUri.md new file mode 100644 index 0000000..0b44d0e --- /dev/null +++ b/Docs/Get-BwVaultItemUri.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultItemUri + +## SYNOPSIS +Returns URI of a vault item + +## SYNTAX + +``` +Get-BwVaultItemUri [-Id] [] +``` + +## DESCRIPTION +Calls /object/uri/{id} endpoint to retrieve URI + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Item guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultItemUsername.md b/Docs/Get-BwVaultItemUsername.md new file mode 100644 index 0000000..e1a5bfa --- /dev/null +++ b/Docs/Get-BwVaultItemUsername.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultItemUsername + +## SYNOPSIS +Returns username of a vault item + +## SYNTAX + +``` +Get-BwVaultItemUsername [-Id] [] +``` + +## DESCRIPTION +Calls /object/username/{id} endpoint to retrieve username + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Item guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultOrgCollection.md b/Docs/Get-BwVaultOrgCollection.md new file mode 100644 index 0000000..5359830 --- /dev/null +++ b/Docs/Get-BwVaultOrgCollection.md @@ -0,0 +1,96 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultOrgCollection + +## SYNOPSIS +Gets Bitwarden Vault Org Collections + +## SYNTAX + +### List (Default) +``` +Get-BwVaultOrgCollection -OrganizationId [-Search ] [] +``` + +### Single +``` +Get-BwVaultOrgCollection -Id -OrganizationId [] +``` + +## DESCRIPTION +Calls /list/object/org-collections or /object/org-collection/{id} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Guid of Collection + +```yaml +Type: Object +Parameter Sets: Single +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrganizationId +Guid of Organization + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Search +Search parameters + +```yaml +Type: Object +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultOrgMembers.md b/Docs/Get-BwVaultOrgMembers.md new file mode 100644 index 0000000..dc13cf8 --- /dev/null +++ b/Docs/Get-BwVaultOrgMembers.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultOrgMembers + +## SYNOPSIS +Gets Bitwarden Vault Org Collections + +## SYNTAX + +``` +Get-BwVaultOrgMembers [-OrganizationId] [] +``` + +## DESCRIPTION +Calls /list/object/org-members + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -OrganizationId +Guid of Organization + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultOrgs.md b/Docs/Get-BwVaultOrgs.md new file mode 100644 index 0000000..9d94e3b --- /dev/null +++ b/Docs/Get-BwVaultOrgs.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Get-BwVaultOrgs + +## SYNOPSIS +Gets Bitwarden Vault Organizations + +## SYNTAX + +``` +Get-BwVaultOrgs [[-Search] ] [] +``` + +## DESCRIPTION +Calls /list/object/organizations + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Search +Organization name to search for + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Get-BwVaultStatus.md b/Docs/Get-BwVaultStatus.md index f710b5a..eb8d55a 100644 --- a/Docs/Get-BwVaultStatus.md +++ b/Docs/Get-BwVaultStatus.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Get-BwVaultTemplate.md b/Docs/Get-BwVaultTemplate.md index 4750ff9..c81b168 100644 --- a/Docs/Get-BwVaultTemplate.md +++ b/Docs/Get-BwVaultTemplate.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Lock-BwVault.md b/Docs/Lock-BwVault.md index d61f5d9..253597c 100644 --- a/Docs/Lock-BwVault.md +++ b/Docs/Lock-BwVault.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Move-BwVaultItemToCollection.md b/Docs/Move-BwVaultItemToCollection.md new file mode 100644 index 0000000..b71d3db --- /dev/null +++ b/Docs/Move-BwVaultItemToCollection.md @@ -0,0 +1,91 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Move-BwVaultItemToCollection + +## SYNOPSIS +Moves Bitwarden Vault Item to Collection + +## SYNTAX + +``` +Move-BwVaultItemToCollection [-ItemId] [-OrganizationId] [-CollectionIds] + [] +``` + +## DESCRIPTION +Calls /move/{itemid}/{organizationid} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -ItemId +Guid of Item + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrganizationId +Guid of Organization + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionIds +List of CollectionIds + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/New-BwPassword.md b/Docs/New-BwPassword.md index 1c2fc60..b06ba8c 100644 --- a/Docs/New-BwPassword.md +++ b/Docs/New-BwPassword.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/New-BwSend.md b/Docs/New-BwSend.md new file mode 100644 index 0000000..86c49da --- /dev/null +++ b/Docs/New-BwSend.md @@ -0,0 +1,187 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# New-BwSend + +## SYNOPSIS +Creates Bitwarden Send + +## SYNTAX + +### SendParams (Default) +``` +New-BwSend -Name [-Notes ] [-SendPass ] -Text [-Days ] + [-MaxAccessCount ] [-HideText] [-HideEmail] [] +``` + +### FullObject +``` +New-BwSend -Send [] +``` + +## DESCRIPTION +Calls POST /object/send to create a new send + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Name +{{ Fill Name Description }} + +```yaml +Type: Object +Parameter Sets: SendParams +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Notes +{{ Fill Notes Description }} + +```yaml +Type: Object +Parameter Sets: SendParams +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SendPass +{{ Fill SendPass Description }} + +```yaml +Type: Object +Parameter Sets: SendParams +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Text +{{ Fill Text Description }} + +```yaml +Type: Object +Parameter Sets: SendParams +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Days +{{ Fill Days Description }} + +```yaml +Type: Int32 +Parameter Sets: SendParams +Aliases: + +Required: False +Position: Named +Default value: 7 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MaxAccessCount +{{ Fill MaxAccessCount Description }} + +```yaml +Type: Int32 +Parameter Sets: SendParams +Aliases: + +Required: False +Position: Named +Default value: 3 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -HideText +{{ Fill HideText Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: SendParams +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -HideEmail +{{ Fill HideEmail Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: SendParams +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Send +{{ Fill Send Description }} + +```yaml +Type: Object +Parameter Sets: FullObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/New-BwVaultAttachment.md b/Docs/New-BwVaultAttachment.md index 5011f48..fbf13d3 100644 --- a/Docs/New-BwVaultAttachment.md +++ b/Docs/New-BwVaultAttachment.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/New-BwVaultItem.md b/Docs/New-BwVaultItem.md index 2f04c25..be17f67 100644 --- a/Docs/New-BwVaultItem.md +++ b/Docs/New-BwVaultItem.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/New-BwVaultOrgCollection.md b/Docs/New-BwVaultOrgCollection.md new file mode 100644 index 0000000..dceedb6 --- /dev/null +++ b/Docs/New-BwVaultOrgCollection.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# New-BwVaultOrgCollection + +## SYNOPSIS +Creates Bitwarden Vault Org Collections + +## SYNTAX + +``` +New-BwVaultOrgCollection [-OrgCollection] [] +``` + +## DESCRIPTION +Calls POST /object/org-collection to create new org collections + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -OrgCollection +Full item object in pscustoobject or json format + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Remove-BwSend.md b/Docs/Remove-BwSend.md new file mode 100644 index 0000000..02477df --- /dev/null +++ b/Docs/Remove-BwSend.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Remove-BwSend + +## SYNOPSIS +Deletes Bitwarden Send + +## SYNTAX + +``` +Remove-BwSend [-Id] [] +``` + +## DESCRIPTION +Calls DELETE /object/send/{id} to move items to the trash + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Send guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Remove-BwVaultAttachment.md b/Docs/Remove-BwVaultAttachment.md new file mode 100644 index 0000000..86c4133 --- /dev/null +++ b/Docs/Remove-BwVaultAttachment.md @@ -0,0 +1,75 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Remove-BwVaultAttachment + +## SYNOPSIS +Deletes Bitwarden Vault Attachments + +## SYNTAX + +``` +Remove-BwVaultAttachment [-Id] [-ItemId] [] +``` + +## DESCRIPTION +Calls DELETE /object/item/{id} to move items to the trash + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Attachment id + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ItemId +Item Guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Remove-BwVaultFolder.md b/Docs/Remove-BwVaultFolder.md new file mode 100644 index 0000000..f1f3cc9 --- /dev/null +++ b/Docs/Remove-BwVaultFolder.md @@ -0,0 +1,60 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Remove-BwVaultFolder + +## SYNOPSIS +Deletes Bitwarden Vault Folder + +## SYNTAX + +``` +Remove-BwVaultFolder [-Id] [] +``` + +## DESCRIPTION +Calls DELETE /object/item/{id} to move items to the trash + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Item guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Remove-BwVaultItem.md b/Docs/Remove-BwVaultItem.md index 53b789b..94b5cd6 100644 --- a/Docs/Remove-BwVaultItem.md +++ b/Docs/Remove-BwVaultItem.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Remove-BwVaultOrgCollection.md b/Docs/Remove-BwVaultOrgCollection.md new file mode 100644 index 0000000..8ba554d --- /dev/null +++ b/Docs/Remove-BwVaultOrgCollection.md @@ -0,0 +1,75 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Remove-BwVaultOrgCollection + +## SYNOPSIS +Deletes Bitwarden Org Collections Items + +## SYNTAX + +``` +Remove-BwVaultOrgCollection [-Id] [-OrganizationId] [] +``` + +## DESCRIPTION +Calls DELETE /object/org-collection/{id} to move organization collections to the trash, this does not delete the items inside + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +OrgCollection guid + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrganizationId +{{ Fill OrganizationId Description }} + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Restore-BwVaultItem.md b/Docs/Restore-BwVaultItem.md index 2550e32..e68cabd 100644 --- a/Docs/Restore-BwVaultItem.md +++ b/Docs/Restore-BwVaultItem.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Send-BwPublicMemberInvite.md b/Docs/Send-BwPublicMemberInvite.md index 115f9a8..24ab2f4 100644 --- a/Docs/Send-BwPublicMemberInvite.md +++ b/Docs/Send-BwPublicMemberInvite.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Start-BwRestServer.md b/Docs/Start-BwRestServer.md index 38df22d..92dc518 100644 --- a/Docs/Start-BwRestServer.md +++ b/Docs/Start-BwRestServer.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/cli/#serve schema: 2.0.0 --- diff --git a/Docs/Stop-BwRestServer.md b/Docs/Stop-BwRestServer.md index a8a92ae..da49f34 100644 --- a/Docs/Stop-BwRestServer.md +++ b/Docs/Stop-BwRestServer.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/cli/#serve schema: 2.0.0 --- diff --git a/Docs/Sync-BwVault.md b/Docs/Sync-BwVault.md index e38812c..e390fa0 100644 --- a/Docs/Sync-BwVault.md +++ b/Docs/Sync-BwVault.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Unlock-BwVault.md b/Docs/Unlock-BwVault.md index 7984761..55952d8 100644 --- a/Docs/Unlock-BwVault.md +++ b/Docs/Unlock-BwVault.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Update-BwSend.md b/Docs/Update-BwSend.md new file mode 100644 index 0000000..bab5880 --- /dev/null +++ b/Docs/Update-BwSend.md @@ -0,0 +1,93 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Update-BwSend + +## SYNOPSIS +Updates Bitwarden Send + +## SYNTAX + +### BodyUpdate (Default) +``` +Update-BwSend -Id [-Send ] [] +``` + +### FullObject +``` +Update-BwSend [-Send ] [] +``` + +## DESCRIPTION +PUT /object/send/{id} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Send guid + +```yaml +Type: Object +Parameter Sets: BodyUpdate +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Send +Full Send object in pscustoobject or json format + +```yaml +Type: Object +Parameter Sets: BodyUpdate +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: Object +Parameter Sets: FullObject +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Docs/Update-BwVaultItem.md b/Docs/Update-BwVaultItem.md index 1e730c9..4e08d80 100644 --- a/Docs/Update-BwVaultItem.md +++ b/Docs/Update-BwVaultItem.md @@ -1,6 +1,6 @@ --- -external help file: Bitwarden-help.xml -Module Name: Bitwarden +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS online version: https://bitwarden.com/help/vault-management-api/ schema: 2.0.0 --- diff --git a/Docs/Update-BwVaultOrgCollection.md b/Docs/Update-BwVaultOrgCollection.md new file mode 100644 index 0000000..5b068b9 --- /dev/null +++ b/Docs/Update-BwVaultOrgCollection.md @@ -0,0 +1,93 @@ +--- +external help file: BitwardenPS-help.xml +Module Name: BitwardenPS +online version: https://bitwarden.com/help/vault-management-api/ +schema: 2.0.0 +--- + +# Update-BwVaultOrgCollection + +## SYNOPSIS +Updates Bitwarden Vault Items + +## SYNTAX + +### BodyUpdate (Default) +``` +Update-BwVaultOrgCollection -Id [-OrgCollection ] [] +``` + +### FullObject +``` +Update-BwVaultOrgCollection [-OrgCollection ] [] +``` + +## DESCRIPTION +PUT /object/item/{id} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Id +Item guid + +```yaml +Type: Object +Parameter Sets: BodyUpdate +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrgCollection +{{ Fill OrgCollection Description }} + +```yaml +Type: Object +Parameter Sets: BodyUpdate +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: Object +Parameter Sets: FullObject +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[https://bitwarden.com/help/vault-management-api/](https://bitwarden.com/help/vault-management-api/) + diff --git a/Output/Bitwarden/Bitwarden.psd1 b/Output/Bitwarden/Bitwarden.psd1 deleted file mode 100644 index ff1d330..0000000 --- a/Output/Bitwarden/Bitwarden.psd1 +++ /dev/null @@ -1,131 +0,0 @@ -# -# Module manifest for module 'Bitwarden' -# -# Generated by: John Duprey -# -# Generated on: 9/27/2022 -# - -@{ - - # Script module or binary module file associated with this manifest. - RootModule = 'Bitwarden.psm1' - - # Version number of this module. - ModuleVersion = '1.0.0.0' - - # Supported PSEditions - # CompatiblePSEditions = @() - - # ID used to uniquely identify this module - GUID = 'd0d54383-4174-44a2-94c4-e21b5213a83f' - - # Author of this module - Author = 'John Duprey' - - # Company or vendor of this module - CompanyName = '' - - # Copyright statement for this module - Copyright = '2022 John Duprey' - - # Description of the functionality provided by this module - Description = 'Bitwarden REST API module' - - # Minimum version of the PowerShell engine required by this module - PowerShellVersion = '7.0' - - # Name of the PowerShell host required by this module - # PowerShellHostName = '' - - # Minimum version of the PowerShell host required by this module - # PowerShellHostVersion = '' - - # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. - # DotNetFrameworkVersion = '' - - # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. - # ClrVersion = '' - - # Processor architecture (None, X86, Amd64) required by this module - # ProcessorArchitecture = '' - - # Modules that must be imported into the global environment prior to importing this module - #RequiredModules = @('') - - # Assemblies that must be loaded prior to importing this module - # RequiredAssemblies = @() - - # Script files (.ps1) that are run in the caller's environment prior to importing this module. - ScriptsToProcess = @() - - # Type files (.ps1xml) to be loaded when importing this module - # TypesToProcess = @() - - # Format files (.ps1xml) to be loaded when importing this module - # FormatsToProcess = @() - - # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess - # NestedModules = @() - - # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. - FunctionsToExport = @('Get-PublicCollections','Connect-PublicApi','Get-PublicEvents','Get-PublicGroupMemberIds','Get-PublicGroups','Get-PublicMemberGroupIds','Get-PublicMembers','Send-PublicMemberInvite','Get-VaultAttachment','Get-VaultItemNotes','Get-VaultItemPassword','Get-VaultItemPwExposed','Get-VaultItemTotp','Get-VaultItemUri','Get-VaultItemUsername','New-VaultAttachment','Remove-VaultAttachment','Confirm-VaultOrgMember','Get-VaultCollections','Get-VaultOrgCollection','Get-VaultOrgMembers','Get-VaultOrgs','Move-VaultItemToCollection','New-VaultOrgCollection','Remove-VaultOrgCollection','Update-VaultOrgCollection','Get-VaultFolder','Remove-VaultFolder','Update-VaultFolder','Get-VaultItem','New-VaultItem','Remove-VaultItem','Restore-VaultItem','Update-VaultItem','Lock-Vault','Unlock-Vault','Get-VaultStatus','Get-VaultTemplate','New-Password','Sync-Vault','Start-RestServer','Stop-RestServer','Get-Send','New-Send','Remove-Send','Update-Send') - - # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. - #CmdletsToExport = '*' - - # Variables to export from this module - #VariablesToExport = '*' - - # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. - #AliasesToExport = '*' - - # DSC resources to export from this module - # DscResourcesToExport = @() - - # List of all modules packaged with this module - # ModuleList = @() - - # List of all files packaged with this module - # FileList = @() - - # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. - PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - # Tags = @() - - # A URL to the license for this module. - # LicenseUri = '' - - # A URL to the main website for this project. - # ProjectUri = '' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - # Prerelease string of this module - # Prerelease = '' - - # Flag to indicate whether the module requires explicit user acceptance for install/update/save - # RequireLicenseAcceptance = $false - - # External dependent modules of this module - #ExternalModuleDependencies = @() - - } # End of PSData hashtable - - } # End of PrivateData hashtable - - # HelpInfo URI of this module - # HelpInfoURI = '' - - # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. - DefaultCommandPrefix = 'Bw' - -} diff --git a/Output/Bitwarden/Bitwarden.psm1 b/Output/Bitwarden/Bitwarden.psm1 deleted file mode 100644 index ea2bafc..0000000 --- a/Output/Bitwarden/Bitwarden.psm1 +++ /dev/null @@ -1,2111 +0,0 @@ -#Region '.\Private\Invoke\Invoke-PublicApi.ps1' 0 -function Invoke-PublicApi { - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Endpoint, - [ValidateSet('Get', 'Put', 'Post', 'Delete')] - $Method = 'Get', - $Body = '' - ) - - if (!$script:BwPublicApi) { - Write-Error 'Not connected to Bitwarden Public API' - return $false - } - - $Uri = 'https://{0}/{1}' -f $script:BwPublicApi.Server, $Endpoint - - $Headers = @{ - Authorization = ('Bearer {0}' -f $script:BwPublicApi.Token) - 'Content-Type' = 'application/json' - } - - if ($Method -eq 'Post') { - if ($Body -ne '') { - $RestMethod.Body = $Body - } - } - - $RestMethod = @{ - Uri = $Uri - Method = $Method - Headers = $Headers - } - - Write-Verbose ($RestMethod | ConvertTo-Json) - $Response = Invoke-RestMethod @RestMethod -SkipHttpErrorCheck - if ($Response.data) { - $Response.data - } - else { - $Response - } -} -#EndRegion '.\Private\Invoke\Invoke-PublicApi.ps1' 44 -#Region '.\Private\Invoke\Invoke-VaultApi.ps1' 0 -function Invoke-VaultApi { - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Endpoint, - [ValidateSet('Get', 'Put', 'Post', 'Delete')] - $Method = 'Get', - $QueryParams = '', - $Body = '', - $ContentType = 'application/json', - $OutFile = '' - ) - - if (!$script:BwRestServer.Hostname) { - Start-BwRestServer | Out-Null - } - - $Uri = 'http://{0}:{1}/{2}' -f $script:BwRestServer.Hostname, $script:BwRestServer.Port, $Endpoint - - if ($QueryParams -ne '') { - $UriBuilder = [System.UriBuilder]$Uri - $UriBuilder.Query = $QueryParams.ToString() - $Uri = $UriBuilder.Uri.OriginalString - } - - Write-Verbose $Uri - - $Headers = @{ - 'Accept' = 'application/json' - } - $RestMethod = @{ - Uri = $Uri - Method = $Method - } - - if ($Method -eq 'Post' -or $Method -eq 'Put') { - $headers.'Content-Type' = $ContentType - if ($Body -ne '') { - $RestMethod.Body = $Body - } - $RestMethod.Headers = $Headers - } - Write-Verbose ($Headers | ConvertTo-Json) - - if ($OutFile) { - Invoke-WebRequest @RestMethod -OutFile $OutFile - } - else { - Invoke-RestMethod @RestMethod -SkipHttpErrorCheck - } -} -#EndRegion '.\Private\Invoke\Invoke-VaultApi.ps1' 52 -#Region '.\Private\Invoke\Invoke-VaultCli.ps1' 0 -function Invoke-VaultCli { - <# - .SYNOPSIS - Runs Bitwarden Cli commands - - .DESCRIPTION - Calls bw command - - #> - [cmdletbinding()] - Param( - $Arguments - ) - - $bw = Get-Command bw - if (!$bw) { - Write-Error 'Bitwarden CLI is not installed' - return $false - } - - $pinfo = New-Object System.Diagnostics.ProcessStartInfo - $pinfo.FileName = $bw.Path - $pinfo.RedirectStandardError = $false - $pinfo.RedirectStandardOutput = $true - $pinfo.UseShellExecute = $false - $pinfo.Arguments = $Arguments - $p = New-Object System.Diagnostics.Process - $p.StartInfo = $pinfo - $p.Start() | Out-Null - $p.WaitForExit() - $stdout = $p.StandardOutput.ReadToEnd() - $stdout | ConvertFrom-Json -} -#EndRegion '.\Private\Invoke\Invoke-VaultCli.ps1' 34 -#Region '.\Public\Public API\Collections\Get-PublicCollections.ps1' 0 -function Get-PublicCollections { - [CmdletBinding()] - Param( - $Id = '' - ) - $Endpoint = 'public/collections' - - if ($Id -ne '') { - $Endpoint = '{0}/{1}' -f $Endpoint, $Id - } - Invoke-PublicApi -Endpoint $Endpoint -} -#EndRegion '.\Public\Public API\Collections\Get-PublicCollections.ps1' 13 -#Region '.\Public\Public API\Connect\Connect-PublicApi.ps1' 0 -function Connect-PublicApi { - <# - .SYNOPSIS - Connects to Bitwarden Public API - - .DESCRIPTION - Generates OAuth token to interact with public API - - .PARAMETER Credentials - Client ID and Secret in PSCredential object - - .PARAMETER Server - Bitwarden identity server hostname, default identity.bitwarden.com - - #> - [CmdletBinding()] - Param( - [pscredential]$Credentials = (Get-Credential -Message 'Enter ClientID and Secret'), - $Server = 'identity.bitwarden.com' - ) - - if ($Server -eq 'identity.bitwarden.com') { - $ApiServer = 'api.bitwarden.com' - $Uri = 'https://{0}/connect/token' -f $Server - } - else { - $ApiServer = $Server - $Uri = 'https://{0}/identity/connect/token' -f $Server - } - $AuthRequest = @{ - Uri = $Uri - ContentType = 'application/x-www-form-urlencoded' - Body = @{ - grant_type = 'client_credentials' - scope = 'api.organization' - client_id = $Credentials.GetNetworkCredential().UserName - client_secret = $Credentials.GetNetworkCredential().Password - } - } - - $Response = Invoke-RestMethod @AuthRequest -Method Post -SkipHttpErrorCheck - - if ($Response) { - Write-Verbose 'Connected to the Bitwarden Public API' - $script:BwPublicApi = @{ - Token = $Response.access_token - Server = $ApiServer - } - $true - } - else { - Write-Error $Response - $false - } - -} -#EndRegion '.\Public\Public API\Connect\Connect-PublicApi.ps1' 57 -#Region '.\Public\Public API\Events\Get-PublicEvents.ps1' 0 -function Get-PublicEvents { - <# - .SYNOPSIS - Gets Bitwarden events - - .DESCRIPTION - Calls the /public/events endpoint to retrieve audit trail - - #> - [CmdletBinding()] - Param() - - $EventMsg = [PSCustomObject]@{ - '1000' = 'Logged In' - '1001' = 'Changed account password' - '1002' = 'Enabled/updated two-step login' - '1003' = 'Disabled two-step login' - '1004' = 'Recovered account from two-step login' - '1005' = 'Login attempted failed with incorrect password' - '1006' = 'Login attempt failed with incorrect two-step login' - '1007' = 'User exported their individual vault items' - '1008' = 'User updated a password issued through Admin Password Reset' - '1009' = 'User migrated their decryption key with Key Connector' - '1100' = 'Created item item-identifier' - '1101' = 'Edited item item-identifier' - '1102' = 'Permanently Deleted item item-identifier' - '1103' = 'Created attachment for item item-identifier' - '1104' = 'Deleted attachment for item item-identifier' - '1105' = 'Shared item item-identifier' - '1106' = 'Edited collections for item item-identifier' - '1107' = 'Viewed item item-identifier' - '1108' = 'Viewed password for item item-identifier' - '1109' = 'Viewed hidden field for item item-identifier' - '1110' = 'Viewed security code for item item-identifier' - '1111' = 'Copied password for item item-identifier' - '1112' = 'Copied hidden field for item item-identifier' - '1113' = 'Copied security code for item item-identifier' - '1114' = 'Auto-filled item item-identifier' - '1115' = 'Sent item item-identifier to trash' - '1116' = 'Restored item item-identifier' - '1117' = 'Viewed Card Number for item item-identifier' - '1300' = 'Created collection collection-identifier' - '1301' = 'Edited collection collection-identifier' - '1302' = 'Deleted collection collection-identifier' - '1400' = 'Created group group-identifier' - '1401' = 'Edited group group-identifier' - '1402' = 'Deleted group group-identifier' - '1500' = 'Invited user user-identifier' - '1501' = 'Confirmed user user-identifier' - '1502' = 'Edited user user-identifier' - '1503' = 'Removed user user-identifier' - '1504' = 'Edited groups for user user-identifier' - '1505' = 'Unlinked SSO' - '1506' = 'user-identifier enrolled in Master Password Reset' - '1507' = 'user-identifier withdrew from Master Password Reset' - '1508' = 'Master Password was reset for user-identifier' - '1509' = 'Reset SSO link for user user-identifier' - '1510' = 'user-identifer logged in using SSO for the first time' - '1511' = 'Revoked organization access for user-identifier' - '1512' = 'Restores organization access for user-identifier' - '1600' = 'Edited organization settings' - '1601' = 'Purged organization vault' - '1603' = 'Organization Vault access by a managing Provider' - '1604' = 'Organization enabled SSO' - '1605' = 'Organization disabled SSO' - '1606' = 'Organization enabled Key Connector' - '1607' = 'Organization disabled Key Connector' - '1608' = 'Families Sponsorships synced' - '1700' = 'Updated a Policy' - } - - $Endpoint = 'public/events' - $Events = Invoke-PublicApi -Endpoint $Endpoint - $Members = Get-PublicMembers - $Groups = Get-PublicGroups - - foreach ($Event in $Events) { - if ($Event.groupId) { $GroupName = ($Groups | Where-Object { $_.id -eq $Event.groupId }).name } - if ($Event.memberId) { $MemberEmail = ($Members | Where-Object { $_.userId -eq $Event.memberId }).email } - $ActingUser = ($Members | Where-Object { $_.userId -eq $Event.actingUserId }).email - $TypeId = $Event.type - $Message = $EventMsg.$TypeId -replace 'item-identifier', $Event.itemId -replace 'collection-identifier', $Event.collectionId -replace 'group-identifier', $GroupName -replace 'member-identifier', $MemberEmail -replace 'user-identifier', $ActingUser - - [PSCustomObject]@{ - message = $Message - type = $Event.type - itemId = $Event.itemId - collectionId = $Event.collectionId - groupId = $Event.groupId - policyId = $Event.policyId - memberId = $Event.memberId - actingUserId = $Event.actingUserId - actingUser = $ActingUser - date = $Event.date - ipAddress = $Event.ipAddress - } - } -} -#EndRegion '.\Public\Public API\Events\Get-PublicEvents.ps1' 99 -#Region '.\Public\Public API\Groups\Get-PublicGroupMemberIds.ps1' 0 -function Get-PublicGroupMemberIds { - <# - .SYNOPSIS - Short description - - .DESCRIPTION - Long description - - .PARAMETER Id - Parameter description - - .EXAMPLE - An example - - .NOTES - General notes - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Endpoint = 'public/groups/{0}/member-ids' -f $Id - Invoke-PublicApi -Endpoint $Endpoint -} -#EndRegion '.\Public\Public API\Groups\Get-PublicGroupMemberIds.ps1' 27 -#Region '.\Public\Public API\Groups\Get-PublicGroups.ps1' 0 -function Get-PublicGroups { - [CmdletBinding()] - Param( - $Id = '' - ) - $Endpoint = 'public/groups' - if ($Id -ne '') { - $Endpoint = '{0}/{1}' -f $Endpoint, $Id - } - Invoke-PublicApi -Endpoint $Endpoint -} -#EndRegion '.\Public\Public API\Groups\Get-PublicGroups.ps1' 12 -#Region '.\Public\Public API\Members\Get-PublicMemberGroupIds.ps1' 0 -function Get-PublicMemberGroupIds { - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Endpoint = 'public/members/{0}/group-ids' -f $Id - Invoke-PublicApi -Endpoint $Endpoint -} -#EndRegion '.\Public\Public API\Members\Get-PublicMemberGroupIds.ps1' 11 -#Region '.\Public\Public API\Members\Get-PublicMembers.ps1' 0 -function Get-PublicMembers { - [CmdletBinding()] - Param( - $Id = '' - ) - $Endpoint = 'public/members' - if ($Id -ne '') { - $Endpoint = '{0}/{1}' -f $Endpoint, $Id - } - Invoke-PublicApi -Endpoint $Endpoint -} -#EndRegion '.\Public\Public API\Members\Get-PublicMembers.ps1' 12 -#Region '.\Public\Public API\Members\Send-PublicMemberInvite.ps1' 0 -function Send-PublicMemberInvite { - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - $Endpoint = 'public/members/{0}/reinvite' -f $id - - Invoke-PublicApi -Endpoint $Endpoint -Method Post -} -#EndRegion '.\Public\Public API\Members\Send-PublicMemberInvite.ps1' 11 -#Region '.\Public\Vault API\Attachments & Fields\Get-VaultAttachment.ps1' 0 -function Get-VaultAttachment { - <# - .SYNOPSIS - Gets Bitwarden Vault Attachments - - .DESCRIPTION - Calls Get /object/attachment/{id} to download attachments - - .PARAMETER Id - Attachment id - - .PARAMETER ItemId - Item Guid - - .PARAMETER FilePath - Path to save file - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id, - [Parameter(Mandatory = $true)] - $ItemId, - $FilePath = '' - ) - - $Endpoint = 'object/attachment/{0}' -f $Id - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - $QueryParams.Add('itemid', $ItemId) | Out-Null - - $VaultApi = @{ - Endpoint = $Endpoint - QueryParams = $QueryParams - } - - if ($FilePath) { - $VaultApi.OutFile = $FilePath - } - - Invoke-VaultApi @VaultApi -} -#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultAttachment.ps1' 46 -#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemNotes.ps1' 0 -function Get-VaultItemNotes { - <# - .SYNOPSIS - Returns Notes of a vault item - - .DESCRIPTION - Calls /object/notes/{id} endpoint to retrieve notes - - .PARAMETER Id - Item guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Request = Invoke-VaultApi -Endpoint ('object/notes/{0}' -f $Id) - if ($Request.success) { - $Request.data.data - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemNotes.ps1' 31 -#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemPassword.ps1' 0 -function Get-VaultItemPassword { - <# - .SYNOPSIS - Returns password of a vault item - - .DESCRIPTION - Calls /object/password/{id} endpoint to retrieve password - - .PARAMETER Id - Item guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Request = Invoke-VaultApi -Endpoint ('object/password/{0}' -f $Id) - if ($Request.success) { - $Request.data.data - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemPassword.ps1' 31 -#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemPwExposed.ps1' 0 -function Get-VaultItemPwExposed { - <# - .SYNOPSIS - Returns count of times a vault item password has been exposed - - .DESCRIPTION - Calls /object/exposed/{id} endpoint to retrieve count - - .PARAMETER Id - Item guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Request = Invoke-VaultApi -Endpoint ('object/exposed/{0}' -f $Id) - if ($Request.success) { - $Request.data.data - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemPwExposed.ps1' 31 -#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemTotp.ps1' 0 -function Get-VaultItemTotp { - <# - .SYNOPSIS - Returns TOTP of a vault item - - .DESCRIPTION - Calls /object/totp/{id} endpoint to retrieve TOTP - - .PARAMETER Id - Item guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Request = Invoke-VaultApi -Endpoint ('object/totp/{0}' -f $Id) - if ($Request.success) { - $Request.data.data - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemTotp.ps1' 31 -#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemUri.ps1' 0 -function Get-VaultItemUri { - <# - .SYNOPSIS - Returns URI of a vault item - - .DESCRIPTION - Calls /object/uri/{id} endpoint to retrieve URI - - .PARAMETER Id - Item guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Request = Invoke-VaultApi -Endpoint ('object/uri/{0}' -f $Id) - if ($Request.success) { - $Request.data.data - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemUri.ps1' 31 -#Region '.\Public\Vault API\Attachments & Fields\Get-VaultItemUsername.ps1' 0 -function Get-VaultItemUsername { - <# - .SYNOPSIS - Returns username of a vault item - - .DESCRIPTION - Calls /object/username/{id} endpoint to retrieve username - - .PARAMETER Id - Item guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Request = Invoke-VaultApi -Endpoint ('object/username/{0}' -f $Id) - if ($Request.success) { - $Request.data.data - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Attachments & Fields\Get-VaultItemUsername.ps1' 31 -#Region '.\Public\Vault API\Attachments & Fields\New-VaultAttachment.ps1' 0 -function New-VaultAttachment { - <# - .SYNOPSIS - Creates attachment in vault - - .DESCRIPTION - POSTS multipart form data to /attachment - - .PARAMETER ItemId - Item guid - - .PARAMETER Content - String contents of file - - .PARAMETER FileName - Name of file to create - - .PARAMETER Path - Path to file instead of string contents - - #> - [cmdletbinding(DefaultParameterSetName = 'Content')] - Param ( - [parameter(Mandatory = $true)] - $ItemId, - - [parameter(ParameterSetName = 'Content', Mandatory = $True)] - [string]$Content, - [parameter(ParameterSetName = 'Content', Mandatory = $True)] - [string]$FileName, - - [validatescript({ Test-Path -PathType Leaf -Path $_ })] - [parameter(ParameterSetName = 'File', Mandatory = $True)] - [string]$Path - ) - Process { - $MultipartContent = [System.Net.Http.MultipartFormDataContent]::new() - $FileHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new('form-data') - $FileHeader.Name = 'file' - - if ($Content) { - $ByteArray = [System.Text.Encoding]::UTF8.GetBytes($Content) - $FileStream = New-Object -TypeName 'System.IO.MemoryStream' -ArgumentList (, $ByteArray) - } - else { - $FileName = Split-Path -Path $Path -Leaf - $FileStream = [System.IO.FileStream]::new($Path, [System.IO.FileMode]::Open) - } - - $FileContent = [System.Net.Http.StreamContent]::new($FileStream) - $FileHeader.FileName = $FileName - $FileContent.Headers.ContentDisposition = $fileHeader - $FileContent.Headers.ContentType = [System.Net.Http.Headers.MediaTypeHeaderValue]::Parse('multipart/form-data') - $MultipartContent.Add($FileContent) - - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - $QueryParams.Add('itemid', $ItemId) | Out-Null - - try { - $response = Invoke-VaultApi -Endpoint 'attachment' -QueryParams $QueryParams -Method Post -Body $MultipartContent -ContentType 'multipart/form-data' - } - catch { - Write-Error "Upload attachment failed: $_" - throw $_ - } - finally { - $fileStream.Close() - } - $response - } -} -#EndRegion '.\Public\Vault API\Attachments & Fields\New-VaultAttachment.ps1' 72 -#Region '.\Public\Vault API\Attachments & Fields\Remove-VaultAttachment.ps1' 0 -function Remove-VaultAttachment { - <# - .SYNOPSIS - Deletes Bitwarden Vault Attachments - - .DESCRIPTION - Calls DELETE /object/item/{id} to move items to the trash - - .PARAMETER Id - Attachment id - - .PARAMETER ItemId - Item Guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id, - [Parameter(Mandatory = $true)] - $ItemId - ) - - $Endpoint = 'object/attachment/{0}' -f $Id - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - $QueryParams.Add('itemid', $ItemId) | Out-Null - - $VaultApi = @{ - Method = 'Delete' - Endpoint = $Endpoint - Body = $Body - QueryParams = $QueryParams - } - - Invoke-VaultApi @VaultApi -} -#EndRegion '.\Public\Vault API\Attachments & Fields\Remove-VaultAttachment.ps1' 40 -#Region '.\Public\Vault API\Collections & Organizations\Confirm-VaultOrgMember.ps1' 0 -function Confirm-VaultOrgMember { - <# - .SYNOPSIS - Gets Bitwarden Vault Org Collections - - .DESCRIPTION - Calls /list/object/org-members - - .PARAMETER Id - Guid of Org Member - - .PARAMETER OrganizationId - Guid of Organization - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id, - [Parameter(Mandatory = $true)] - $OrganizationId - ) - - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - $QueryParams.Add('organizationid', $OrganizationId) | Out-Null - - $Endpoint = 'confirm/org-member/{0}' -f $Id - Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams -} -#EndRegion '.\Public\Vault API\Collections & Organizations\Confirm-VaultOrgMember.ps1' 33 -#Region '.\Public\Vault API\Collections & Organizations\Get-VaultCollections.ps1' 0 -function Get-VaultCollections { - <# - .SYNOPSIS - Gets Bitwarden Vault Collections - - .DESCRIPTION - Calls /list/object/collections - - .PARAMETER Search - Organization name to search for - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - $Search = '' - ) - - $Endpoint = 'list/object/collections' - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - if ($Search -ne '') { - $QueryParams.Add('search', $Search) | Out-Null - } - $Request = Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams - - if ($Request.success) { - $Request.data.data - } - else { - Write-Host $Request.message - $Request.success - } - -} -#EndRegion '.\Public\Vault API\Collections & Organizations\Get-VaultCollections.ps1' 37 -#Region '.\Public\Vault API\Collections & Organizations\Get-VaultOrgCollection.ps1' 0 -function Get-VaultOrgCollection { - <# - .SYNOPSIS - Gets Bitwarden Vault Org Collections - - .DESCRIPTION - Calls /list/object/org-collections or /object/org-collection/{id} - - .PARAMETER Id - Guid of Collection - - .PARAMETER OrganizationId - Guid of Organization - - .PARAMETER Search - Search parameters - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding(DefaultParameterSetName = 'List')] - Param( - [Parameter(ParameterSetName = 'Single', Mandatory = $true)] - $Id, - - [Parameter(ParameterSetName = 'Single', Mandatory = $true)] - [Parameter(ParameterSetName = 'List', Mandatory = $true)] - $OrganizationId, - - [Parameter(ParameterSetName = 'List')] - $Search = '' - ) - - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - $QueryParams.Add('organizationid', $OrganizationId) | Out-Null - - switch ($PSCmdlet.ParameterSetName) { - 'List' { - $Endpoint = 'list/object/org-collections' - - if ($Search -ne '') { - $QueryParams.Add('search', $Search) | Out-Null - } - - } - 'Single' { - $Endpoint = 'object/org-collection/{0}' -f $Id - } - } - $Request = Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams - - if ($Request.success) { - if ($Request.data.data) { - $Request.data.data - } - elseif ($Request.data) { - $Request.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Collections & Organizations\Get-VaultOrgCollection.ps1' 66 -#Region '.\Public\Vault API\Collections & Organizations\Get-VaultOrgMembers.ps1' 0 -function Get-VaultOrgMembers { - <# - .SYNOPSIS - Gets Bitwarden Vault Org Collections - - .DESCRIPTION - Calls /list/object/org-members - - .PARAMETER OrganizationId - Guid of Organization - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $OrganizationId - ) - - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - $QueryParams.Add('organizationid', $OrganizationId) | Out-Null - - $Endpoint = 'list/object/org-members' - $Request = Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams - - if ($Request.success) { - if ($Request.data.data) { - $Request.data.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Collections & Organizations\Get-VaultOrgMembers.ps1' 38 -#Region '.\Public\Vault API\Collections & Organizations\Get-VaultOrgs.ps1' 0 -function Get-VaultOrgs { - <# - .SYNOPSIS - Gets Bitwarden Vault Organizations - - .DESCRIPTION - Calls /list/object/organizations - - .PARAMETER Search - Organization name to search for - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - $Search = '' - ) - - $Endpoint = 'list/object/organizations' - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - if ($Search -ne '') { - $QueryParams.Add('search', $Search) | Out-Null - } - $Request = Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams - - if ($Request.success) { - $Request.data.data - } - else { - Write-Host $Request.message - $Request.success - } - -} -#EndRegion '.\Public\Vault API\Collections & Organizations\Get-VaultOrgs.ps1' 37 -#Region '.\Public\Vault API\Collections & Organizations\Move-VaultItemToCollection.ps1' 0 -function Move-VaultItemToCollection { - <# - .SYNOPSIS - Moves Bitwarden Vault Item to Collection - - .DESCRIPTION - Calls /move/{itemid}/{organizationid} - - .PARAMETER ItemId - Guid of Item - - .PARAMETER OrganizationId - Guid of Organization - - .PARAMETER CollectionIds - List of CollectionIds - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $ItemId, - [Parameter(Mandatory = $true)] - $OrganizationId, - [Parameter(Mandatory = $true)] - [string[]]$CollectionIds - ) - - $Endpoint = 'move/{0}/{1}' -f $ItemId, $OrganizationId - $Body = @($CollectionIds) | ConvertTo-Json - - $VaultApi = @{ - Endpoint = $Endpoint - Body = $Body - Method = 'Post' - } - - $Request = Invoke-VaultApi @VaultApi - - if ($Request.success) { - $Request.data - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Collections & Organizations\Move-VaultItemToCollection.ps1' 51 -#Region '.\Public\Vault API\Collections & Organizations\New-VaultOrgCollection.ps1' 0 -function New-VaultOrgCollection { - <# - .SYNOPSIS - Creates Bitwarden Vault Org Collections - - .DESCRIPTION - Calls POST /object/org-collection to create new org collections - - .PARAMETER OrgCollection - Full item object in pscustoobject or json format - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(ValueFromPipeline, Mandatory = $true)] - $OrgCollection - ) - - $OrgCollectionValid = $false - - if ($OrgCollection.GetType().Name -eq 'pscustomobject') { - $Body = $OrgCollection | ConvertTo-Json -Depth 10 - $OrgCollectionValid = $true - } - elseif (Test-Json -Json $OrgCollection) { - $Body = $OrgCollection - $OrgCollectionValid = $true - } - - if (-not $OrgCollectionValid) { - Write-Error "Input validation failed for 'OrgCollection', valid types are pscustomobject or JSON string" - return - } - - $VaultApi = @{ - Method = 'POST' - Endpoint = 'object/org-collection' - Body = $Body - } - - $Request = Invoke-VaultApi @VaultApi - - if ($Request.success) { - if ($Request.data) { - $Request.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Collections & Organizations\New-VaultOrgCollection.ps1' 56 -#Region '.\Public\Vault API\Collections & Organizations\Remove-VaultOrgCollection.ps1' 0 -function Remove-VaultOrgCollection { - <# - .SYNOPSIS - Deletes Bitwarden Org Collections Items - - .DESCRIPTION - Calls DELETE /object/org-collection/{id} to move organization collections to the trash, this does not delete the items inside - - .PARAMETER Id - OrgCollection guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id, - [Parameter(Mandatory = $true)] - $OrganizationId - ) - - $Endpoint = 'object/org-collection/{0}' -f $Id - - $VaultApi = @{ - Method = 'Delete' - Endpoint = $Endpoint - } - - Invoke-VaultApi @VaultApi -} -#EndRegion '.\Public\Vault API\Collections & Organizations\Remove-VaultOrgCollection.ps1' 33 -#Region '.\Public\Vault API\Collections & Organizations\Update-VaultOrgCollection.ps1' 0 -function Update-VaultOrgCollection { - <# - .SYNOPSIS - Updates Bitwarden Vault Items - - .DESCRIPTION - PUT /object/item/{id} - - .PARAMETER Id - Item guid - - .PARAMETER Item - Full item object in pscustoobject or json format - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding(DefaultParameterSetName = 'BodyUpdate')] - Param( - [Parameter(ParameterSetName = 'BodyUpdate', Mandatory = $true)] - $Id, - - [Parameter(ParameterSetName = 'BodyUpdate')] - [Parameter(ValueFromPipeline, ParameterSetName = 'FullObject')] - $OrgCollection - ) - - $OrgCollectonValid = $false - - if ($OrgCollection.GetType().Name -eq 'pscustomobject') { - $Body = $OrgCollection | ConvertTo-Json -Depth 10 - if ($OrgCollection.id) { $Id = $Item.id } - $OrgCollectonValid = $true - } - elseif (Test-Json -Json $OrgCollection) { - $Object = $OrgCollection | ConvertFrom-Json - if ($Object.id) { - $Id = $Object.id - } - $Body = $OrgCollection - $OrgCollectonValid = $true - } - - if (-not $Id -or -not $OrgCollectonValid) { - Write-Error "Input validation failed for 'OrgCollection', valid types are pscustomobject or JSON string and and id property must be specified" - return - } - - $Endpoint = 'object/org-collection/{0}' -f $Id - - $VaultApi = @{ - Method = 'Put' - Endpoint = $Endpoint - Body = $Body - } - - $Request = Invoke-VaultApi @VaultApi - - if ($Request.success) { - if ($Request.data) { - $Request.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Collections & Organizations\Update-VaultOrgCollection.ps1' 70 -#Region '.\Public\Vault API\Folders\Get-VaultFolder.ps1' 0 -function Get-VaultFolder { - <# - .SYNOPSIS - Gets Bitwarden Vault Folder - - .DESCRIPTION - Calls /list/object/folders or /object/folder/{id} to retrieve vault folders - - .PARAMETER Id - Folder guid - - .PARAMETER Search - Search terms - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding(DefaultParameterSetName = 'List')] - Param( - [Parameter(ParameterSetName = 'Single', Mandatory = $true)] - $Id, - [Parameter(ParameterSetName = 'List')] - $Search = '' - ) - - switch ($PSCmdlet.ParameterSetName) { - 'List' { - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - - $Endpoint = 'list/object/folders' - if ($Search -ne '') { - $QueryParams.Add('search', $Search) | Out-Null - } - $VaultApi = @{ - Endpoint = $Endpoint - QueryParams = $QueryParams - } - } - 'Single' { - $Endpoint = 'object/folder/{0}' -f $Id - - $VaultApi = @{ - Endpoint = $Endpoint - } - } - } - - $Request = Invoke-VaultApi @VaultApi - - if ($Request.success) { - if ($Request.data.data) { - $Request.data.data - } - elseif ($Request.data) { - $Request.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Folders\Get-VaultFolder.ps1' 64 -#Region '.\Public\Vault API\Folders\Remove-VaultFolder.ps1' 0 -function Remove-VaultFolder { - <# - .SYNOPSIS - Deletes Bitwarden Vault Folder - - .DESCRIPTION - Calls DELETE /object/item/{id} to move items to the trash - - .PARAMETER Id - Item guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Endpoint = 'object/folder/{0}' -f $Id - - $VaultApi = @{ - Method = 'Delete' - Endpoint = $Endpoint - } - - Invoke-VaultApi @VaultApi -} -#EndRegion '.\Public\Vault API\Folders\Remove-VaultFolder.ps1' 31 -#Region '.\Public\Vault API\Folders\Update-VaultFolder.ps1' 0 -function Update-VaultItem { - <# - .SYNOPSIS - Updates Bitwarden Vault Folder - - .DESCRIPTION - PUT /object/folder/{id} - - .PARAMETER Id - Item guid - - .PARAMETER Name - Name of folder - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id, - [Parameter(Mandatory = $true)] - $Name - ) - - $Body = @{ - name = $Name - } | ConvertTo-Json - - $Endpoint = 'object/folder/{0}' -f $Id - - $VaultApi = @{ - Method = 'Put' - Endpoint = $Endpoint - Body = $Body - } - - $Request = Invoke-VaultApi @VaultApi - - if ($Request.success) { - if ($Request.data) { - $Request.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Folders\Update-VaultFolder.ps1' 51 -#Region '.\Public\Vault API\Items\Get-VaultItem.ps1' 0 -function Get-VaultItem { - <# - .SYNOPSIS - Gets Bitwarden Vault Items - - .DESCRIPTION - Calls /list/object/items or /object/item/{id} to retrieve vault items - - .PARAMETER Id - Item guid - - .PARAMETER AsCredential - Returns login property as credential object - - .PARAMETER OrganizationId - Organization Guid - - .PARAMETER CollectionId - Collection Guid - - .PARAMETER FolderId - Folder Guid - - .PARAMETER Search - Search terms - - .PARAMETER Url - Search for matching Urls - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding(DefaultParameterSetName = 'List')] - Param( - [Parameter(ParameterSetName = 'Single', Mandatory = $true)] - $Id, - [Parameter(ParameterSetName = 'Single')] - [switch]$AsCredential, - - [Parameter(ParameterSetName = 'List')] - $OrganizationId = '', - [Parameter(ParameterSetName = 'List')] - $CollectionId = '', - [Parameter(ParameterSetName = 'List')] - $FolderId = '', - [Parameter(ParameterSetName = 'List')] - $Search = '', - [Parameter(ParameterSetName = 'List')] - $Url = '' - ) - - switch ($PSCmdlet.ParameterSetName) { - 'List' { - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - - $Endpoint = 'list/object/items' - if ($Search -ne '') { - $QueryParams.Add('search', $Search) | Out-Null - } - if ($OrganizationId -ne '') { - $QueryParams.Add('organizationid', $OrganizationId) | Out-Null - } - if ($CollectionId -ne '') { - $QueryParams.Add('collectionid', $CollectionId) | Out-Null - } - if ($FolderId -ne '') { - $QueryParams.Add('folderid', $FolderId) | Out-Null - } - if ($Url -ne '') { - $QueryParams.Add('url', $Url) | Out-Null - } - - $VaultApi = @{ - Endpoint = $Endpoint - QueryParams = $QueryParams - } - } - 'Single' { - $Endpoint = 'object/item/{0}' -f $Id - - $VaultApi = @{ - Endpoint = $Endpoint - } - } - } - - $Request = Invoke-VaultApi @VaultApi - - if ($Request.success) { - if ($Request.data.data) { - $Request.data.data - } - elseif ($Request.data) { - if ($AsCredential) { - [securestring]$Password = ConvertTo-SecureString -String $Request.data.login.password -AsPlainText -Force - New-Object System.Management.Automation.PSCredential ($Request.data.login.username, $Password) - } - else { - $Request.data - } - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Items\Get-VaultItem.ps1' 109 -#Region '.\Public\Vault API\Items\New-VaultItem.ps1' 0 -function New-VaultItem { - <# - .SYNOPSIS - Creates Bitwarden Vault Items - - .DESCRIPTION - Calls POST /object/item to create vault items - - .PARAMETER Item - Full item object in pscustoobject or json format - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(ValueFromPipeline, Mandatory = $true)] - $Item - ) - - $ItemValid = $false - - if ($Item.GetType().Name -eq 'pscustomobject') { - $Body = $Item | ConvertTo-Json -Depth 10 - $ItemValid = $true - } - elseif (Test-Json -Json $Item) { - $Body = $Item - $ItemValid = $true - } - - if (-not $ItemValid) { - Write-Error "Input validation failed for 'Item', valid types are pscustomobject or JSON string and and id property must be specified" - return - } - - $VaultApi = @{ - Method = 'POST' - Endpoint = 'object/item' - Body = $Body - } - - $Request = Invoke-VaultApi @VaultApi - - if ($Request.success) { - if ($Request.data) { - $Request.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Items\New-VaultItem.ps1' 56 -#Region '.\Public\Vault API\Items\Remove-VaultItem.ps1' 0 -function Remove-VaultItem { - <# - .SYNOPSIS - Deletes Bitwarden Vault Items - - .DESCRIPTION - Calls DELETE /object/item/{id} to move items to the trash - - .PARAMETER Id - Item guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Endpoint = 'object/item/{0}' -f $Id - - $VaultApi = @{ - Method = 'Delete' - Endpoint = $Endpoint - } - - Invoke-VaultApi @VaultApi -} -#EndRegion '.\Public\Vault API\Items\Remove-VaultItem.ps1' 31 -#Region '.\Public\Vault API\Items\Restore-VaultItem.ps1' 0 -function Restore-VaultItem { - <# - .SYNOPSIS - Restores deleted Bitwarden Vault Items - - .DESCRIPTION - PUT /restore/item/{id} - - .PARAMETER Id - Item guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Endpoint = 'restore/item/{0}' -f $Id - - $VaultApi = @{ - Method = 'Post' - Endpoint = $Endpoint - Body = $Body - } - - Invoke-VaultApi @VaultApi -} -#EndRegion '.\Public\Vault API\Items\Restore-VaultItem.ps1' 32 -#Region '.\Public\Vault API\Items\Update-VaultItem.ps1' 0 -function Update-VaultItem { - <# - .SYNOPSIS - Updates Bitwarden Vault Items - - .DESCRIPTION - PUT /object/item/{id} - - .PARAMETER Id - Item guid - - .PARAMETER Item - Full item object in pscustoobject or json format - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding(DefaultParameterSetName = 'BodyUpdate')] - Param( - [Parameter(ParameterSetName = 'BodyUpdate', Mandatory = $true)] - $Id, - - [Parameter(ParameterSetName = 'BodyUpdate')] - [Parameter(ValueFromPipeline, ParameterSetName = 'FullObject')] - $Item - ) - - $ItemValid = $false - - if ($Item.GetType().Name -eq 'pscustomobject') { - $Body = $Item | ConvertTo-Json -Depth 10 - $Id = $Item.id - $ItemValid = $true - } - elseif (Test-Json -Json $Item) { - $Object = $Item | ConvertFrom-Json - $Id = $Object.id - $Body = $Item - $ItemValid = $true - } - - if (-not $Id -or -not $ItemValid) { - Write-Error "Input validation failed for 'Item', valid types are pscustomobject or JSON string and and id property must be specified" - return - } - - $Endpoint = 'object/item/{0}' -f $Id - - $VaultApi = @{ - Method = 'Put' - Endpoint = $Endpoint - Body = $Body - } - - $Request = Invoke-VaultApi @VaultApi - - if ($Request.success) { - if ($Request.data) { - $Request.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Items\Update-VaultItem.ps1' 68 -#Region '.\Public\Vault API\Lock & Unlock\Lock-Vault.ps1' 0 -function Lock-Vault { - <# - .SYNOPSIS - Locks Bitwarden Vault - - .DESCRIPTION - Calls the /lock endpoint to clean up session - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param() - $Request = Invoke-VaultApi -Endpoint 'lock' -Method Post - [Environment]::SetEnvironmentVariable('BW_SESSION', $null) - Write-Host $Request.data.title -} -#EndRegion '.\Public\Vault API\Lock & Unlock\Lock-Vault.ps1' 19 -#Region '.\Public\Vault API\Lock & Unlock\Unlock-Vault.ps1' 0 -function Unlock-Vault { - <# - .SYNOPSIS - Unlocks Bitwarden Vault - - .DESCRIPTION - Calls the /unlock endpoint to open the vault - - .PARAMETER Credential - Vault credential object for the master password - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [PSCredential]$Credential = (Get-Credential -UserName 'Master Password' ) - ) - - $Body = @{ - password = $Credential.GetNetworkCredential().Password - } | ConvertTo-Json -Compress - - $Request = Invoke-VaultApi -Endpoint 'unlock' -Method 'Post' -Body $Body - - # Set session variable for cli commands - [Environment]::SetEnvironmentVariable('BW_SESSION', $Request.data.raw) - - Write-Host $Request.data.title - $Request.success -} -#EndRegion '.\Public\Vault API\Lock & Unlock\Unlock-Vault.ps1' 33 -#Region '.\Public\Vault API\Miscellaneous\Get-VaultStatus.ps1' 0 -function Get-VaultStatus { - <# - .SYNOPSIS - Returns REST server status - - .DESCRIPTION - Calls /status endpoint to check if vault is logged in - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param() - $Request = Invoke-VaultApi -Endpoint 'status' - $Request.data.template -} -#EndRegion '.\Public\Vault API\Miscellaneous\Get-VaultStatus.ps1' 18 -#Region '.\Public\Vault API\Miscellaneous\Get-VaultTemplate.ps1' 0 -function Get-VaultTemplate { - <# - .SYNOPSIS - Returns vault template object - - .DESCRIPTION - Calls /template/{type} endpoint - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param( - [Parameter(Mandatory = $true)] - [ValidateSet('item', 'item.field', 'item.login', 'item.login.uri', 'item.card', 'item.identity', 'item.securenote', 'folder', 'collection', 'item-collections', 'org-collection')] - $Type - ) - - #API method not available yet - #Invoke-VaultApi -Endpoint ('template/{0}' -f $Type) - - $Arguments = @( - 'get' - 'template' - $Type - ) - - Invoke-VaultCli -Arguments $Arguments -} -#EndRegion '.\Public\Vault API\Miscellaneous\Get-VaultTemplate.ps1' 31 -#Region '.\Public\Vault API\Miscellaneous\New-Password.ps1' 0 -function New-Password { - <# - .SYNOPSIS - Creates a new password - - .DESCRIPTION - Calls the /generate endpoint to create a new password - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param() - $Request = Invoke-VaultApi -Endpoint 'generate' - if ($Request) { - $Request.data.data | ConvertTo-SecureString -AsPlainText -Force - } - else { - Write-Error 'Unable to generate password' - } -} -#EndRegion '.\Public\Vault API\Miscellaneous\New-Password.ps1' 23 -#Region '.\Public\Vault API\Miscellaneous\Sync-Vault.ps1' 0 -function Sync-Vault { - <# - .SYNOPSIS - Syncs local Bitwarden vault with server - - .DESCRIPTION - Calls /sync endpoint to synchronize local vault - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [cmdletbinding()] - Param() - $Request = Invoke-VaultApi -Endpoint 'sync' -Method Post - Write-Host $Request.data.title - $Request -} -#EndRegion '.\Public\Vault API\Miscellaneous\Sync-Vault.ps1' 19 -#Region '.\Public\Vault API\REST\Start-RestServer.ps1' 0 -function Start-RestServer { - <# - .SYNOPSIS - Starts Bitwarden REST server - - .DESCRIPTION - Uses `bw serve` to run local REST server - - .PARAMETER Port - Port to run server on, default 8087 - - .PARAMETER Hostname - Hostname to run server on, default localhost - - .LINK - https://bitwarden.com/help/cli/#serve - - #> - [cmdletbinding()] - Param( - $Port = 8087, - $Hostname = 'localhost' - ) - - $RunningCli = Get-Process bw -ErrorAction SilentlyContinue - if ($RunningCli -and -not $script:BwRestServer) { - $RunningCli | Stop-Process - } - - $Arguments = @( - 'serve' - "--port $Port" - "--hostname $Hostname" - ) - - try { - $bw = Get-Command bw - if (!$bw) { - Write-Error 'Bitwarden CLI is not installed' - return $false - } - $Proc = Start-Process -FilePath $bw.Path -ArgumentList $Arguments -NoNewWindow -PassThru -ErrorAction Stop - - $OldProgPref = $global:ProgressPreference - $global:ProgressPreference = 'SilentlyContinue' - - do { - $VaultRest = Test-NetConnection -ComputerName $Hostname -Port $Port -InformationLevel Quiet -WarningAction SilentlyContinue - Start-Sleep -Seconds 1 - } while (-not $VaultRest) - - $global:ProgressPreference = $OldProgPref - - $script:BwRestServer = [PSCustomObject]@{ - PID = $Proc.Id - Port = $Port - Hostname = $Hostname - } - $script:BwRestServer - } - catch { - Write-Error 'Could not start REST server' - } -} -#EndRegion '.\Public\Vault API\REST\Start-RestServer.ps1' 65 -#Region '.\Public\Vault API\REST\Stop-RestServer.ps1' 0 -function Stop-RestServer { - <# - .SYNOPSIS - Stops Bitwarden REST server - - .DESCRIPTION - Stops bw process if found running - - .LINK - https://bitwarden.com/help/cli/#serve - - #> - [cmdletbinding()] - Param() - - $RunningCli = Get-Process bw -ErrorAction SilentlyContinue - if ($RunningCli) { - Write-Host 'Stopping REST server' - $RunningCli | Stop-Process - } - -} -#EndRegion '.\Public\Vault API\REST\Stop-RestServer.ps1' 23 -#Region '.\Public\Vault API\Send\Get-Send.ps1' 0 -function Get-Send { - <# - .SYNOPSIS - Gets Bitwarden Sends - - .DESCRIPTION - Calls /list/object/send or /object/send/{id} - - .PARAMETER Id - Guid of Collection - - .PARAMETER Search - Search parameters - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding(DefaultParameterSetName = 'List')] - Param( - [Parameter(ParameterSetName = 'Single', Mandatory = $true)] - $Id, - - [Parameter(ParameterSetName = 'List')] - $Search = '' - ) - - switch ($PSCmdlet.ParameterSetName) { - 'List' { - $Endpoint = 'list/object/send' - $QueryParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) - if ($Search -ne '') { - $QueryParams.Add('search', $Search) | Out-Null - } - - } - 'Single' { - $Endpoint = 'object/send/{0}' -f $Id - } - } - $Request = Invoke-VaultApi -Endpoint $Endpoint -QueryParams $QueryParams - - if ($Request.success) { - if ($Request.data.data) { - $Request.data.data - } - elseif ($Request.data) { - $Request.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Send\Get-Send.ps1' 56 -#Region '.\Public\Vault API\Send\New-Send.ps1' 0 -function New-Send { - <# - .SYNOPSIS - Creates Bitwarden Send - - .DESCRIPTION - Calls POST /object/send to create a new send - - .PARAMETER OrgCollection - Full item object in pscustoobject or json format - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding(DefaultParameterSetName = 'SendParams')] - Param( - [Parameter(ParameterSetName = 'SendParams', Mandatory = $true)] - $Name, - [Parameter(ParameterSetName = 'SendParams')] - $Notes = '', - [Parameter(ParameterSetName = 'SendParams')] - $SendPass = '', - [Parameter(ParameterSetName = 'SendParams', Mandatory = $true)] - $Text, - [Parameter(ParameterSetName = 'SendParams')] - [int]$Days = 7, - [Parameter(ParameterSetName = 'SendParams')] - [int]$MaxAccessCount = 3, - [Parameter(ParameterSetName = 'SendParams')] - [switch]$HideText, - [Parameter(ParameterSetName = 'SendParams')] - [switch]$HideEmail, - [Parameter(ParameterSetName = 'FullObject', ValueFromPipeline, Mandatory = $true)] - $Send - ) - - $SendValid = $false - switch ($PSCmdlet.ParameterSetName) { - 'FullObject' { - if ($Send.GetType().Name -eq 'pscustomobject') { - $Body = $Send | ConvertTo-Json -Depth 10 - $SendValid = $true - } - elseif (Test-Json -Json $Send) { - $Body = $Send - $SendValid = $true - } - if (-not $SendValid) { - Write-Error "Input validation failed for 'Send', valid types are pscustomobject or JSON string" - return - } - } - 'SendParams' { - $Send = [pscustomobject]@{ - name = $Name - notes = $Notes - type = 0 - text = @{ - text = $Text - hidden = $HideText.IsPresent - } - file = $null - maxAccessCount = $MaxAccessCount - deletionDate = (Get-Date).AddDays($Days).ToUniversalTime() - expirationDate = (Get-Date).AddDays($Days).ToUniversalTime() - hideEmail = $HideEmail.IsPresent - disabled = $false - - } - if ($SendPass) { $Send.password = $SendPass } - - $Body = $Send | ConvertTo-Json - Write-Verbose $Body - } - } - - - $VaultApi = @{ - Method = 'POST' - Endpoint = 'object/send' - Body = $Body - } - - $Request = Invoke-VaultApi @VaultApi - - if ($Request.success) { - if ($Request.data) { - $Request.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Send\New-Send.ps1' 97 -#Region '.\Public\Vault API\Send\Remove-Send.ps1' 0 -function Remove-Send { - <# - .SYNOPSIS - Deletes Bitwarden Send - - .DESCRIPTION - Calls DELETE /object/send/{id} to move items to the trash - - .PARAMETER Id - Send guid - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding()] - Param( - [Parameter(Mandatory = $true)] - $Id - ) - - $Endpoint = 'object/send/{0}' -f $Id - - $VaultApi = @{ - Method = 'Delete' - Endpoint = $Endpoint - } - - Invoke-VaultApi @VaultApi -} -#EndRegion '.\Public\Vault API\Send\Remove-Send.ps1' 31 -#Region '.\Public\Vault API\Send\Update-Send.ps1' 0 -function Update-Send { - <# - .SYNOPSIS - Updates Bitwarden Send - - .DESCRIPTION - PUT /object/send/{id} - - .PARAMETER Id - Send guid - - .PARAMETER Send - Full Send object in pscustoobject or json format - - .LINK - https://bitwarden.com/help/vault-management-api/ - - #> - [CmdletBinding(DefaultParameterSetName = 'BodyUpdate')] - Param( - [Parameter(ParameterSetName = 'BodyUpdate', Mandatory = $true)] - $Id, - - [Parameter(ParameterSetName = 'BodyUpdate')] - [Parameter(ValueFromPipeline, ParameterSetName = 'FullObject')] - $Send - ) - - $SendValid = $false - - if ($Send.GetType().Name -eq 'pscustomobject') { - $Body = $Send | ConvertTo-Json -Depth 10 - $Id = $Send.id - $SendValid = $true - } - elseif (Test-Json -Json $Send) { - $Object = $Send | ConvertFrom-Json - $Id = $Object.id - $Body = $Send - $SendValid = $true - } - - if (-not $Id -or -not $SendValid) { - Write-Error "Input validation failed for 'Item', valid types are pscustomobject or JSON string and and id property must be specified" - return - } - - $Endpoint = 'object/send/{0}' -f $Id - - $VaultApi = @{ - Method = 'Put' - Endpoint = $Endpoint - Body = $Body - } - - $Request = Invoke-VaultApi @VaultApi - - if ($Request.success) { - if ($Request.data) { - $Request.data - } - } - else { - Write-Host $Request.message - $Request.success - } -} -#EndRegion '.\Public\Vault API\Send\Update-Send.ps1' 68