Add fields to existing items / link documents?

dschneller
dschneller
Community Member

I am using 1P to store OpenSSL private keys and some accompanying documentation.

A script will generate a new key, create a CSR based on it and an OpenSSL config and some documentation files. All those are put into an encrypted ZIP file with a randomly generated password.
My automation currently stops there. I then upload the file as a new document into 1P, add a "ZIP Password" field via the GUI, and copy/paste the random password from my terminal output into it.

Playing with the CLI I already managed to auto-upload the file as a new document.
However, unless I am missing something, there is currently no way to either add the password field to the document during creation, now afterwards. I then thought, I might create an additional password entry and associate that with the document, but I couldn't figure that one out, either.

Any pointers?


1Password Version: 6.8.2
Extension Version: Not Provided
OS Version: macOS 10.12
Sync Type: Not Provided

Comments

  • cohix
    cohix
    1Password Alumni

    @dschneller Wow that's awesome! I'd love if this could be documented in a blog post/GitHub repo somewhere, I'd love to see how you did it.

    You're right, at the current time there is no way to add extra fields to new documents using the CLI, it's a use-case I personally hadn't even thought of when creating a document. At some point (once we've figured out a sensible way to do item editing), you'll be able to add that field programmatically, but until then there's no real way to do it.

    One workaround I can think of is this:

    1. Create the document item, save the UUID
    2. Create a password item with the ZIP password, and put the document item's UUID in the notesPlain field (or a custom field you create)
    3. When accessing it, request the password item, parse the UUID from the notes, use that to download the document and decrypt it with the password

    Just an idea, let me know if it works, or even come up with something better!

  • dschneller
    dschneller
    Community Member

    @cohix Thanks for the reply. Is there a field I could populate to create the link between the password entry and the ZIP document as an association? As of now, I am the only one on the Team using the CLI -- the rest of the team needs to be able to work with the UI. They wouldn't gain anything from a UUID in a text field.

  • @dschneller : yea you can you use a reference field/sectoin for that. We really need public facing documentation for this stuff.

    Here's an example field:

    {
    "k":"reference",
    "n":"3C74E61B4FD24327ABF86191582AD2C7",
    "v":"abv6cp6mzvgx3omgzooog2smoq",
    "t":"Screen Shot"
    }
    
    • k : must be reference
    • n : must be a unique identifier. For example generate a new UUID and remove the dashes and you get something that looks like my example
    • v : the UUID of the item you're referencing. It must be within the same vault
    • t : the title, what appears on the left hand side when shown in the UI

    Please put this reference field within a section with title "Related Items" and name "linked items", as the apps make some assumptions about where these live.

    Put together here's an example section:

    {"title":"Related Items","name":"linked items",
    "fields":[{"k":"reference","n":"3C74E61B4FD24327ABF86191582AD2C7","v":"abv6cp6mzvgx3omgzooog2smoq","t":"Screen Shot 2016-09-28 at 12.12.07 PM.png"}]
    }
    

    I hope this helps.

    Rick

This discussion has been closed.