diff --git a/SecretManagement.1Password.Extension/SecretManagement.1Password.Extension.psm1 b/SecretManagement.1Password.Extension/SecretManagement.1Password.Extension.psm1 index 630950a..39a2513 100644 --- a/SecretManagement.1Password.Extension/SecretManagement.1Password.Extension.psm1 +++ b/SecretManagement.1Password.Extension/SecretManagement.1Password.Extension.psm1 @@ -176,6 +176,15 @@ function Get-SecretInfo { 'PASSWORD' { [SecretType]::SecureString } Default { [SecretType]::Unknown } } + + $metadata = @{ + id = $item.id + version = $item.version + created_at = Get-Date $item.created_at + updated_at = Get-Date $item.updated_at + additional_information = $item.additional_information + urls = $item.urls + } Write-Verbose $item.title @@ -185,7 +194,7 @@ function Get-SecretInfo { # See: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.secretmanagement/get-secret?view=ps-modules#-inputobject $keyList.Add( ` $(($item.title).ToLower()), ` - [SecretInformation]::new($item.title, $type, $($VaultName)) ` + [SecretInformation]::new($item.title, $type, $($VaultName), $metadata) ` ); } } diff --git a/tests/Get-SecretInfo.Tests.ps1 b/tests/Get-SecretInfo.Tests.ps1 index b10ad49..354b2b3 100644 --- a/tests/Get-SecretInfo.Tests.ps1 +++ b/tests/Get-SecretInfo.Tests.ps1 @@ -42,6 +42,11 @@ Describe 'It gets items' { $info | Should -HaveCount 1 } + it 'includes metadata' { + $info = Get-SecretInfo -Vault "$($testDetails.Vault)" + $info.Metadata.Count | Should -BeGreaterOrEqual 3 + } + AfterAll { if ($createdLogin) {& op item delete "$($testDetails.LoginName)"} }