@1password/sdk 0.3.1 → 0.4.0-beta.2
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 +2 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.js +2 -0
- package/dist/client_builder.d.ts +2 -2
- package/dist/client_builder.js +6 -4
- package/dist/configuration.d.ts +9 -2
- package/dist/configuration.js +20 -3
- package/dist/core.d.ts +19 -11
- package/dist/core.js +69 -20
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +10 -1
- package/dist/groups.d.ts +13 -0
- package/dist/groups.js +51 -0
- package/dist/items.d.ts +25 -1
- package/dist/items.js +66 -6
- package/dist/items_files.js +4 -4
- package/dist/items_shares.js +3 -3
- package/dist/sdk.d.ts +1 -0
- package/dist/sdk.js +3 -1
- package/dist/secrets.d.ts +1 -1
- package/dist/secrets.js +2 -2
- package/dist/shared_lib_core.d.ts +16 -0
- package/dist/shared_lib_core.js +177 -0
- package/dist/types.d.ts +212 -9
- package/dist/types.js +79 -2
- package/dist/vaults.d.ts +15 -5
- package/dist/vaults.js +89 -4
- package/dist/version.d.ts +2 -2
- package/dist/version.js +3 -3
- package/package.json +2 -2
package/dist/items_shares.js
CHANGED
|
@@ -46,7 +46,7 @@ class ItemsShares {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").
|
|
49
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -66,7 +66,7 @@ class ItemsShares {
|
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
68
|
};
|
|
69
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").
|
|
69
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
@@ -87,7 +87,7 @@ class ItemsShares {
|
|
|
87
87
|
},
|
|
88
88
|
},
|
|
89
89
|
};
|
|
90
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").
|
|
90
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { Secrets } from "./secrets.js";
|
|
|
6
6
|
export * from "./client.js";
|
|
7
7
|
export * from "./errors.js";
|
|
8
8
|
export * from "./types.js";
|
|
9
|
+
export { DesktopAuth } from "./configuration.js";
|
|
9
10
|
/**
|
|
10
11
|
* Creates a default 1Password SDK client.
|
|
11
12
|
* @returns The authenticated 1Password SDK client.
|
package/dist/sdk.js
CHANGED
|
@@ -24,7 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.createClient = exports.Secrets = exports.DEFAULT_INTEGRATION_VERSION = exports.DEFAULT_INTEGRATION_NAME = void 0;
|
|
27
|
+
exports.createClient = exports.DesktopAuth = exports.Secrets = exports.DEFAULT_INTEGRATION_VERSION = exports.DEFAULT_INTEGRATION_NAME = void 0;
|
|
28
28
|
const core_js_1 = require("./core.js");
|
|
29
29
|
const client_builder_js_1 = require("./client_builder.js");
|
|
30
30
|
exports.DEFAULT_INTEGRATION_NAME = "Unknown";
|
|
@@ -35,6 +35,8 @@ Object.defineProperty(exports, "Secrets", { enumerable: true, get: function () {
|
|
|
35
35
|
__exportStar(require("./client.js"), exports);
|
|
36
36
|
__exportStar(require("./errors.js"), exports);
|
|
37
37
|
__exportStar(require("./types.js"), exports);
|
|
38
|
+
var configuration_js_1 = require("./configuration.js");
|
|
39
|
+
Object.defineProperty(exports, "DesktopAuth", { enumerable: true, get: function () { return configuration_js_1.DesktopAuth; } });
|
|
38
40
|
/**
|
|
39
41
|
* Creates a default 1Password SDK client.
|
|
40
42
|
* @returns The authenticated 1Password SDK client.
|
package/dist/secrets.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { InnerClient } from "./core.js";
|
|
|
2
2
|
import { GeneratePasswordResponse, PasswordRecipe, ResolveAllResponse } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* The Secrets API includes all operations the SDK client can perform on secrets.
|
|
5
|
-
* Use secret reference URIs to securely load secrets from 1Password: op://<vault-name>/<item-name>[/<section-name>]/<field-name
|
|
5
|
+
* Use secret reference URIs to securely load secrets from 1Password: `op://<vault-name>/<item-name>[/<section-name>]/<field-name>`
|
|
6
6
|
*/
|
|
7
7
|
export interface SecretsApi {
|
|
8
8
|
/**
|
package/dist/secrets.js
CHANGED
|
@@ -46,7 +46,7 @@ class Secrets {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").
|
|
49
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -65,7 +65,7 @@ class Secrets {
|
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").
|
|
68
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Core } from "./core";
|
|
2
|
+
/**
|
|
3
|
+
* SharedLibCore: wrapper around the dynamically loaded shared library
|
|
4
|
+
*/
|
|
5
|
+
export declare class SharedLibCore implements Core {
|
|
6
|
+
private lib;
|
|
7
|
+
private acccountName;
|
|
8
|
+
constructor(accountName: string);
|
|
9
|
+
/**
|
|
10
|
+
* callSharedLibrary - send string to native function, receive string back.
|
|
11
|
+
*/
|
|
12
|
+
private callSharedLibrary;
|
|
13
|
+
initClient(config: string): Promise<string>;
|
|
14
|
+
invoke(invokeConfigBytes: string): Promise<string>;
|
|
15
|
+
releaseClient(clientId: string): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.SharedLibCore = void 0;
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const os = __importStar(require("os"));
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const errors_1 = require("./errors");
|
|
50
|
+
/**
|
|
51
|
+
* Find the 1Password shared lib path by asking an the wasm core synchronously.
|
|
52
|
+
*/
|
|
53
|
+
const find1PasswordLibPath = () => {
|
|
54
|
+
const platform = os.platform();
|
|
55
|
+
const appRoot = path.dirname(process.execPath);
|
|
56
|
+
let searchPaths = [];
|
|
57
|
+
// Define lists of possible locations for each platform.
|
|
58
|
+
switch (platform) {
|
|
59
|
+
case "darwin": // macOS
|
|
60
|
+
searchPaths = [
|
|
61
|
+
"/Applications/1Password.app/Contents/Frameworks/libop_sdk_ipc_client.dylib",
|
|
62
|
+
path.join(os.homedir(), "/Applications/1Password.app/Contents/Frameworks/libop_sdk_ipc_client.dylib"),
|
|
63
|
+
];
|
|
64
|
+
break;
|
|
65
|
+
case "linux": // Linux
|
|
66
|
+
searchPaths = [
|
|
67
|
+
"/usr/bin/1password/libop_sdk_ipc_client.so",
|
|
68
|
+
"/opt/1Password/libop_sdk_ipc_client.so",
|
|
69
|
+
"/snap/bin/1password/libop_sdk_ipc_client.so",
|
|
70
|
+
];
|
|
71
|
+
break;
|
|
72
|
+
case "win32": // Windows
|
|
73
|
+
searchPaths = [
|
|
74
|
+
path.join(os.homedir(), "/AppData/Local/1Password/op_sdk_ipc_client.dll"),
|
|
75
|
+
"C:/Program Files/1Password/app/8/op_sdk_ipc_client.dll",
|
|
76
|
+
"C:/Program Files (x86)/1Password/app/8/op_sdk_ipc_client.dll",
|
|
77
|
+
path.join(os.homedir(), "/AppData/Local/1Password/app/8/op_sdk_ipc_client.dll"),
|
|
78
|
+
];
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
82
|
+
}
|
|
83
|
+
// Iterate through the possible paths and return the first one that exists.
|
|
84
|
+
for (const addonPath of searchPaths) {
|
|
85
|
+
if (fs.existsSync(addonPath)) {
|
|
86
|
+
return addonPath;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// If the loop completes without finding the file, throw an error.
|
|
90
|
+
throw new Error("1Password desktop application not found");
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* SharedLibCore: wrapper around the dynamically loaded shared library
|
|
94
|
+
*/
|
|
95
|
+
class SharedLibCore {
|
|
96
|
+
constructor(accountName) {
|
|
97
|
+
this.lib = null;
|
|
98
|
+
try {
|
|
99
|
+
const libPath = find1PasswordLibPath();
|
|
100
|
+
const moduleStub = { exports: {} };
|
|
101
|
+
process.dlopen(moduleStub, libPath);
|
|
102
|
+
// Safely check the structure of the loaded module before casting.
|
|
103
|
+
if (typeof moduleStub === "object" &&
|
|
104
|
+
moduleStub !== null &&
|
|
105
|
+
typeof moduleStub.exports === "object" &&
|
|
106
|
+
moduleStub.exports !== null &&
|
|
107
|
+
"sendMessage" in moduleStub.exports &&
|
|
108
|
+
typeof moduleStub.exports.sendMessage ===
|
|
109
|
+
"function") {
|
|
110
|
+
this.lib = moduleStub.exports;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
throw new Error("Failed to initialize native library: sendMessage function not found on module.");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
console.error("A critical error occurred while loading the native addon:", e);
|
|
118
|
+
this.lib = null;
|
|
119
|
+
}
|
|
120
|
+
this.acccountName = accountName;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* callSharedLibrary - send string to native function, receive string back.
|
|
124
|
+
*/
|
|
125
|
+
callSharedLibrary(input, operation_type) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
if (!this.lib) {
|
|
128
|
+
throw new Error("Native library is not available.");
|
|
129
|
+
}
|
|
130
|
+
if (!input || input.length === 0) {
|
|
131
|
+
throw new Error("internal: empty input");
|
|
132
|
+
}
|
|
133
|
+
const inputEncoded = Buffer.from(input, "utf8").toString("base64");
|
|
134
|
+
const req = {
|
|
135
|
+
account_name: this.acccountName,
|
|
136
|
+
kind: operation_type,
|
|
137
|
+
payload: inputEncoded,
|
|
138
|
+
};
|
|
139
|
+
const inputBuf = Buffer.from(JSON.stringify(req), "utf8");
|
|
140
|
+
const nativeResponse = yield this.lib.sendMessage(inputBuf);
|
|
141
|
+
if (!(nativeResponse instanceof Uint8Array)) {
|
|
142
|
+
throw new Error(`Native function returned an unexpected type. Expected Uint8Array, got ${typeof nativeResponse}`);
|
|
143
|
+
}
|
|
144
|
+
const respString = new TextDecoder().decode(nativeResponse);
|
|
145
|
+
const response = JSON.parse(respString);
|
|
146
|
+
if (response.success) {
|
|
147
|
+
const decodedPayload = Buffer.from(response.payload).toString("utf8");
|
|
148
|
+
// On success, the payload is the actual result string
|
|
149
|
+
return decodedPayload;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
// On failure, convert the error payload to a readable string and throw
|
|
153
|
+
const errorMessage = Array.isArray(response.payload)
|
|
154
|
+
? String.fromCharCode(...response.payload)
|
|
155
|
+
: JSON.stringify(response.payload);
|
|
156
|
+
(0, errors_1.throwError)(errorMessage);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
// Core interface implementation
|
|
161
|
+
initClient(config) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
return this.callSharedLibrary(config, "init_client");
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
invoke(invokeConfigBytes) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
return this.callSharedLibrary(invokeConfigBytes, "invoke");
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
releaseClient(clientId) {
|
|
172
|
+
this.callSharedLibrary(clientId, "release_client").catch((err) => {
|
|
173
|
+
console.warn("failed to release client:", err);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.SharedLibCore = SharedLibCore;
|
package/dist/types.d.ts
CHANGED
|
@@ -44,6 +44,98 @@ export interface GeneratePasswordResponse {
|
|
|
44
44
|
/** The generated password. */
|
|
45
45
|
password: string;
|
|
46
46
|
}
|
|
47
|
+
export declare enum GroupType {
|
|
48
|
+
/**
|
|
49
|
+
* The owners group, which gives the following permissions:
|
|
50
|
+
* - Do everything the Admin group can do
|
|
51
|
+
* - See every vault other than the personal vaults
|
|
52
|
+
* - Change people's names
|
|
53
|
+
* - See billing
|
|
54
|
+
* - Change billing
|
|
55
|
+
* - Make other people owners
|
|
56
|
+
* - Delete a person
|
|
57
|
+
*/
|
|
58
|
+
Owners = "owners",
|
|
59
|
+
/**
|
|
60
|
+
* The administrators group, which gives the following permissions:
|
|
61
|
+
* - Perform recovery
|
|
62
|
+
* - Create new vaults
|
|
63
|
+
* - Invite new members
|
|
64
|
+
* - See vault metadata, including the vault name and who has access.
|
|
65
|
+
* - Make other people admins
|
|
66
|
+
*/
|
|
67
|
+
Administrators = "administrators",
|
|
68
|
+
/**
|
|
69
|
+
* The recovery group. It contains recovery keysets, and is added to every vault to allow for recovery.
|
|
70
|
+
*
|
|
71
|
+
* No one is added to this.
|
|
72
|
+
*/
|
|
73
|
+
Recovery = "recovery",
|
|
74
|
+
/**
|
|
75
|
+
* The external account managers group or EAM is a mandatory group for managed accounts that has
|
|
76
|
+
* same permissions as the owners.
|
|
77
|
+
*/
|
|
78
|
+
ExternalAccountManagers = "externalAccountManagers",
|
|
79
|
+
/** Members of a team that a user is on. */
|
|
80
|
+
TeamMembers = "teamMembers",
|
|
81
|
+
/** A custom, user defined group. */
|
|
82
|
+
UserDefined = "userDefined",
|
|
83
|
+
/** Support for new or renamed group types */
|
|
84
|
+
Unsupported = "unsupported"
|
|
85
|
+
}
|
|
86
|
+
export declare enum GroupState {
|
|
87
|
+
/** This group is active */
|
|
88
|
+
Active = "active",
|
|
89
|
+
/** This group has been deleted */
|
|
90
|
+
Deleted = "deleted",
|
|
91
|
+
/** This group is in an unknown state */
|
|
92
|
+
Unsupported = "unsupported"
|
|
93
|
+
}
|
|
94
|
+
export declare enum VaultAccessorType {
|
|
95
|
+
User = "user",
|
|
96
|
+
Group = "group"
|
|
97
|
+
}
|
|
98
|
+
/** Represents the vault access information. */
|
|
99
|
+
export interface VaultAccess {
|
|
100
|
+
/** The vault's UUID. */
|
|
101
|
+
vaultUuid: string;
|
|
102
|
+
/** The vault's accessor type. */
|
|
103
|
+
accessorType: VaultAccessorType;
|
|
104
|
+
/** The vault's accessor UUID. */
|
|
105
|
+
accessorUuid: string;
|
|
106
|
+
/** The permissions granted to this vault */
|
|
107
|
+
permissions: number;
|
|
108
|
+
}
|
|
109
|
+
export interface Group {
|
|
110
|
+
id: string;
|
|
111
|
+
title: string;
|
|
112
|
+
description: string;
|
|
113
|
+
groupType: GroupType;
|
|
114
|
+
state: GroupState;
|
|
115
|
+
vaultAccess?: VaultAccess[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Represents a group's access to a 1Password vault.
|
|
119
|
+
* This is used for granting permissions
|
|
120
|
+
*/
|
|
121
|
+
export interface GroupAccess {
|
|
122
|
+
/** The group's ID */
|
|
123
|
+
group_id: string;
|
|
124
|
+
/** The group's set of permissions for the vault */
|
|
125
|
+
permissions: number;
|
|
126
|
+
}
|
|
127
|
+
export interface GroupGetParams {
|
|
128
|
+
vaultPermissions?: boolean;
|
|
129
|
+
}
|
|
130
|
+
/** Represents a group's access to a 1Password vault. */
|
|
131
|
+
export interface GroupVaultAccess {
|
|
132
|
+
/** The vault's ID */
|
|
133
|
+
vault_id: string;
|
|
134
|
+
/** The group's ID */
|
|
135
|
+
group_id: string;
|
|
136
|
+
/** The group's set of permissions for the vault */
|
|
137
|
+
permissions: number;
|
|
138
|
+
}
|
|
47
139
|
export declare enum ItemCategory {
|
|
48
140
|
Login = "Login",
|
|
49
141
|
SecureNote = "SecureNote",
|
|
@@ -130,7 +222,7 @@ export interface ItemSection {
|
|
|
130
222
|
* Controls the auto-fill behavior of a website.
|
|
131
223
|
*
|
|
132
224
|
*
|
|
133
|
-
* For more information, visit https://support.1password.com/autofill-behavior
|
|
225
|
+
* For more information, visit <https://support.1password.com/autofill-behavior/>
|
|
134
226
|
*/
|
|
135
227
|
export declare enum AutofillBehavior {
|
|
136
228
|
/** Auto-fill any page that’s part of the website, including subdomains */
|
|
@@ -148,7 +240,7 @@ export interface Website {
|
|
|
148
240
|
/**
|
|
149
241
|
* The auto-fill behavior of the website
|
|
150
242
|
*
|
|
151
|
-
* For more information, visit https://support.1password.com/autofill-behavior
|
|
243
|
+
* For more information, visit <https://support.1password.com/autofill-behavior/>
|
|
152
244
|
*/
|
|
153
245
|
autofillBehavior: AutofillBehavior;
|
|
154
246
|
}
|
|
@@ -331,6 +423,62 @@ export interface ItemShareParams {
|
|
|
331
423
|
/** Whether the item can only be viewed once per recipient */
|
|
332
424
|
oneTimeOnly: boolean;
|
|
333
425
|
}
|
|
426
|
+
export interface Response<T, E> {
|
|
427
|
+
content?: T;
|
|
428
|
+
error?: E;
|
|
429
|
+
}
|
|
430
|
+
export type ItemUpdateFailureReason =
|
|
431
|
+
/** Item update operation failed due to bad user input. */
|
|
432
|
+
{
|
|
433
|
+
type: "itemValidationError";
|
|
434
|
+
message: ErrorMessage;
|
|
435
|
+
}
|
|
436
|
+
/** Item update operation is forbidden, permission issue. Make sure you have the correct permissions to update items in this vault. */
|
|
437
|
+
| {
|
|
438
|
+
type: "itemStatusPermissionError";
|
|
439
|
+
message?: undefined;
|
|
440
|
+
}
|
|
441
|
+
/** Item update operation failed due to incorrect version. */
|
|
442
|
+
| {
|
|
443
|
+
type: "itemStatusIncorrectItemVersion";
|
|
444
|
+
message?: undefined;
|
|
445
|
+
}
|
|
446
|
+
/** Item update operation failed because a file reference didn't match a known file. */
|
|
447
|
+
| {
|
|
448
|
+
type: "itemStatusFileNotFound";
|
|
449
|
+
message?: undefined;
|
|
450
|
+
}
|
|
451
|
+
/** Item update request is too big to be sent to the server. */
|
|
452
|
+
| {
|
|
453
|
+
type: "itemStatusTooBig";
|
|
454
|
+
message?: undefined;
|
|
455
|
+
}
|
|
456
|
+
/** The item was not found */
|
|
457
|
+
| {
|
|
458
|
+
type: "itemNotFound";
|
|
459
|
+
message?: undefined;
|
|
460
|
+
}
|
|
461
|
+
/** Item update operation experienced an internal error. */
|
|
462
|
+
| {
|
|
463
|
+
type: "internal";
|
|
464
|
+
message: ErrorMessage;
|
|
465
|
+
};
|
|
466
|
+
export interface ItemsDeleteAllResponse {
|
|
467
|
+
individualResponses: Record<string, Response<undefined, ItemUpdateFailureReason>>;
|
|
468
|
+
}
|
|
469
|
+
export type ItemsGetAllError = {
|
|
470
|
+
type: "itemNotFound";
|
|
471
|
+
message?: undefined;
|
|
472
|
+
} | {
|
|
473
|
+
type: "internal";
|
|
474
|
+
message: ErrorMessage;
|
|
475
|
+
};
|
|
476
|
+
export interface ItemsGetAllResponse {
|
|
477
|
+
individualResponses: Response<Item, ItemsGetAllError>[];
|
|
478
|
+
}
|
|
479
|
+
export interface ItemsUpdateAllResponse {
|
|
480
|
+
individualResponses: Response<Item, ItemUpdateFailureReason>[];
|
|
481
|
+
}
|
|
334
482
|
/** Additional attributes for OTP fields. */
|
|
335
483
|
export interface OtpFieldDetails {
|
|
336
484
|
/** The OTP code, if successfully computed */
|
|
@@ -338,10 +486,6 @@ export interface OtpFieldDetails {
|
|
|
338
486
|
/** The error message, if the OTP code could not be computed */
|
|
339
487
|
errorMessage?: string;
|
|
340
488
|
}
|
|
341
|
-
export interface Response<T, E> {
|
|
342
|
-
content?: T;
|
|
343
|
-
error?: E;
|
|
344
|
-
}
|
|
345
489
|
export interface ResolvedReference {
|
|
346
490
|
secret: string;
|
|
347
491
|
itemId: string;
|
|
@@ -439,12 +583,57 @@ export interface SshKeyAttributes {
|
|
|
439
583
|
/** The key type ("Ed25519" or "RSA, {length}-bit") */
|
|
440
584
|
keyType: string;
|
|
441
585
|
}
|
|
442
|
-
/** Represents
|
|
586
|
+
/** Represents the vault type. */
|
|
587
|
+
export declare enum VaultType {
|
|
588
|
+
Personal = "personal",
|
|
589
|
+
Everyone = "everyone",
|
|
590
|
+
Transfer = "transfer",
|
|
591
|
+
UserCreated = "userCreated",
|
|
592
|
+
Unsupported = "unsupported"
|
|
593
|
+
}
|
|
594
|
+
/** Represents regular vault information together with the vault's access information. */
|
|
595
|
+
export interface Vault {
|
|
596
|
+
/** The vault's ID. */
|
|
597
|
+
id: string;
|
|
598
|
+
/** The vault's title. */
|
|
599
|
+
title: string;
|
|
600
|
+
/** The description of the vault. */
|
|
601
|
+
description: string;
|
|
602
|
+
/** The type of the vault. */
|
|
603
|
+
vaultType: VaultType;
|
|
604
|
+
/** The number of active items within the vault. */
|
|
605
|
+
activeItemCount: number;
|
|
606
|
+
/** The content version number of the vault. It gets incremented whenever the state of the vault's contents changes (e.g. items from within the vault get created or updated). */
|
|
607
|
+
contentVersion: number;
|
|
608
|
+
/** The attribute version number of the vault. It gets incremented whenever vault presentation information changes, such as its title or icon. */
|
|
609
|
+
attributeVersion: number;
|
|
610
|
+
/** The access information associated with the vault. */
|
|
611
|
+
access?: VaultAccess[];
|
|
612
|
+
}
|
|
613
|
+
/** Represents the possible query parameters used for retrieving extra information about a vault. */
|
|
614
|
+
export interface VaultGetParams {
|
|
615
|
+
/** The vault's accessor params. */
|
|
616
|
+
accessors?: boolean;
|
|
617
|
+
}
|
|
618
|
+
export interface VaultListParams {
|
|
619
|
+
decryptDetails?: boolean;
|
|
620
|
+
}
|
|
621
|
+
/** Holds information about a 1Password Vault. */
|
|
443
622
|
export interface VaultOverview {
|
|
444
|
-
/** The vault's ID */
|
|
623
|
+
/** The vault's ID. */
|
|
445
624
|
id: string;
|
|
446
|
-
/** The vault's title */
|
|
625
|
+
/** The vault's title. */
|
|
447
626
|
title: string;
|
|
627
|
+
/** The description of this vault. */
|
|
628
|
+
description: string;
|
|
629
|
+
/** The type of the vault. */
|
|
630
|
+
vaultType: VaultType;
|
|
631
|
+
/** The number of active items within the vault. */
|
|
632
|
+
activeItemCount: number;
|
|
633
|
+
/** The content version number of the vault. It gets incremented whenever the state of the vault's contents changes (e.g. items from within the vault get created or updated). */
|
|
634
|
+
contentVersion: number;
|
|
635
|
+
/** The attribute version number of the vault. It gets incremented whenever vault presentation information changes, such as its title or icon. */
|
|
636
|
+
attributeVersion: number;
|
|
448
637
|
/** The time the vault was created at */
|
|
449
638
|
createdAt: Date;
|
|
450
639
|
/** The time the vault was updated at */
|
|
@@ -533,6 +722,20 @@ export declare enum WordListType {
|
|
|
533
722
|
/** Three (random) letter "words" */
|
|
534
723
|
ThreeLetters = "threeLetters"
|
|
535
724
|
}
|
|
725
|
+
export declare const ARCHIVE_ITEMS: number;
|
|
726
|
+
export declare const CREATE_ITEMS: number;
|
|
727
|
+
export declare const DELETE_ITEMS: number;
|
|
728
|
+
export declare const EXPORT_ITEMS: number;
|
|
729
|
+
export declare const IMPORT_ITEMS: number;
|
|
730
|
+
export declare const MANAGE_VAULT: number;
|
|
731
|
+
export declare const NO_ACCESS: number;
|
|
732
|
+
export declare const PRINT_ITEMS: number;
|
|
733
|
+
export declare const READ_ITEMS: number;
|
|
734
|
+
export declare const RECOVER_VAULT: number;
|
|
735
|
+
export declare const REVEAL_ITEM_PASSWORD: number;
|
|
736
|
+
export declare const SEND_ITEMS: number;
|
|
737
|
+
export declare const UPDATE_ITEMS: number;
|
|
738
|
+
export declare const UPDATE_ITEM_HISTORY: number;
|
|
536
739
|
/**
|
|
537
740
|
* Custom JSON reviver and replacer functions for dynamic data transformation
|
|
538
741
|
* ReviverFunc is used during JSON parsing to detect and transform specific data structures
|
package/dist/types.js
CHANGED
|
@@ -3,7 +3,61 @@
|
|
|
3
3
|
Generated by typeshare 1.13.2
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ReplacerFunc = exports.ReviverFunc = exports.WordListType = exports.SeparatorType = exports.AllowedRecipientType = exports.AllowedType = exports.ItemShareDuration = exports.ItemState = exports.AutofillBehavior = exports.ItemFieldType = exports.ItemCategory = void 0;
|
|
6
|
+
exports.ReplacerFunc = exports.ReviverFunc = exports.UPDATE_ITEM_HISTORY = exports.UPDATE_ITEMS = exports.SEND_ITEMS = exports.REVEAL_ITEM_PASSWORD = exports.RECOVER_VAULT = exports.READ_ITEMS = exports.PRINT_ITEMS = exports.NO_ACCESS = exports.MANAGE_VAULT = exports.IMPORT_ITEMS = exports.EXPORT_ITEMS = exports.DELETE_ITEMS = exports.CREATE_ITEMS = exports.ARCHIVE_ITEMS = exports.WordListType = exports.SeparatorType = exports.VaultType = exports.AllowedRecipientType = exports.AllowedType = exports.ItemShareDuration = exports.ItemState = exports.AutofillBehavior = exports.ItemFieldType = exports.ItemCategory = exports.VaultAccessorType = exports.GroupState = exports.GroupType = void 0;
|
|
7
|
+
var GroupType;
|
|
8
|
+
(function (GroupType) {
|
|
9
|
+
/**
|
|
10
|
+
* The owners group, which gives the following permissions:
|
|
11
|
+
* - Do everything the Admin group can do
|
|
12
|
+
* - See every vault other than the personal vaults
|
|
13
|
+
* - Change people's names
|
|
14
|
+
* - See billing
|
|
15
|
+
* - Change billing
|
|
16
|
+
* - Make other people owners
|
|
17
|
+
* - Delete a person
|
|
18
|
+
*/
|
|
19
|
+
GroupType["Owners"] = "owners";
|
|
20
|
+
/**
|
|
21
|
+
* The administrators group, which gives the following permissions:
|
|
22
|
+
* - Perform recovery
|
|
23
|
+
* - Create new vaults
|
|
24
|
+
* - Invite new members
|
|
25
|
+
* - See vault metadata, including the vault name and who has access.
|
|
26
|
+
* - Make other people admins
|
|
27
|
+
*/
|
|
28
|
+
GroupType["Administrators"] = "administrators";
|
|
29
|
+
/**
|
|
30
|
+
* The recovery group. It contains recovery keysets, and is added to every vault to allow for recovery.
|
|
31
|
+
*
|
|
32
|
+
* No one is added to this.
|
|
33
|
+
*/
|
|
34
|
+
GroupType["Recovery"] = "recovery";
|
|
35
|
+
/**
|
|
36
|
+
* The external account managers group or EAM is a mandatory group for managed accounts that has
|
|
37
|
+
* same permissions as the owners.
|
|
38
|
+
*/
|
|
39
|
+
GroupType["ExternalAccountManagers"] = "externalAccountManagers";
|
|
40
|
+
/** Members of a team that a user is on. */
|
|
41
|
+
GroupType["TeamMembers"] = "teamMembers";
|
|
42
|
+
/** A custom, user defined group. */
|
|
43
|
+
GroupType["UserDefined"] = "userDefined";
|
|
44
|
+
/** Support for new or renamed group types */
|
|
45
|
+
GroupType["Unsupported"] = "unsupported";
|
|
46
|
+
})(GroupType || (exports.GroupType = GroupType = {}));
|
|
47
|
+
var GroupState;
|
|
48
|
+
(function (GroupState) {
|
|
49
|
+
/** This group is active */
|
|
50
|
+
GroupState["Active"] = "active";
|
|
51
|
+
/** This group has been deleted */
|
|
52
|
+
GroupState["Deleted"] = "deleted";
|
|
53
|
+
/** This group is in an unknown state */
|
|
54
|
+
GroupState["Unsupported"] = "unsupported";
|
|
55
|
+
})(GroupState || (exports.GroupState = GroupState = {}));
|
|
56
|
+
var VaultAccessorType;
|
|
57
|
+
(function (VaultAccessorType) {
|
|
58
|
+
VaultAccessorType["User"] = "user";
|
|
59
|
+
VaultAccessorType["Group"] = "group";
|
|
60
|
+
})(VaultAccessorType || (exports.VaultAccessorType = VaultAccessorType = {}));
|
|
7
61
|
var ItemCategory;
|
|
8
62
|
(function (ItemCategory) {
|
|
9
63
|
ItemCategory["Login"] = "Login";
|
|
@@ -53,7 +107,7 @@ var ItemFieldType;
|
|
|
53
107
|
* Controls the auto-fill behavior of a website.
|
|
54
108
|
*
|
|
55
109
|
*
|
|
56
|
-
* For more information, visit https://support.1password.com/autofill-behavior
|
|
110
|
+
* For more information, visit <https://support.1password.com/autofill-behavior/>
|
|
57
111
|
*/
|
|
58
112
|
var AutofillBehavior;
|
|
59
113
|
(function (AutofillBehavior) {
|
|
@@ -102,6 +156,15 @@ var AllowedRecipientType;
|
|
|
102
156
|
/** Recipients can be specified by domain */
|
|
103
157
|
AllowedRecipientType["Domain"] = "Domain";
|
|
104
158
|
})(AllowedRecipientType || (exports.AllowedRecipientType = AllowedRecipientType = {}));
|
|
159
|
+
/** Represents the vault type. */
|
|
160
|
+
var VaultType;
|
|
161
|
+
(function (VaultType) {
|
|
162
|
+
VaultType["Personal"] = "personal";
|
|
163
|
+
VaultType["Everyone"] = "everyone";
|
|
164
|
+
VaultType["Transfer"] = "transfer";
|
|
165
|
+
VaultType["UserCreated"] = "userCreated";
|
|
166
|
+
VaultType["Unsupported"] = "unsupported";
|
|
167
|
+
})(VaultType || (exports.VaultType = VaultType = {}));
|
|
105
168
|
var SeparatorType;
|
|
106
169
|
(function (SeparatorType) {
|
|
107
170
|
/**
|
|
@@ -151,6 +214,20 @@ var WordListType;
|
|
|
151
214
|
/** Three (random) letter "words" */
|
|
152
215
|
WordListType["ThreeLetters"] = "threeLetters";
|
|
153
216
|
})(WordListType || (exports.WordListType = WordListType = {}));
|
|
217
|
+
exports.ARCHIVE_ITEMS = 256;
|
|
218
|
+
exports.CREATE_ITEMS = 128;
|
|
219
|
+
exports.DELETE_ITEMS = 512;
|
|
220
|
+
exports.EXPORT_ITEMS = 4194304;
|
|
221
|
+
exports.IMPORT_ITEMS = 2097152;
|
|
222
|
+
exports.MANAGE_VAULT = 2;
|
|
223
|
+
exports.NO_ACCESS = 0;
|
|
224
|
+
exports.PRINT_ITEMS = 8388608;
|
|
225
|
+
exports.READ_ITEMS = 32;
|
|
226
|
+
exports.RECOVER_VAULT = 1;
|
|
227
|
+
exports.REVEAL_ITEM_PASSWORD = 16;
|
|
228
|
+
exports.SEND_ITEMS = 1048576;
|
|
229
|
+
exports.UPDATE_ITEMS = 64;
|
|
230
|
+
exports.UPDATE_ITEM_HISTORY = 1024;
|
|
154
231
|
/**
|
|
155
232
|
* Custom JSON reviver and replacer functions for dynamic data transformation
|
|
156
233
|
* ReviverFunc is used during JSON parsing to detect and transform specific data structures
|