Skip to content

Conversation

@chrisjantzen
Copy link

I noticed that when using Get-SecretInfo a Metadata attribute is included but empty. When looking at the code I found the Metadata field is part of Get-SecretInfo and Set-SecretInfo in SecretManagement but was not implemented in this project. 1Password includes version number, created datetime, and updated datetime with the op get list command for every password. I have modified Get-SecretInfo to include these details in the Metadata property. I have used a hashtable for Metadata as that is the required type according to the SecretManagement documentation.

I did not bother implementing this in Set-SecretInfo as these 3 values all update automatically, so it wouldn't make sense with that command.

A new test for the Metadata is included.

Before:

$passwords = Get-SecretInfo -Vault '1Password: Test'
$passwords[0] | fl *

Name      : Test Password
Type      : PSCredential
VaultName : 1Password: Test
Metadata  :

After:

$passwords = Get-SecretInfo -Vault '1Password: Test'
$passwords[0] | fl *

Name      : Test Password
Type      : PSCredential
VaultName : 1Password: Test
Metadata  : {[created_at, 2025-02-13 9:05:02 AM], [updated_at, 2025-02-14 4:10:11 PM], [version, 2]}

@chrisjantzen
Copy link
Author

I realized there is a use-case for some of the other data, so I've added some more values to the Metadata. Pretty much everything provided by the op get list command is available now, apart from the last editor which provides a User ID that I don't think is useful in this context.

It now looks something like this:

$passwords = Get-SecretInfo -Vault '1Password: Test'
$passwords[0] | fl *

Name      : Test Password
Type      : PSCredential
VaultName : 1Password: Test
Metadata  : {[id, 9gj4jl36jjsdosjfoj08], [created_at, 2025-02-13 9:05:02 AM], [updated_at, 2025-02-14 4:10:11 PM], [version, 2], [additional_information, user@domain.com], [urls, {@{label=website; primary=True; href=website.com}}]}

In my instance additional_information always seems to have the username. I decided to use this key name as provided by the os command as I'm uncertain if this can provide other info at times. I could not find anything on this in their documentation.

@cdhunt cdhunt self-assigned this Feb 19, 2025
@cdhunt cdhunt added the enhancement New feature or request label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants