node-keytar
node-keytar copied to clipboard
Error with setPassword: The specified item already exists in the keychain.
Hi
I am on node-keytar 4.2.1. Every so often, when I call setPassword, keytar sends back the following exception:
The specified item already exists in the keychain.
According to the docs I was expecting this function to update an existing item, or create a new keychain item if one doesn't exist. Is this the correct assumption? If so any ideas why I might be seeing this error.
Happens on some calls to setPassword, but on other calls it doesn't.
@adeperio which OS are you testing on?
I've seen reports of this as well, on macOS 10.14.6. Is there any data I can collect to help diagnose the problem?
Actually, I think I now understand what is happening in my case! I have several different processes that are reading and writing to the same keychain item. If writes occur pretty much simultaneously, then one will throw the duplicate item error during the second AddPassword here:
https://github.com/atom/node-keytar/blob/3c232b5f58f84b590ecf068a5251bbe268739e15/src/keytar_mac.cc#L81-L99