@1password/sdk 0.4.1-beta.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -27
- package/dist/configuration.d.ts +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<h4 align="center">Build integrations that programmatically
|
|
8
|
+
<h4 align="center">Build integrations that programmatically interact with 1Password.</h4>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
@@ -16,7 +16,62 @@
|
|
|
16
16
|
|
|
17
17
|
## 🚀 Get started
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
You can choose between two [authentication methods](https://developer.1password.com/docs/sdks/concepts#authentication) for the 1Password JavaScript SDK: local authorization prompts from the [1Password desktop app](#option-1-1password-desktop-app) or automated authentication with a [1Password Service Account](#option-2-1password-service-account).
|
|
20
|
+
|
|
21
|
+
*This project is licensed under [MIT](./LICENSE). Use of the 1Password APIs and services accessed through these tools is governed by the [1Password API Terms of Service](https://1password.com/legal/api-sdk-terms-of-service).*
|
|
22
|
+
|
|
23
|
+
### Option 1: 1Password desktop app
|
|
24
|
+
|
|
25
|
+
[1Password desktop app authentication](https://developer.1password.com/docs/sdks/concepts#1password-desktop-app) is best for local integrations that require minimal setup from end users and sensitive workflows that require human-in-the-loop approval.
|
|
26
|
+
|
|
27
|
+
1. Install the [1Password desktop app](https://1password.com/downloads/) and sign in to your account in the app.
|
|
28
|
+
2. Select your account or collection at the top of the sidebar, then navigate to **Settings** > **Developer**.
|
|
29
|
+
3. Under Integrate with the 1Password SDKs, select **Integrate with other apps**.
|
|
30
|
+
4. If you want to authenticate with biometrics, navigate to **Settings** > **Security**, then turn on the option to unlock using [Touch ID](https://support.1password.com/touch-id-mac/), [Windows Hello](https://support.1password.com/windows-hello/), or [system authentication](https://support.1password.com/system-authentication-linux/).
|
|
31
|
+
5. Install the 1Password JavaScript SDK in your project:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
## NPM
|
|
35
|
+
npm install @1password/sdk
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
## PNPM
|
|
40
|
+
pnpm add @1password/sdk
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
## Yarn
|
|
45
|
+
yarn add @1password/sdk
|
|
46
|
+
|
|
47
|
+
6. To use the Javascript SDK in your project, replace `your-account-name` in the code below with the name of your 1Password account as it appears at the top left sidebar of the 1Password desktop app.
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
const sdk = require("@1password/sdk");
|
|
51
|
+
|
|
52
|
+
async function main() {
|
|
53
|
+
// Creates an authenticated client.
|
|
54
|
+
const client = await sdk.createClient({
|
|
55
|
+
auth: new sdk.DesktopAuth("your-account-name"),
|
|
56
|
+
// Set the following to your own integration name and version.
|
|
57
|
+
integrationName: "My 1Password Integration",
|
|
58
|
+
integrationVersion: "v1.0.0",
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Fetches a secret.
|
|
62
|
+
const secret = await client.secrets.resolve("op://vault/item/field");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
main()
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Inside `createClient()`, set `integrationName` to the name of your application and `integrationVersion` to the version of your application.
|
|
69
|
+
|
|
70
|
+
Make sure to use [secret reference URIs](https://developer.1password.com/docs/cli/secret-reference-syntax/) with the syntax `op://vault/item/field` to securely load secrets from 1Password into your code.
|
|
71
|
+
|
|
72
|
+
### Option 2: 1Password Service Account
|
|
73
|
+
|
|
74
|
+
[Service account authentication](https://developer.1password.com/docs/sdks/concepts/#1password-service-account) is best for automated access and limiting your integration to least privilege access.
|
|
20
75
|
|
|
21
76
|
1. [Create a service account](https://my.1password.com/developer-tools/infrastructure-secrets/serviceaccount/?source=github-sdk) and give it the appropriate permissions in the vaults where the items you want to use with the SDK are saved.
|
|
22
77
|
2. Provision your service account token. We recommend provisioning your token from the environment. For example, to export your token to the `OP_SERVICE_ACCOUNT_TOKEN` environment variable:
|
|
@@ -53,18 +108,22 @@ To use the 1Password JavaScript SDK in your project:
|
|
|
53
108
|
4. Use the JavaScript SDK in your project:
|
|
54
109
|
|
|
55
110
|
```js
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
111
|
+
const sdk = require("@1password/sdk");
|
|
112
|
+
|
|
113
|
+
async function main() {
|
|
114
|
+
// Creates an authenticated client.
|
|
115
|
+
const client = await sdk.createClient({
|
|
116
|
+
auth: process.env.OP_SERVICE_ACCOUNT_TOKEN,
|
|
117
|
+
// Set the following to your own integration name and version.
|
|
118
|
+
integrationName: "My 1Password Integration",
|
|
119
|
+
integrationVersion: "v1.0.0",
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Fetches a secret.
|
|
123
|
+
const secret = await client.secrets.resolve("op://vault/item/field");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
main()
|
|
68
127
|
```
|
|
69
128
|
|
|
70
129
|
Make sure to use [secret reference URIs](https://developer.1password.com/docs/cli/secret-reference-syntax/) with the syntax `op://vault/item/field` to securely load secrets from 1Password into your code.
|
|
@@ -77,9 +136,10 @@ Inside `createClient()`, set `integrationName` to the name of your application a
|
|
|
77
136
|
|
|
78
137
|
### Item management
|
|
79
138
|
|
|
80
|
-
Operations
|
|
139
|
+
**Operations:**
|
|
81
140
|
|
|
82
141
|
- [x] [Retrieve secrets](https://developer.1password.com/docs/sdks/load-secrets)
|
|
142
|
+
- [Read 1Password Environments (beta)](https://developer.1password.com/docs/sdks/environments)
|
|
83
143
|
- [x] [Retrieve items](https://developer.1password.com/docs/sdks/manage-items#get-an-item)
|
|
84
144
|
- [x] [Create items](https://developer.1password.com/docs/sdks/manage-items#create-an-item)
|
|
85
145
|
- [x] [Update items](https://developer.1password.com/docs/sdks/manage-items#update-an-item)
|
|
@@ -89,7 +149,8 @@ Operations:
|
|
|
89
149
|
- [x] [Share items](https://developer.1password.com/docs/sdks/share-items)
|
|
90
150
|
- [x] [Generate PIN, random and memorable passwords](https://developer.1password.com/docs/sdks/manage-items#generate-a-password)
|
|
91
151
|
|
|
92
|
-
Field types
|
|
152
|
+
**Field types:**
|
|
153
|
+
|
|
93
154
|
- [x] API Keys
|
|
94
155
|
- [x] Passwords
|
|
95
156
|
- [x] Concealed fields
|
|
@@ -112,35 +173,50 @@ Field types:
|
|
|
112
173
|
- [ ] Passkeys
|
|
113
174
|
|
|
114
175
|
### Vault management
|
|
115
|
-
|
|
116
|
-
- [
|
|
117
|
-
- [
|
|
118
|
-
- [
|
|
119
|
-
- [x] [
|
|
176
|
+
|
|
177
|
+
- [x] [Retrieve vaults](https://developer.1password.com/docs/sdks/vaults#get-a-vault-overview)
|
|
178
|
+
- [x] [Create vaults](https://developer.1password.com/docs/sdks/vaults#create-a-vault)
|
|
179
|
+
- [x] [Update vaults](https://developer.1password.com/docs/sdks/vaults#update-a-vault)
|
|
180
|
+
- [x] [Delete vaults](https://developer.1password.com/docs/sdks/vaults#delete-a-vault)
|
|
181
|
+
- [x] [List vaults](https://developer.1password.com/docs/sdks/list-vaults-items#list-vaults)
|
|
182
|
+
- [x] [Manage group vault permissions](https://developer.1password.com/docs/sdks/vault-permissions)
|
|
183
|
+
- [ ] Manage user vault permissions
|
|
120
184
|
|
|
121
185
|
### User & access management
|
|
186
|
+
|
|
122
187
|
- [ ] Provision users
|
|
123
188
|
- [ ] Retrieve users
|
|
124
189
|
- [ ] List users
|
|
125
190
|
- [ ] Suspend users
|
|
191
|
+
- [x] [Retrieve groups](https://developer.1password.com/docs/sdks/groups/)
|
|
192
|
+
- [ ] List groups
|
|
126
193
|
- [ ] Create groups
|
|
127
194
|
- [ ] Update group membership
|
|
128
|
-
|
|
195
|
+
|
|
196
|
+
## Environments management
|
|
197
|
+
|
|
198
|
+
- [x] [Read 1Password Environments](/docs/sdks/environments) (beta)
|
|
129
199
|
|
|
130
200
|
### Compliance & reporting
|
|
201
|
+
|
|
131
202
|
- [ ] Watchtower insights
|
|
132
203
|
- [ ] Travel mode
|
|
133
204
|
- [ ] Events. For now, use [1Password Events Reporting API](https://developer.1password.com/docs/events-api/) directly.
|
|
134
205
|
|
|
135
206
|
### Authentication
|
|
136
207
|
|
|
137
|
-
- [x] [1Password Service Accounts](https://developer.1password.com/docs/service-
|
|
138
|
-
- [
|
|
208
|
+
- [x] [1Password Service Accounts](https://developer.1password.com/docs/sdks/concepts#1password-service-account)
|
|
209
|
+
- [x] [User authentication](https://developer.1password.com/docs/sdks/concepts#1password-desktop-app)
|
|
139
210
|
- [ ] 1Password Connect. For now, use [1Password/connect-sdk-js](https://github.com/1Password/connect-sdk-js).
|
|
140
211
|
|
|
141
212
|
## 📖 Learn more
|
|
142
213
|
|
|
143
|
-
- [Load secrets
|
|
144
|
-
- [Manage items
|
|
145
|
-
- [
|
|
214
|
+
- [Load secrets](https://developer.1password.com/docs/sdks/load-secrets)
|
|
215
|
+
- [Manage items](https://developer.1password.com/docs/sdks/manage-items)
|
|
216
|
+
- [Manage files](https://developer.1password.com/docs/sdks/files)
|
|
217
|
+
- [Share items](https://developer.1password.com/docs/sdks/share-items)
|
|
218
|
+
- [List vaults and items](https://developer.1password.com/docs/sdks/list-vaults-items)
|
|
219
|
+
- [Manage vaults](https://developer.1password.com/docs/sdks/vaults)
|
|
220
|
+
- [Manage vault permissions](https://developer.1password.com/docs/sdks/vault-permissions)
|
|
221
|
+
- [Manage groups](https://developer.1password.com/docs/sdks/groups)
|
|
146
222
|
- [1Password SDK concepts](https://developer.1password.com/docs/sdks/concepts)
|
package/dist/configuration.d.ts
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.4.1
|
|
2
|
-
export declare const SDK_BUILD_NUMBER = "
|
|
1
|
+
export declare const SDK_VERSION = "0.4.1";
|
|
2
|
+
export declare const SDK_BUILD_NUMBER = "0040102";
|
package/dist/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SDK_BUILD_NUMBER = exports.SDK_VERSION = void 0;
|
|
4
|
-
exports.SDK_VERSION = "0.4.1
|
|
5
|
-
exports.SDK_BUILD_NUMBER = "
|
|
6
|
-
const SDK_CORE_VERSION = "0.4.1
|
|
4
|
+
exports.SDK_VERSION = "0.4.1";
|
|
5
|
+
exports.SDK_BUILD_NUMBER = "0040102";
|
|
6
|
+
const SDK_CORE_VERSION = "0.4.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1password/sdk",
|
|
3
|
-
"version": "0.4.1
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "The 1Password JavaScript SDK offers programmatic read access to your secrets in 1Password in an interface native to JavaScript. The SDK currently supports `Node.JS`",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"main": "./dist/sdk.js",
|
|
27
27
|
"types": "./dist/sdk.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@1password/sdk-core": "0.4.1
|
|
29
|
+
"@1password/sdk-core": "0.4.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@1password/eslint-config": "^4.0.0",
|