@1password/sdk 0.0.0-credential-broker-dev-preview → 0.0.0-credential-broker-dev-preview.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.
@@ -1,6 +1,6 @@
1
1
  import { ClientAuthConfig, WorkloadDetails } from "./core.js";
2
2
  export declare const LANGUAGE = "JS";
3
- export declare const VERSION = "0000000";
3
+ export declare const VERSION = "0000001";
4
4
  interface BaseClientConfiguration {
5
5
  integrationName: string;
6
6
  integrationVersion: string;
@@ -1,5 +1,5 @@
1
1
  import { InnerClient } from "./core.js";
2
- import { AccessRequest, AccessRequestCreateParams, AccessRequestStatus } from "./types.js";
2
+ import { AccessRequestCreateParams, AccessRequestCreateResponse, AccessRequestStatus } from "./types.js";
3
3
  /**
4
4
  * Create and poll credential-broker access requests: asking a target
5
5
  * identity to grant this workload access to one or more credentials.
@@ -14,9 +14,10 @@ export interface CredentialBrokerAccessRequestsApi {
14
14
  * authenticated workload.
15
15
  *
16
16
  * Only the non-sensitive half is registered server-side; the returned
17
- * request is the full object with the presentation fields re-attached.
17
+ * request is the full object with the presentation fields re-attached,
18
+ * alongside the app link that carries them to the approval prompt.
18
19
  */
19
- create(params: AccessRequestCreateParams): Promise<AccessRequest>;
20
+ create(params: AccessRequestCreateParams): Promise<AccessRequestCreateResponse>;
20
21
  /**
21
22
  * Get the current status of an access request created by
22
23
  * [`AccessRequests::create`].
@@ -32,9 +33,10 @@ export declare class CredentialBrokerAccessRequests implements CredentialBrokerA
32
33
  * authenticated workload.
33
34
  *
34
35
  * Only the non-sensitive half is registered server-side; the returned
35
- * request is the full object with the presentation fields re-attached.
36
+ * request is the full object with the presentation fields re-attached,
37
+ * alongside the app link that carries them to the approval prompt.
36
38
  */
37
- create(params: AccessRequestCreateParams): Promise<AccessRequest>;
39
+ create(params: AccessRequestCreateParams): Promise<AccessRequestCreateResponse>;
38
40
  /**
39
41
  * Get the current status of an access request created by
40
42
  * [`AccessRequests::create`].
@@ -35,7 +35,8 @@ class CredentialBrokerAccessRequests {
35
35
  * authenticated workload.
36
36
  *
37
37
  * Only the non-sensitive half is registered server-side; the returned
38
- * request is the full object with the presentation fields re-attached.
38
+ * request is the full object with the presentation fields re-attached,
39
+ * alongside the app link that carries them to the approval prompt.
39
40
  */
40
41
  create(params) {
41
42
  return __awaiter(this, void 0, void 0, function* () {
@@ -1,5 +1,5 @@
1
1
  import { InnerClient } from "./core.js";
2
- import { CredentialReference, EnvironmentCredential } from "./types.js";
2
+ import { EnvironmentCredential } from "./types.js";
3
3
  /**
4
4
  * Read environment credentials — a bundle of environment variables — from
5
5
  * the 1Password Credential Broker.
@@ -16,7 +16,7 @@ export interface CredentialBrokerEnvironmentVariablesApi {
16
16
  * or does not name an environment credential, or with [Error::CredentialReferenceAccountMismatch]
17
17
  * if it belongs to a different account than the authenticated client.
18
18
  */
19
- read(credentialReference: CredentialReference): Promise<EnvironmentCredential>;
19
+ read(credentialReference: string): Promise<EnvironmentCredential>;
20
20
  }
21
21
  export declare class CredentialBrokerEnvironmentVariables implements CredentialBrokerEnvironmentVariablesApi {
22
22
  #private;
@@ -29,5 +29,5 @@ export declare class CredentialBrokerEnvironmentVariables implements CredentialB
29
29
  * or does not name an environment credential, or with [Error::CredentialReferenceAccountMismatch]
30
30
  * if it belongs to a different account than the authenticated client.
31
31
  */
32
- read(credentialReference: CredentialReference): Promise<EnvironmentCredential>;
32
+ read(credentialReference: string): Promise<EnvironmentCredential>;
33
33
  }
@@ -1,5 +1,5 @@
1
1
  import { InnerClient } from "./core.js";
2
- import { CredentialReference, LoginCredential, LoginDetails } from "./types.js";
2
+ import { LoginCredential, LoginDetails } from "./types.js";
3
3
  /**
4
4
  * Read login credentials from the 1Password Credential Broker.
5
5
  * Accessed as `client.credential_broker.logins` in the generated SDK bindings.
@@ -13,11 +13,11 @@ export interface CredentialBrokerLoginsApi {
13
13
  * or does not name a login credential, or with [Error::CredentialReferenceAccountMismatch]
14
14
  * if it belongs to a different account than the authenticated client.
15
15
  */
16
- read(credentialReference: CredentialReference): Promise<LoginCredential>;
16
+ read(credentialReference: string): Promise<LoginCredential>;
17
17
  /**
18
18
  * Fetch non-secret details for the login identified by `credential_reference`.
19
19
  */
20
- getDetails(credentialReference: CredentialReference): Promise<LoginDetails>;
20
+ getDetails(credentialReference: string): Promise<LoginDetails>;
21
21
  }
22
22
  export declare class CredentialBrokerLogins implements CredentialBrokerLoginsApi {
23
23
  #private;
@@ -30,9 +30,9 @@ export declare class CredentialBrokerLogins implements CredentialBrokerLoginsApi
30
30
  * or does not name a login credential, or with [Error::CredentialReferenceAccountMismatch]
31
31
  * if it belongs to a different account than the authenticated client.
32
32
  */
33
- read(credentialReference: CredentialReference): Promise<LoginCredential>;
33
+ read(credentialReference: string): Promise<LoginCredential>;
34
34
  /**
35
35
  * Fetch non-secret details for the login identified by `credential_reference`.
36
36
  */
37
- getDetails(credentialReference: CredentialReference): Promise<LoginDetails>;
37
+ getDetails(credentialReference: string): Promise<LoginDetails>;
38
38
  }
package/dist/types.d.ts CHANGED
@@ -1,75 +1,53 @@
1
1
  export type ErrorMessage = string;
2
2
  /** The lifecycle state of an access request. */
3
3
  export declare enum AccessRequestState {
4
- /** The request is awaiting a decision. */
4
+ /** The request awaits a decision. */
5
5
  Pending = "pending",
6
- /** The request was approved and credentials were granted. */
6
+ /** The request was approved. */
7
7
  Resolved = "resolved",
8
- /** The request was denied by the user. */
8
+ /** The request was denied. */
9
9
  Denied = "denied",
10
- /** The request could not be processed. */
10
+ /** The request failed. */
11
11
  Failed = "failed"
12
12
  }
13
- /** The credential types an access request entry can ask for. */
13
+ /** Credential types supported by access requests. */
14
14
  export declare enum AccessRequestEntryType {
15
- /** A login credential (username / password / TOTP). */
15
+ /** A login credential. */
16
16
  Login = "login"
17
17
  }
18
- /** Type-specific parameters for a requested credential. */
18
+ /** Type-specific access request parameters. */
19
19
  export interface AccessRequestEntryParameters {
20
20
  /** The website the requester needs to sign in to. */
21
- website?: string;
21
+ website: string;
22
22
  }
23
23
  /** A requested credential within a created access request. */
24
24
  export interface AccessRequestEntry {
25
- /**
26
- * The SDK-minted identifier used to correlate this entry with a
27
- * [`ResolvedAccessRequestEntry`] in the request status.
28
- */
25
+ /** The SDK-minted identifier used to correlate this entry with its result. */
29
26
  id: string;
30
27
  /** The credential type requested. */
31
28
  type: AccessRequestEntryType;
32
29
  /** Type-specific request parameters. */
33
30
  parameters: AccessRequestEntryParameters;
34
- /** Why this specific credential is needed, shown in the consent prompt. */
31
+ /** Why this credential is needed. */
35
32
  reason?: string;
36
- /**
37
- * Soft ranking signal used to order the candidate logins offered to the
38
- * user.
39
- */
33
+ /** A soft ranking signal for matching credentials. */
40
34
  keywords?: string[];
41
35
  }
42
36
  /** A server-managed access request. */
43
37
  export interface AccessRequest {
44
- /**
45
- * The canonical resource path.
46
- * Format: `accounts/{account}/credential-broker-access-requests/{id}`
47
- */
38
+ /** The canonical resource path. */
48
39
  path: string;
49
- /**
50
- * The client-generated identifier of the request. Pass to
51
- * `credentialBroker.accessRequests.getStatus` to poll the request status.
52
- */
40
+ /** The client-generated request identifier. */
53
41
  id: string;
54
- /**
55
- * The canonical AEP resource path of the identity for which
56
- * credential access is requested.
57
- */
42
+ /** The canonical target identity path. */
58
43
  identity: string;
59
44
  /** The current lifecycle state. */
60
45
  state: AccessRequestState;
61
- /** The time the request was created. */
46
+ /** The request creation time. */
62
47
  createdAt: Date;
63
- /**
64
- * What the requester is trying to accomplish, shown to the user above
65
- * the individual entries.
66
- */
48
+ /** What the requester is trying to accomplish. */
67
49
  goal?: string;
68
- /**
69
- * The requested entries as created, each carrying its SDK-minted id.
70
- * Correlate against [`ResolvedAccessRequestEntry::entry_id`] in the
71
- * request status.
72
- */
50
+ /** The requested entries. */
73
51
  entries: AccessRequestEntry[];
74
52
  }
75
53
  /** A single credential need within an access request. */
@@ -78,60 +56,45 @@ export interface AccessRequestEntryCreateParams {
78
56
  type: AccessRequestEntryType;
79
57
  /** Type-specific request parameters. */
80
58
  parameters: AccessRequestEntryParameters;
81
- /** Why this specific credential is needed, shown in the consent prompt. */
59
+ /** Why this credential is needed. */
82
60
  reason?: string;
83
- /**
84
- * Soft ranking signal used to order the candidate logins offered to the
85
- * user.
86
- */
61
+ /** A soft ranking signal for matching credentials. */
87
62
  keywords?: string[];
88
63
  }
89
64
  /** The parameters for creating an access request. */
90
65
  export interface AccessRequestCreateParams {
91
- /**
92
- * What the requester is trying to accomplish, shown to the user above
93
- * the individual entries.
94
- */
66
+ /** What the requester is trying to accomplish. */
95
67
  goal?: string;
96
- /**
97
- * The requested credentials, in presentation order. Must contain
98
- * between 1 and 5 entries.
99
- */
68
+ /** The requested credentials, in presentation order. */
100
69
  entries: AccessRequestEntryCreateParams[];
101
70
  }
102
71
  /**
103
- * A reference to a 1Password Credential Broker configuration.
104
- *
105
- * Passed to a `client.credential_broker.<kind>.read` call to fetch a
106
- * credential. The `reference` string has the form:
107
- *
108
- * ```text
109
- * //api.1password.com/credential-broker/accounts/<account>/capability/<name>/configurations/<id>
110
- * ```
72
+ * A newly created access request plus the app link that opens its approval
73
+ * prompt.
111
74
  */
112
- export interface CredentialReference {
113
- /** The reference path. */
114
- reference: string;
75
+ export interface AccessRequestCreateResponse {
76
+ /** The created access request. */
77
+ accessRequest: AccessRequest;
78
+ /**
79
+ * The `onepassword://` link that opens the approval prompt in the
80
+ * 1Password app.
81
+ */
82
+ appLink: string;
115
83
  }
116
84
  /** A credential granted in response to a requested entry. */
117
85
  export interface ResolvedAccessRequestEntry {
118
- /**
119
- * The requested entry satisfied by this credential, if any. When
120
- * missing, this credential was additionally chosen during
121
- * resolution on top of the requested credentials.
122
- */
86
+ /** The requested entry satisfied by this credential. */
123
87
  entryId?: string;
124
- /**
125
- * The credential-broker reference to fetch the credential with
126
- * (e.g. via `credentialBroker.logins.read`).
127
- */
128
- reference: CredentialReference;
88
+ /** The canonical relative Credential Broker reference. */
89
+ reference: string;
129
90
  }
130
91
  /** The non-sensitive status of an access request. */
131
92
  export interface AccessRequestStatus {
93
+ /** The canonical status resource path supplied by the service. */
94
+ path: string;
132
95
  /** The current lifecycle state. */
133
96
  state: AccessRequestState;
134
- /** The credentials granted when the request is resolved. */
97
+ /** Credentials granted when the request is resolved. */
135
98
  resolved: ResolvedAccessRequestEntry[];
136
99
  }
137
100
  /** Additional attributes for OTP fields. */
@@ -671,27 +634,16 @@ export interface ItemsGetAllResponse {
671
634
  export interface ItemsUpdateAllResponse {
672
635
  individualResponses: Response<Item, ItemUpdateFailureReason>[];
673
636
  }
674
- /**
675
- * A login credential brokered by 1Password.
676
- * Fields are none when the corresponding item field doesn't exist.
677
- *
678
- * Returned by
679
- * [`Logins::read`](crate::client::Logins::read).
680
- */
637
+ /** A login credential brokered by 1Password. */
681
638
  export interface LoginCredential {
682
- /** The login's username. */
639
+ /** The login username. */
683
640
  username?: string;
684
- /** The login's password. */
641
+ /** The login password. */
685
642
  password?: string;
686
- /** Current one-time-password code, if the login has a TOTP field. */
643
+ /** The current one-time-password code. */
687
644
  totp?: string;
688
645
  }
689
- /**
690
- * Non-secret details for a brokered login.
691
- *
692
- * Returned by
693
- * [`Login::get_details`](crate::client::Login::get_details).
694
- */
646
+ /** Non-secret details for a brokered login. */
695
647
  export interface LoginDetails {
696
648
  /** Website URLs associated with the login. */
697
649
  websites: string[];
package/dist/types.js CHANGED
@@ -7,19 +7,19 @@ exports.ReplacerFunc = exports.ReviverFunc = exports.UPDATE_ITEM_HISTORY = expor
7
7
  /** The lifecycle state of an access request. */
8
8
  var AccessRequestState;
9
9
  (function (AccessRequestState) {
10
- /** The request is awaiting a decision. */
10
+ /** The request awaits a decision. */
11
11
  AccessRequestState["Pending"] = "pending";
12
- /** The request was approved and credentials were granted. */
12
+ /** The request was approved. */
13
13
  AccessRequestState["Resolved"] = "resolved";
14
- /** The request was denied by the user. */
14
+ /** The request was denied. */
15
15
  AccessRequestState["Denied"] = "denied";
16
- /** The request could not be processed. */
16
+ /** The request failed. */
17
17
  AccessRequestState["Failed"] = "failed";
18
18
  })(AccessRequestState || (exports.AccessRequestState = AccessRequestState = {}));
19
- /** The credential types an access request entry can ask for. */
19
+ /** Credential types supported by access requests. */
20
20
  var AccessRequestEntryType;
21
21
  (function (AccessRequestEntryType) {
22
- /** A login credential (username / password / TOTP). */
22
+ /** A login credential. */
23
23
  AccessRequestEntryType["Login"] = "login";
24
24
  })(AccessRequestEntryType || (exports.AccessRequestEntryType = AccessRequestEntryType = {}));
25
25
  var GroupType;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "0.0.0-credential-broker-dev-preview";
2
- export declare const SDK_BUILD_NUMBER = "0000000";
1
+ export declare const SDK_VERSION = "0.0.0-credential-broker-dev-preview.1";
2
+ export declare const SDK_BUILD_NUMBER = "0000001";
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.0.0-credential-broker-dev-preview";
5
- exports.SDK_BUILD_NUMBER = "0000000";
6
- const SDK_CORE_VERSION = "0.0.0-credential-broker-dev-preview";
4
+ exports.SDK_VERSION = "0.0.0-credential-broker-dev-preview.1";
5
+ exports.SDK_BUILD_NUMBER = "0000001";
6
+ const SDK_CORE_VERSION = "0.0.0-credential-broker-dev-preview.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1password/sdk",
3
- "version": "0.0.0-credential-broker-dev-preview",
3
+ "version": "0.0.0-credential-broker-dev-preview.1",
4
4
  "description": "DEV PREVIEW — no backwards-compatibility guarantees, not for production use. 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",
@@ -33,7 +33,7 @@
33
33
  "main": "./dist/sdk.js",
34
34
  "types": "./dist/sdk.d.ts",
35
35
  "dependencies": {
36
- "@1password/sdk-core": "0.0.0-credential-broker-dev-preview"
36
+ "@1password/sdk-core": "0.0.0-credential-broker-dev-preview.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@1password/eslint-config": "^4.0.0",