
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@1password/save-button
Advanced tools
npm install @1password/save-button --save-dev
yarn add @1password/save-button -D
The "Save in 1Password" button allows users to save an item to 1Password from a website. The data is provided by the site in a known format, so users can get information into 1Password safely, quickly and accurately, without filling out forms or relying on autosave.
Depending on the type of data you have, this could either be a traditional 1Password item (Login, Credit Card, Identity, etc) or an API key. For example, the 1Password Privacy.com integration integration uses this mechanism to save an API key to enable the integration.
Build a 1Password Save Request of the information you would like to save to 1Password. Convert this into a Base64-encoded JSON string.
Import the onepassword-save-button
component into your HTML file.
Add a onepassword-save-button
button element to your page. The button is disabled by default.
Add the required attributes data-onepassword-type
and value
attributes to your onepassword-save-button
element:
data-onepassword-type
: The type of item to be saved. It must be one of these values:
credit-card
login
identity
value
: The Base64-encoded JSON string containing a 1Password Save Request you created in step 1.(Optional) Add an optional lang
attribute, the locale code for desired localization. Currently we support the languages and locale codes below. If no lang
attribute is provided, this package tries to determine the user's browser language using the NavigatorLanguage Web API. If no lang
attribute is provided and the detected browser language is not in the supported list, the package will default to English.
The 1Password extension will automatically check for the button on page load. When the button is found, its disabled
attribute will be removed.
Subsequent checks, useful for single page apps, can be triggered by dispatching a CustomEvent on the document with type OPButtonAdded
.
The Save Request contains the data to be saved, including field values and metadata.
SaveRequest
title (string)
: The suggested title for the item to be savedfields (SaveRequestField[])
: An array of fields to be saved to the item.notes (string)
: (optional) Notes which will be saved on the item. These can be formatted with Markdown.SaveRequestField
autocomplete (string)
: How the field should be filled. Allowed values are defined in the "Autofill" section of the HTML Living Standard.value (string)
: The value to be saved for the field. Should use the canonical format for the autocomplete type as given in the above spec.Page:
<script type="module">
import "@1password/save-button/index.js";
</script>
...
<onepassword-save-button
lang="en"
data-onepassword-type="credit-card"
value="ewoJInRpdGxlIjogIkFDTUUgQ3JlZGl0IENhcmQiLAoJImZpZWxkcyI6IFsKCQl7CgkJCSJhdXRvY29tcGxldGUiOiAiY2MtbmFtZSIsCgkJCSJ2YWx1ZSI6ICJXZW5keSBKLiBBcHBsZXNlZWQiCgkJfSwKCQl7CgkJCSJhdXRvY29tcGxldGUiOiAiY2MtbnVtYmVyIiwKCQkJInZhbHVlIjogIjQxMTExMTExMTExMTExMTEiCgkJfSwKCQl7CgkJCSJhdXRvY29tcGxldGUiOiAiY2MtZXhwIiwKCQkJInZhbHVlIjogIjIwMjUxMiIKCQl9LAoJCXsKCQkJImF1dG9jb21wbGV0ZSI6ICJjYy1jc2MiLAoJCQkidmFsdWUiOiAiMTIzIgoJCX0KCV0sCgkibm90ZXMiOiAiQWRkaXRpb25hbCBub3RlcyBjYW4gYmUgYWRkZWQgaW4gbWFya2Rvd24gb3IgcGxhaW50ZXh0LiIKfQ=="
>
</onepassword-save-button>
Save Request:
{
"title": "ACME Credit Card",
"fields": [
{
"autocomplete": "cc-name",
"value": "Wendy J. Appleseed"
},
{
"autocomplete": "cc-number",
"value": "4111111111111111"
},
{
"autocomplete": "cc-exp",
"value": "202512"
},
{
"autocomplete": "cc-csc",
"value": "123"
},
{
"autocomplete": "cc-type",
"value": "visa"
},
{
"autocomplete": "street-address",
"value": "512 Main Street"
},
{
"autocomplete": "address-level2",
"value": "Cambridge"
},
{
"autocomplete": "address-level1",
"value": "MA"
},
{
"autocomplete": "postal-code",
"value": "12345"
},
{
"autocomplete": "country",
"value": "US"
}
],
"notes": "Notes can be markdown or plaintext!"
}
The "Save in 1Password" button is designed to respect the security and privacy of users:
Currently, 1Password implements an allowlist of domains which can use the "Save in 1Password" feature. Additionally, we have code which determines if any particular domain should use integration specific UI. To request that your site be added to the list or for more information about the Save in 1Password button, contact the 1Password Partnerships team at support+partnerships@1password.com.
FAQs
Save to 1Password button
The npm package @1password/save-button receives a total of 14,184 weekly downloads. As such, @1password/save-button popularity was classified as popular.
We found that @1password/save-button demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.