Custom Template Encoding?

tkeeler
tkeeler
Community Member

I'm using the op tool to get a custom template and the json response appears to be encoded. Is this expected, and if so what is the best way to decode it? Here's an example:

> op get template MyTemplate
{"notesPlain":"","passwordHistory":[],"sections":[{"fields":[{"k":"string","n":"ajo2aydubilfut22zujmyxjkcy","t":"","v":""}],"name":"gtm3wc6jvivxa6r6q3mbvdbeni","title":""}]}

This does not appear to be the case for the built-in templates:

> op get template login
{"fields":[{"designation":"username","name":"username","type":"T","value":""},{"designation":"password","name":"password","type":"P","value":""}],"notesPlain":"","passwordHistory":[],"sections":[]}


1Password Version: 1.8.0
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided

Comments

  • ag_yaron
    ag_yaron
    1Password Alumni

    Hey @tkeeler ,

    Perhaps you'll find this post helpful: https://1password.community/discussion/comment/588416/#Comment_588416
    As you can see from the example command there, you do need to tell the CLI to encode the items.

    Let me know if that helped.

  • tkeeler
    tkeeler
    Community Member

    Thanks, I did come across this when I was originally searching for an answer. It doesn't directly help, but it does help me understand the key/value structure a bit more.

    I believe the issue is creating a custom template on the 1Password site. It appears the n value gets set to a random ID and the t value doesn't get set properly. In my template the field name is set to 'Testing' but it doesn't appear in my op get template MyTemplate response. I'm assuming this is a bug?

    Is there another method to create a template?

  • ag_yaron
    ag_yaron
    1Password Alumni

    Hey @tkeeler ,
    Sorry for the delay, we’re looking into this.

    There does seem to be some difference in the frontend UI templates that the CLI doesn’t know/expect.

    I’ll let you know as soon as I have more info.

  • ag_yaron
    ag_yaron
    1Password Alumni
    edited February 2021

    Hey @tkeeler ,
    We found the issue, it is definitely on our side.

    We have filed it internally so our developers can fix this in a future update.

    Thank you for reporting this!

    ref: dev/b5/b5#10890

  • tkeeler
    tkeeler
    Community Member

    Thank you for the follow-up!

  • ag_yaron
    ag_yaron
    1Password Alumni

    No problem :+1:

This discussion has been closed.