@1password/sdk 0.1.0-beta.7 → 0.1.0-beta.9
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/dist/configuration.js +1 -1
- package/package.json +3 -5
- package/README.md +0 -92
package/dist/configuration.js
CHANGED
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.getOsName = exports.clientAuthConfig = void 0;
|
|
27
27
|
const os = __importStar(require("os"));
|
|
28
28
|
const LANGUAGE = "JS";
|
|
29
|
-
const VERSION = "
|
|
29
|
+
const VERSION = "0010009"; // v0.1.0-beta.9
|
|
30
30
|
/**
|
|
31
31
|
* Creates a default client configuration.
|
|
32
32
|
* @returns The client configuration to instantiate the client with.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1password/sdk",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.9",
|
|
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",
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"author": "1Password",
|
|
16
16
|
"license": "MIT",
|
|
17
|
-
"files": [
|
|
18
|
-
"./dist"
|
|
19
|
-
],
|
|
17
|
+
"files": ["./dist"],
|
|
20
18
|
"exports": {
|
|
21
19
|
".": {
|
|
22
20
|
"types": "./dist/sdk.d.ts",
|
|
@@ -26,7 +24,7 @@
|
|
|
26
24
|
"main": "./dist/sdk.js",
|
|
27
25
|
"types": "./dist/sdk.d.ts",
|
|
28
26
|
"dependencies": {
|
|
29
|
-
"@1password/sdk-core": "0.1.0-beta.
|
|
27
|
+
"@1password/sdk-core": "0.1.0-beta.9"
|
|
30
28
|
},
|
|
31
29
|
"devDependencies": {
|
|
32
30
|
"@1password/eslint-config": "^4.0.0",
|
package/README.md
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<a href="https://1password.com">
|
|
3
|
-
<h1 align="center">1Password JavaScript SDK (beta)</h1>
|
|
4
|
-
</a>
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
<h4 align="center"> ❗ The 1Password SDK project is in beta. Future iterations may bring backwards-incompatible changes.</h4>
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
|
-
<p align="center">
|
|
12
|
-
<a href="https://developer.1password.com/docs/sdks/">Documentation</a> | <a href="https://github.com/1Password/onepassword-sdk-js/tree/main/examples">Examples</a>
|
|
13
|
-
<br/>
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
The 1Password JavaScript SDK offers programmatic access to your secrets in 1Password with JavaScript. The SDK currently supports `Node.js`. During the beta, you can create, retrieve, update, and delete items and resolve secret references.
|
|
18
|
-
|
|
19
|
-
## 🔑 Authentication
|
|
20
|
-
|
|
21
|
-
1Password SDKs support authentication with [1Password Service Accounts](https://developer.1password.com/docs/service-accounts/get-started/).
|
|
22
|
-
|
|
23
|
-
Before you get started, [create a service account](https://developer.1password.com/docs/service-accounts/get-started/#create-a-service-account) and give it the appropriate permissions in the vaults where the items you want to use with the SDK are saved.
|
|
24
|
-
|
|
25
|
-
## ❗ Limitations
|
|
26
|
-
|
|
27
|
-
1Password SDKs don't yet support using secret references with query parameters, so you can't retrieve file attachments or SSH keys, or get more information about field metadata.
|
|
28
|
-
|
|
29
|
-
1Password SDKs currently only support operations on text and concealed fields. As a result, you can't edit items that include information saved in other types of fields.
|
|
30
|
-
|
|
31
|
-
When managing items with 1Password SDKs, you must use [unique identifiers (IDs)](https://developer.1password.com/docs/sdks/concepts#unique-identifiers) in place of vault, item, and field names.
|
|
32
|
-
|
|
33
|
-
## 🚀 Get started
|
|
34
|
-
|
|
35
|
-
To use the 1Password JavaScript SDK in your project:
|
|
36
|
-
|
|
37
|
-
1. Provision your [service account](#authentication) token. We recommend provisioning your token from the environment. For example, to export your token to the `OP_SERVICE_ACCOUNT_TOKEN` environment variable:
|
|
38
|
-
|
|
39
|
-
**macOS or Linux**
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
export OP_SERVICE_ACCOUNT_TOKEN=<your-service-account-token>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
**Windows**
|
|
46
|
-
|
|
47
|
-
```powershell
|
|
48
|
-
$Env:OP_SERVICE_ACCOUNT_TOKEN = "<your-service-account-token>"
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
2. Install the 1Password JavaScript SDK in your project:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
## NPM
|
|
55
|
-
npm install @1password/sdk@beta
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
## PNPM
|
|
60
|
-
pnpm add @1password/sdk@beta
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
## Yarn
|
|
65
|
-
yarn add @1password/sdk@beta
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
3. Use the JavaScript SDK in your project:
|
|
69
|
-
|
|
70
|
-
```js
|
|
71
|
-
import { createClient } from "@1password/sdk";
|
|
72
|
-
|
|
73
|
-
// Creates an authenticated client.
|
|
74
|
-
const client = await createClient({
|
|
75
|
-
auth: process.env.OP_SERVICE_ACCOUNT_TOKEN,
|
|
76
|
-
integrationName: "My 1Password Integration",
|
|
77
|
-
integrationVersion: "v1.0.0",
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// Fetches a secret.
|
|
81
|
-
const secret = await client.secrets.resolve("op://vault/item/field");
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Make sure to use [secret reference URIs](https://developer.1password.com/docs/cli/secrets-reference-syntax/) with the syntax `op://vault/item/field` to securely load secrets from 1Password into your code.
|
|
85
|
-
|
|
86
|
-
Inside `createClient()`, set `integrationName` to the name of your application and `integrationVersion` to the version of your application.
|
|
87
|
-
|
|
88
|
-
## 📖 Learn more
|
|
89
|
-
|
|
90
|
-
- [Load secrets with 1Password SDKs](https://developer.1password.com/docs/sdks/load-secrets)
|
|
91
|
-
- [Manage items with 1Password SDKs](https://developer.1password.com/docs/sdks/manage-items)
|
|
92
|
-
- [1Password SDK concepts](https://developer.1password.com/docs/sdks/concepts)
|