@1password/sdk 0.1.2 → 0.1.4
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 +1 -1
- package/dist/configuration.d.ts +1 -1
- package/dist/core.d.ts +6 -1
- package/dist/core.js +4 -0
- package/dist/items.d.ts +1 -1
- package/dist/iterator.js +1 -1
- package/dist/secrets.d.ts +4 -0
- package/dist/secrets.js +18 -0
- package/dist/types.d.ts +32 -0
- package/dist/types.js +17 -2
- package/dist/version.d.ts +2 -2
- package/dist/version.js +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ Field types:
|
|
|
97
97
|
- [ ] SSH public keys, fingerprint and key type
|
|
98
98
|
- [x] One-time passwords
|
|
99
99
|
- [x] URLs
|
|
100
|
-
- [
|
|
100
|
+
- [x] Websites (used to suggest and autofill logins)
|
|
101
101
|
- [x] Phone numbers
|
|
102
102
|
- [x] Credit card types
|
|
103
103
|
- [ ] File attachments and Document items
|
package/dist/configuration.d.ts
CHANGED
package/dist/core.d.ts
CHANGED
|
@@ -7,9 +7,13 @@ export interface Core {
|
|
|
7
7
|
*/
|
|
8
8
|
initClient(config: ClientAuthConfig): Promise<string>;
|
|
9
9
|
/**
|
|
10
|
-
* Calls business logic from a given client and returns the result.
|
|
10
|
+
* Calls async business logic from a given client and returns the result.
|
|
11
11
|
*/
|
|
12
12
|
invoke(config: InvokeConfig): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Calls sync business logic from a given client and returns the result.
|
|
15
|
+
*/
|
|
16
|
+
invoke_sync(config: InvokeConfig): string;
|
|
13
17
|
/**
|
|
14
18
|
* Deallocates memory held by the given client in the SDK core when it goes out of scope.
|
|
15
19
|
*/
|
|
@@ -65,6 +69,7 @@ export interface Parameters {
|
|
|
65
69
|
* An implementation of the `Core` interface that shares resources across all clients.
|
|
66
70
|
*/
|
|
67
71
|
export declare class SharedCore implements Core {
|
|
72
|
+
invoke_sync(config: InvokeConfig): string;
|
|
68
73
|
initClient(config: ClientAuthConfig): Promise<string>;
|
|
69
74
|
invoke(config: InvokeConfig): Promise<string>;
|
|
70
75
|
releaseClient(clientId: number): void;
|
package/dist/core.js
CHANGED
|
@@ -15,6 +15,10 @@ const sdk_core_1 = require("@1password/sdk-core");
|
|
|
15
15
|
* An implementation of the `Core` interface that shares resources across all clients.
|
|
16
16
|
*/
|
|
17
17
|
class SharedCore {
|
|
18
|
+
invoke_sync(config) {
|
|
19
|
+
const serializedConfig = JSON.stringify(config);
|
|
20
|
+
return (0, sdk_core_1.invoke_sync)(serializedConfig);
|
|
21
|
+
}
|
|
18
22
|
initClient(config) {
|
|
19
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
24
|
const serializedConfig = JSON.stringify(config);
|
package/dist/items.d.ts
CHANGED
package/dist/iterator.js
CHANGED
|
@@ -3,7 +3,7 @@ var __await = (this && this.__await) || function (v) { return this instanceof __
|
|
|
3
3
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
4
4
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
5
5
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
6
|
-
return i =
|
|
6
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
7
7
|
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
8
8
|
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
9
9
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
package/dist/secrets.d.ts
CHANGED
|
@@ -16,4 +16,8 @@ export declare class Secrets implements SecretsApi {
|
|
|
16
16
|
* Resolve returns the secret the provided secret reference points to.
|
|
17
17
|
*/
|
|
18
18
|
resolve(secretReference: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Validate the secret reference to ensure there are no syntax errors.
|
|
21
|
+
*/
|
|
22
|
+
static validateSecretReference(secretReference: string): void;
|
|
19
23
|
}
|
package/dist/secrets.js
CHANGED
|
@@ -23,6 +23,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
23
23
|
var _Secrets_inner;
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.Secrets = void 0;
|
|
26
|
+
const core_js_1 = require("./core.js");
|
|
26
27
|
class Secrets {
|
|
27
28
|
constructor(inner) {
|
|
28
29
|
_Secrets_inner.set(this, void 0);
|
|
@@ -47,6 +48,23 @@ class Secrets {
|
|
|
47
48
|
return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").core.invoke(invocationConfig));
|
|
48
49
|
});
|
|
49
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Validate the secret reference to ensure there are no syntax errors.
|
|
53
|
+
*/
|
|
54
|
+
static validateSecretReference(secretReference) {
|
|
55
|
+
const sharedCore = new core_js_1.SharedCore();
|
|
56
|
+
const invocationConfig = {
|
|
57
|
+
invocation: {
|
|
58
|
+
parameters: {
|
|
59
|
+
name: "ValidateSecretReference",
|
|
60
|
+
parameters: {
|
|
61
|
+
secret_reference: secretReference,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
sharedCore.invoke_sync(invocationConfig);
|
|
67
|
+
}
|
|
50
68
|
}
|
|
51
69
|
exports.Secrets = Secrets;
|
|
52
70
|
_Secrets_inner = new WeakMap();
|
package/dist/types.d.ts
CHANGED
|
@@ -62,6 +62,32 @@ export interface ItemSection {
|
|
|
62
62
|
/** The section's title */
|
|
63
63
|
title: string;
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Controls the auto-fill behavior of a website.
|
|
67
|
+
*
|
|
68
|
+
*
|
|
69
|
+
* For more information, visit https://support.1password.com/autofill-behavior/
|
|
70
|
+
*/
|
|
71
|
+
export declare enum AutofillBehavior {
|
|
72
|
+
/** Auto-fill any page that’s part of the website, including subdomains */
|
|
73
|
+
AnywhereOnWebsite = "AnywhereOnWebsite",
|
|
74
|
+
/** Auto-fill only if the domain (hostname and port) is an exact match. */
|
|
75
|
+
ExactDomain = "ExactDomain",
|
|
76
|
+
/** Never auto-fill on this website */
|
|
77
|
+
Never = "Never"
|
|
78
|
+
}
|
|
79
|
+
export interface Website {
|
|
80
|
+
/** The website URL */
|
|
81
|
+
url: string;
|
|
82
|
+
/** The label of the website, e.g. 'website', 'sign-in address' */
|
|
83
|
+
label: string;
|
|
84
|
+
/**
|
|
85
|
+
* The auto-fill behavior of the website
|
|
86
|
+
*
|
|
87
|
+
* For more information, visit https://support.1password.com/autofill-behavior/
|
|
88
|
+
*/
|
|
89
|
+
autofillBehavior: AutofillBehavior;
|
|
90
|
+
}
|
|
65
91
|
/** Represents a 1Password item. */
|
|
66
92
|
export interface Item {
|
|
67
93
|
/** The item's ID */
|
|
@@ -78,6 +104,8 @@ export interface Item {
|
|
|
78
104
|
sections: ItemSection[];
|
|
79
105
|
/** The item's tags */
|
|
80
106
|
tags: string[];
|
|
107
|
+
/** The websites used for autofilling for items of the Login and Password categories. */
|
|
108
|
+
websites: Website[];
|
|
81
109
|
/** The item's version */
|
|
82
110
|
version: number;
|
|
83
111
|
}
|
|
@@ -94,6 +122,8 @@ export interface ItemCreateParams {
|
|
|
94
122
|
sections?: ItemSection[];
|
|
95
123
|
/** The item's tags */
|
|
96
124
|
tags?: string[];
|
|
125
|
+
/** The websites used for autofilling for items of the Login and Password categories. */
|
|
126
|
+
websites?: Website[];
|
|
97
127
|
}
|
|
98
128
|
/** Represents a decrypted 1Password item. */
|
|
99
129
|
export interface ItemOverview {
|
|
@@ -105,6 +135,8 @@ export interface ItemOverview {
|
|
|
105
135
|
category: ItemCategory;
|
|
106
136
|
/** The ID of the vault where the item is saved */
|
|
107
137
|
vaultId: string;
|
|
138
|
+
/** The websites used for autofilling for items of the Login and Password categories. */
|
|
139
|
+
websites: Website[];
|
|
108
140
|
}
|
|
109
141
|
/** Additional attributes for OTP fields. */
|
|
110
142
|
export interface OtpFieldDetails {
|
package/dist/types.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Generated by typeshare 1.
|
|
3
|
+
Generated by typeshare 1.12.0
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ItemFieldType = exports.ItemCategory = void 0;
|
|
6
|
+
exports.AutofillBehavior = exports.ItemFieldType = exports.ItemCategory = void 0;
|
|
7
7
|
var ItemCategory;
|
|
8
8
|
(function (ItemCategory) {
|
|
9
9
|
ItemCategory["Login"] = "Login";
|
|
@@ -41,3 +41,18 @@ var ItemFieldType;
|
|
|
41
41
|
ItemFieldType["Totp"] = "Totp";
|
|
42
42
|
ItemFieldType["Unsupported"] = "Unsupported";
|
|
43
43
|
})(ItemFieldType || (exports.ItemFieldType = ItemFieldType = {}));
|
|
44
|
+
/**
|
|
45
|
+
* Controls the auto-fill behavior of a website.
|
|
46
|
+
*
|
|
47
|
+
*
|
|
48
|
+
* For more information, visit https://support.1password.com/autofill-behavior/
|
|
49
|
+
*/
|
|
50
|
+
var AutofillBehavior;
|
|
51
|
+
(function (AutofillBehavior) {
|
|
52
|
+
/** Auto-fill any page that’s part of the website, including subdomains */
|
|
53
|
+
AutofillBehavior["AnywhereOnWebsite"] = "AnywhereOnWebsite";
|
|
54
|
+
/** Auto-fill only if the domain (hostname and port) is an exact match. */
|
|
55
|
+
AutofillBehavior["ExactDomain"] = "ExactDomain";
|
|
56
|
+
/** Never auto-fill on this website */
|
|
57
|
+
AutofillBehavior["Never"] = "Never";
|
|
58
|
+
})(AutofillBehavior || (exports.AutofillBehavior = AutofillBehavior = {}));
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
2
|
-
export declare const SDK_BUILD_NUMBER = "
|
|
1
|
+
export declare const SDK_VERSION = "0.1.4";
|
|
2
|
+
export declare const SDK_BUILD_NUMBER = "0010401";
|
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.1.
|
|
5
|
-
exports.SDK_BUILD_NUMBER = "
|
|
6
|
-
const SDK_CORE_VERSION = "0.1.
|
|
4
|
+
exports.SDK_VERSION = "0.1.4";
|
|
5
|
+
exports.SDK_BUILD_NUMBER = "0010401";
|
|
6
|
+
const SDK_CORE_VERSION = "0.1.4";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1password/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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.1.
|
|
29
|
+
"@1password/sdk-core": "0.1.4"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@1password/eslint-config": "^4.0.0",
|