@1password/sdk 0.1.7 → 0.2.0

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 CHANGED
@@ -84,10 +84,10 @@ Operations:
84
84
  - [x] [Create items](https://developer.1password.com/docs/sdks/manage-items#create-an-item)
85
85
  - [x] [Update items](https://developer.1password.com/docs/sdks/manage-items#update-an-item)
86
86
  - [x] [Delete items](https://developer.1password.com/docs/sdks/manage-items#delete-an-item)
87
- - [x] Archive items
87
+ - [x] [Archive items](https://developer.1password.com/docs/sdks/manage-items/#archive-an-item)
88
88
  - [x] [List items](https://developer.1password.com/docs/sdks/list-vaults-items/)
89
- - [x] Share items
90
- - [x] Generate PIN, random and memorable passwords
89
+ - [x] [Share items](https://developer.1password.com/docs/sdks/share-items) (items with files cannot be shared)
90
+ - [x] [Generate PIN, random and memorable passwords](https://developer.1password.com/docs/sdks/manage-items#generate-a-password)
91
91
 
92
92
  Field types:
93
93
  - [x] API Keys
@@ -95,7 +95,7 @@ Field types:
95
95
  - [x] Concealed fields
96
96
  - [x] Text fields
97
97
  - [x] Notes
98
- - [x] SSH private keys, public keys, fingerprint and key type (partially supported: supported in resolving secret references, not yet supported in item create/get/update)
98
+ - [x] SSH private keys, public keys, fingerprint and key type
99
99
  - [x] One-time passwords
100
100
  - [x] URLs
101
101
  - [x] Websites (used to suggest and autofill logins)
@@ -105,8 +105,10 @@ Field types:
105
105
  - [x] Emails
106
106
  - [x] References to other items
107
107
  - [ ] Address
108
- - [ ] Date / MM/YY
109
- - [ ] Files attachments and Document items
108
+ - [ ] Date
109
+ - [x] MM/YY
110
+ - [x] Files attachments and Document items
111
+ - [x] Menu
110
112
 
111
113
  ### Vault management
112
114
  - [ ] Retrieve vaults
@@ -1,6 +1,6 @@
1
1
  import { ClientAuthConfig } from "./core.js";
2
2
  export declare const LANGUAGE = "JS";
3
- export declare const VERSION = "0010701";
3
+ export declare const VERSION = "0020001";
4
4
  export interface ClientConfiguration {
5
5
  auth: Auth;
6
6
  integrationName: string;
package/dist/core.d.ts CHANGED
@@ -69,9 +69,9 @@ export interface Parameters {
69
69
  * An implementation of the `Core` interface that shares resources across all clients.
70
70
  */
71
71
  export declare class SharedCore implements Core {
72
- invoke_sync(config: InvokeConfig): string;
73
72
  initClient(config: ClientAuthConfig): Promise<string>;
74
73
  invoke(config: InvokeConfig): Promise<string>;
74
+ invoke_sync(config: InvokeConfig): string;
75
75
  releaseClient(clientId: number): void;
76
76
  }
77
77
  /**
package/dist/core.js CHANGED
@@ -11,20 +11,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SharedCore = void 0;
13
13
  const sdk_core_1 = require("@1password/sdk-core");
14
+ const types_1 = require("./types");
14
15
  const errors_1 = require("./errors");
16
+ // In empirical tests, we determined that maximum message size that can cross the FFI boundary
17
+ // is ~64MB. Past this limit, the wasm-bingen FFI will throw an error and the program will crash.
18
+ // We set the limit to 50MB to be safe, to be reconsidered upon further testing.
19
+ const messageLimit = 50 * 1024 * 1024;
15
20
  /**
16
21
  * An implementation of the `Core` interface that shares resources across all clients.
17
22
  */
18
23
  class SharedCore {
19
- invoke_sync(config) {
20
- const serializedConfig = JSON.stringify(config);
21
- try {
22
- return (0, sdk_core_1.invoke_sync)(serializedConfig);
23
- }
24
- catch (e) {
25
- (0, errors_1.throwError)(e);
26
- }
27
- }
28
24
  initClient(config) {
29
25
  return __awaiter(this, void 0, void 0, function* () {
30
26
  const serializedConfig = JSON.stringify(config);
@@ -38,7 +34,12 @@ class SharedCore {
38
34
  }
39
35
  invoke(config) {
40
36
  return __awaiter(this, void 0, void 0, function* () {
41
- const serializedConfig = JSON.stringify(config);
37
+ const serializedConfig = JSON.stringify(config, types_1.ReplacerFunc);
38
+ // Encoding to bytes as JS uses UTF-16 under the hood, but the messages
39
+ // that are sent across the FFI boundary are encoded in UTF-8.
40
+ if (new TextEncoder().encode(serializedConfig).length > messageLimit) {
41
+ (0, errors_1.throwError)(`message size exceeds the limit of ${messageLimit} bytes, please contact 1Password at support@1password.com or https://developer.1password.com/joinslack if you need help."`);
42
+ }
42
43
  try {
43
44
  return yield (0, sdk_core_1.invoke)(serializedConfig);
44
45
  }
@@ -47,6 +48,20 @@ class SharedCore {
47
48
  }
48
49
  });
49
50
  }
51
+ invoke_sync(config) {
52
+ const serializedConfig = JSON.stringify(config, types_1.ReplacerFunc);
53
+ // Encoding to bytes as JS uses UTF-16 under the hood, but the messages
54
+ // that are sent across the FFI boundary are encoded in UTF-8.
55
+ if (new TextEncoder().encode(serializedConfig).length > messageLimit) {
56
+ (0, errors_1.throwError)(`message size exceeds the limit of ${messageLimit} bytes, please contact 1Password at support@1password.com or https://developer.1password.com/joinslack if you need help.`);
57
+ }
58
+ try {
59
+ return (0, sdk_core_1.invoke_sync)(serializedConfig);
60
+ }
61
+ catch (e) {
62
+ (0, errors_1.throwError)(e);
63
+ }
64
+ }
50
65
  releaseClient(clientId) {
51
66
  const serializedId = JSON.stringify(clientId);
52
67
  (0, sdk_core_1.release_client)(serializedId);
package/dist/items.d.ts CHANGED
@@ -2,11 +2,13 @@ import { InnerClient } from "./core.js";
2
2
  import { SdkIterable } from "./iterator.js";
3
3
  import { Item, ItemCreateParams, ItemOverview } from "./types.js";
4
4
  import { ItemsSharesApi } from "./items_shares.js";
5
+ import { ItemsFilesApi } from "./items_files.js";
5
6
  /**
6
7
  * The Items API holds all operations the SDK client can perform on 1Password items.
7
8
  */
8
9
  export interface ItemsApi {
9
10
  shares: ItemsSharesApi;
11
+ files: ItemsFilesApi;
10
12
  /**
11
13
  * Create a new item.
12
14
  */
@@ -35,6 +37,7 @@ export interface ItemsApi {
35
37
  export declare class Items implements ItemsApi {
36
38
  #private;
37
39
  shares: ItemsSharesApi;
40
+ files: ItemsFilesApi;
38
41
  constructor(inner: InnerClient);
39
42
  /**
40
43
  * Create a new item.
package/dist/items.js CHANGED
@@ -24,12 +24,15 @@ var _Items_inner;
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.Items = void 0;
26
26
  const iterator_js_1 = require("./iterator.js");
27
+ const types_js_1 = require("./types.js");
27
28
  const items_shares_js_1 = require("./items_shares.js");
29
+ const items_files_js_1 = require("./items_files.js");
28
30
  class Items {
29
31
  constructor(inner) {
30
32
  _Items_inner.set(this, void 0);
31
33
  __classPrivateFieldSet(this, _Items_inner, inner, "f");
32
34
  this.shares = new items_shares_js_1.ItemsShares(inner);
35
+ this.files = new items_files_js_1.ItemsFiles(inner);
33
36
  }
34
37
  /**
35
38
  * Create a new item.
@@ -47,7 +50,7 @@ class Items {
47
50
  },
48
51
  },
49
52
  };
50
- return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").core.invoke(invocationConfig));
53
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
51
54
  });
52
55
  }
53
56
  /**
@@ -67,7 +70,7 @@ class Items {
67
70
  },
68
71
  },
69
72
  };
70
- return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").core.invoke(invocationConfig));
73
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
71
74
  });
72
75
  }
73
76
  /**
@@ -86,7 +89,7 @@ class Items {
86
89
  },
87
90
  },
88
91
  };
89
- return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").core.invoke(invocationConfig));
92
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
90
93
  });
91
94
  }
92
95
  /**
@@ -145,7 +148,7 @@ class Items {
145
148
  },
146
149
  },
147
150
  };
148
- return new iterator_js_1.SdkIterable(JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").core.invoke(invocationConfig)));
151
+ return new iterator_js_1.SdkIterable(JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc));
149
152
  });
150
153
  }
151
154
  }
@@ -0,0 +1,40 @@
1
+ import { InnerClient } from "./core.js";
2
+ import { DocumentCreateParams, FileAttributes, FileCreateParams, Item } from "./types.js";
3
+ export interface ItemsFilesApi {
4
+ /**
5
+ * Attach files to Items
6
+ */
7
+ attach(item: Item, fileParams: FileCreateParams): Promise<Item>;
8
+ /**
9
+ * Read file content from the Item
10
+ */
11
+ read(vaultId: string, itemId: string, attr: FileAttributes): Promise<Uint8Array>;
12
+ /**
13
+ * Delete a field file from Item using the section and field IDs
14
+ */
15
+ delete(item: Item, sectionId: string, fieldId: string): Promise<Item>;
16
+ /**
17
+ * Replace the document file within a document item
18
+ */
19
+ replaceDocument(item: Item, docParams: DocumentCreateParams): Promise<Item>;
20
+ }
21
+ export declare class ItemsFiles implements ItemsFilesApi {
22
+ #private;
23
+ constructor(inner: InnerClient);
24
+ /**
25
+ * Attach files to Items
26
+ */
27
+ attach(item: Item, fileParams: FileCreateParams): Promise<Item>;
28
+ /**
29
+ * Read file content from the Item
30
+ */
31
+ read(vaultId: string, itemId: string, attr: FileAttributes): Promise<Uint8Array>;
32
+ /**
33
+ * Delete a field file from Item using the section and field IDs
34
+ */
35
+ delete(item: Item, sectionId: string, fieldId: string): Promise<Item>;
36
+ /**
37
+ * Replace the document file within a document item
38
+ */
39
+ replaceDocument(item: Item, docParams: DocumentCreateParams): Promise<Item>;
40
+ }
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ // Code generated by op-codegen - DO NOT EDIT MANUALLY
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13
+ if (kind === "m") throw new TypeError("Private method is not writable");
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
16
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17
+ };
18
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
19
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
20
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
21
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
22
+ };
23
+ var _ItemsFiles_inner;
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.ItemsFiles = void 0;
26
+ const types_js_1 = require("./types.js");
27
+ class ItemsFiles {
28
+ constructor(inner) {
29
+ _ItemsFiles_inner.set(this, void 0);
30
+ __classPrivateFieldSet(this, _ItemsFiles_inner, inner, "f");
31
+ }
32
+ /**
33
+ * Attach files to Items
34
+ */
35
+ attach(item, fileParams) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const invocationConfig = {
38
+ invocation: {
39
+ clientId: __classPrivateFieldGet(this, _ItemsFiles_inner, "f").id,
40
+ parameters: {
41
+ name: "ItemsFilesAttach",
42
+ parameters: {
43
+ item,
44
+ file_params: fileParams,
45
+ },
46
+ },
47
+ },
48
+ };
49
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
50
+ });
51
+ }
52
+ /**
53
+ * Read file content from the Item
54
+ */
55
+ read(vaultId, itemId, attr) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const invocationConfig = {
58
+ invocation: {
59
+ clientId: __classPrivateFieldGet(this, _ItemsFiles_inner, "f").id,
60
+ parameters: {
61
+ name: "ItemsFilesRead",
62
+ parameters: {
63
+ vault_id: vaultId,
64
+ item_id: itemId,
65
+ attr,
66
+ },
67
+ },
68
+ },
69
+ };
70
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
71
+ });
72
+ }
73
+ /**
74
+ * Delete a field file from Item using the section and field IDs
75
+ */
76
+ delete(item, sectionId, fieldId) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ const invocationConfig = {
79
+ invocation: {
80
+ clientId: __classPrivateFieldGet(this, _ItemsFiles_inner, "f").id,
81
+ parameters: {
82
+ name: "ItemsFilesDelete",
83
+ parameters: {
84
+ item,
85
+ section_id: sectionId,
86
+ field_id: fieldId,
87
+ },
88
+ },
89
+ },
90
+ };
91
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
92
+ });
93
+ }
94
+ /**
95
+ * Replace the document file within a document item
96
+ */
97
+ replaceDocument(item, docParams) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ const invocationConfig = {
100
+ invocation: {
101
+ clientId: __classPrivateFieldGet(this, _ItemsFiles_inner, "f").id,
102
+ parameters: {
103
+ name: "ItemsFilesReplaceDocument",
104
+ parameters: {
105
+ item,
106
+ doc_params: docParams,
107
+ },
108
+ },
109
+ },
110
+ };
111
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
112
+ });
113
+ }
114
+ }
115
+ exports.ItemsFiles = ItemsFiles;
116
+ _ItemsFiles_inner = new WeakMap();
@@ -23,6 +23,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
23
23
  var _ItemsShares_inner;
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.ItemsShares = void 0;
26
+ const types_js_1 = require("./types.js");
26
27
  class ItemsShares {
27
28
  constructor(inner) {
28
29
  _ItemsShares_inner.set(this, void 0);
@@ -45,7 +46,7 @@ class ItemsShares {
45
46
  },
46
47
  },
47
48
  };
48
- return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").core.invoke(invocationConfig));
49
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
49
50
  });
50
51
  }
51
52
  /**
@@ -65,7 +66,7 @@ class ItemsShares {
65
66
  },
66
67
  },
67
68
  };
68
- return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").core.invoke(invocationConfig));
69
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
69
70
  });
70
71
  }
71
72
  /**
@@ -86,7 +87,7 @@ class ItemsShares {
86
87
  },
87
88
  },
88
89
  };
89
- return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").core.invoke(invocationConfig));
90
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
90
91
  });
91
92
  }
92
93
  }
package/dist/iterator.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // Code generated by op-codegen - DO NOT EDIT MANUALLY
2
3
  var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
3
4
  var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
4
5
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
package/dist/sdk.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // Code generated by op-codegen - DO NOT EDIT MANUALLY
2
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
4
  if (k2 === undefined) k2 = k;
4
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
package/dist/secrets.js CHANGED
@@ -24,6 +24,7 @@ var _Secrets_inner;
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.Secrets = void 0;
26
26
  const core_js_1 = require("./core.js");
27
+ const types_js_1 = require("./types.js");
27
28
  class Secrets {
28
29
  constructor(inner) {
29
30
  _Secrets_inner.set(this, void 0);
@@ -45,7 +46,7 @@ class Secrets {
45
46
  },
46
47
  },
47
48
  };
48
- return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").core.invoke(invocationConfig));
49
+ return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc);
49
50
  });
50
51
  }
51
52
  /**
@@ -77,7 +78,7 @@ class Secrets {
77
78
  },
78
79
  },
79
80
  };
80
- return JSON.parse(sharedCore.invoke_sync(invocationConfig));
81
+ return JSON.parse(sharedCore.invoke_sync(invocationConfig), types_js_1.ReviverFunc);
81
82
  }
82
83
  }
83
84
  exports.Secrets = Secrets;
package/dist/types.d.ts CHANGED
@@ -1,3 +1,27 @@
1
+ export interface DocumentCreateParams {
2
+ /** the name of the file */
3
+ name: string;
4
+ /** the content of the file */
5
+ content: Uint8Array;
6
+ }
7
+ export interface FileAttributes {
8
+ /** The name of the file */
9
+ name: string;
10
+ /** The ID of the file retrieved from the server */
11
+ id: string;
12
+ /** The size of the file in bytes */
13
+ size: number;
14
+ }
15
+ export interface FileCreateParams {
16
+ /** the name of the file */
17
+ name: string;
18
+ /** the content of the file */
19
+ content: Uint8Array;
20
+ /** the section id where the file should be stored */
21
+ sectionId: string;
22
+ /** the field id where the file should be stored */
23
+ fieldId: string;
24
+ }
1
25
  /**
2
26
  * For future use, if we want to return more information about the generated password.
3
27
  * Currently, it only returns the password itself.
@@ -42,6 +66,9 @@ export declare enum ItemFieldType {
42
66
  Totp = "Totp",
43
67
  Email = "Email",
44
68
  Reference = "Reference",
69
+ SshKey = "SshKey",
70
+ Menu = "Menu",
71
+ MonthYear = "MonthYear",
45
72
  Unsupported = "Unsupported"
46
73
  }
47
74
  /** Field type-specific attributes. */
@@ -50,6 +77,11 @@ export type ItemFieldDetails =
50
77
  {
51
78
  type: "Otp";
52
79
  content: OtpFieldDetails;
80
+ }
81
+ /** Computed SSH Key attributes */
82
+ | {
83
+ type: "SshKey";
84
+ content?: SshKeyAttributes;
53
85
  };
54
86
  /** Represents a field within an item. */
55
87
  export interface ItemField {
@@ -99,6 +131,14 @@ export interface Website {
99
131
  */
100
132
  autofillBehavior: AutofillBehavior;
101
133
  }
134
+ export interface ItemFile {
135
+ /** the attributes of the file */
136
+ attributes: FileAttributes;
137
+ /** the section id where the file should be stored */
138
+ sectionId: string;
139
+ /** the field id where the file should be stored */
140
+ fieldId: string;
141
+ }
102
142
  /** Represents a 1Password item. */
103
143
  export interface Item {
104
144
  /** The item's ID */
@@ -121,6 +161,10 @@ export interface Item {
121
161
  websites: Website[];
122
162
  /** The item's version */
123
163
  version: number;
164
+ /** The item's file fields */
165
+ files: ItemFile[];
166
+ /** The document file for the Document item category */
167
+ document?: FileAttributes;
124
168
  }
125
169
  export interface ItemCreateParams {
126
170
  /** The item's category */
@@ -139,6 +183,10 @@ export interface ItemCreateParams {
139
183
  tags?: string[];
140
184
  /** The websites used for autofilling for items of the Login and Password categories. */
141
185
  websites?: Website[];
186
+ /** The item's files stored as fields */
187
+ files?: FileCreateParams[];
188
+ /** The document file for the Document item category */
189
+ document?: DocumentCreateParams;
142
190
  }
143
191
  /** Represents a decrypted 1Password item. */
144
192
  export interface ItemOverview {
@@ -231,6 +279,14 @@ export interface OtpFieldDetails {
231
279
  /** The error message, if the OTP code could not be computed */
232
280
  errorMessage?: string;
233
281
  }
282
+ export interface SshKeyAttributes {
283
+ /** The public part of the SSH Key */
284
+ publicKey: string;
285
+ /** The fingerprint of the SSH Key */
286
+ fingerprint: string;
287
+ /** The key type ("Ed25519" or "RSA, {length}-bit") */
288
+ keyType: string;
289
+ }
234
290
  /** Represents a decrypted 1Password vault. */
235
291
  export interface VaultOverview {
236
292
  /** The vault's ID */
@@ -314,3 +370,5 @@ export declare enum WordListType {
314
370
  /** Three (random) letter "words" */
315
371
  ThreeLetters = "threeLetters"
316
372
  }
373
+ export declare const ReviverFunc: (key: string, value: unknown) => unknown;
374
+ export declare const ReplacerFunc: (key: string, value: unknown) => unknown;
package/dist/types.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Generated by typeshare 1.13.2
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.WordListType = exports.SeparatorType = exports.AllowedRecipientType = exports.AllowedType = exports.ItemShareDuration = exports.AutofillBehavior = exports.ItemFieldType = exports.ItemCategory = void 0;
6
+ exports.ReplacerFunc = exports.ReviverFunc = exports.WordListType = exports.SeparatorType = exports.AllowedRecipientType = exports.AllowedType = exports.ItemShareDuration = exports.AutofillBehavior = exports.ItemFieldType = exports.ItemCategory = void 0;
7
7
  var ItemCategory;
8
8
  (function (ItemCategory) {
9
9
  ItemCategory["Login"] = "Login";
@@ -42,6 +42,9 @@ var ItemFieldType;
42
42
  ItemFieldType["Totp"] = "Totp";
43
43
  ItemFieldType["Email"] = "Email";
44
44
  ItemFieldType["Reference"] = "Reference";
45
+ ItemFieldType["SshKey"] = "SshKey";
46
+ ItemFieldType["Menu"] = "Menu";
47
+ ItemFieldType["MonthYear"] = "MonthYear";
45
48
  ItemFieldType["Unsupported"] = "Unsupported";
46
49
  })(ItemFieldType || (exports.ItemFieldType = ItemFieldType = {}));
47
50
  /**
@@ -138,3 +141,19 @@ var WordListType;
138
141
  /** Three (random) letter "words" */
139
142
  WordListType["ThreeLetters"] = "threeLetters";
140
143
  })(WordListType || (exports.WordListType = WordListType = {}));
144
+ const ReviverFunc = (key, value) => {
145
+ if (Array.isArray(value) &&
146
+ value.every((v) => Number.isInteger(v) && v >= 0 && v <= 255) &&
147
+ value.length > 0) {
148
+ return new Uint8Array(value);
149
+ }
150
+ return value;
151
+ };
152
+ exports.ReviverFunc = ReviverFunc;
153
+ const ReplacerFunc = (key, value) => {
154
+ if (value instanceof Uint8Array) {
155
+ return Array.from(value);
156
+ }
157
+ return value;
158
+ };
159
+ exports.ReplacerFunc = ReplacerFunc;
package/dist/vaults.js CHANGED
@@ -24,6 +24,7 @@ var _Vaults_inner;
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.Vaults = void 0;
26
26
  const iterator_js_1 = require("./iterator.js");
27
+ const types_js_1 = require("./types.js");
27
28
  class Vaults {
28
29
  constructor(inner) {
29
30
  _Vaults_inner.set(this, void 0);
@@ -43,7 +44,7 @@ class Vaults {
43
44
  },
44
45
  },
45
46
  };
46
- return new iterator_js_1.SdkIterable(JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").core.invoke(invocationConfig)));
47
+ return new iterator_js_1.SdkIterable(JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").core.invoke(invocationConfig), types_js_1.ReviverFunc));
47
48
  });
48
49
  }
49
50
  }
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "0.1.7";
2
- export declare const SDK_BUILD_NUMBER = "0010701";
1
+ export declare const SDK_VERSION = "0.2.0";
2
+ export declare const SDK_BUILD_NUMBER = "0020001";
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.7";
5
- exports.SDK_BUILD_NUMBER = "0010701";
6
- const SDK_CORE_VERSION = "0.1.7";
4
+ exports.SDK_VERSION = "0.2.0";
5
+ exports.SDK_BUILD_NUMBER = "0020001";
6
+ const SDK_CORE_VERSION = "0.2.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1password/sdk",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
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.7"
29
+ "@1password/sdk-core": "0.2.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@1password/eslint-config": "^4.0.0",