@hyperbrowser/sdk 1.4.0 → 1.5.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 +88 -5
- package/dist/customer-key.d.ts +71 -0
- package/dist/customer-key.js +394 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -1
- package/dist/sandbox/process.d.ts +3 -3
- package/dist/sandbox/process.js +2 -2
- package/dist/sandbox/secret-references.d.ts +25 -3
- package/dist/sandbox/secret-references.js +86 -14
- package/dist/secrets-envelope.d.ts +2 -1
- package/dist/secrets-envelope.js +3 -1
- package/dist/services/credentials.d.ts +5 -1
- package/dist/services/credentials.js +12 -2
- package/dist/services/sandboxes.js +2 -2
- package/dist/services/secrets.d.ts +44 -3
- package/dist/services/secrets.js +164 -11
- package/dist/services/vaults.d.ts +25 -2
- package/dist/services/vaults.js +37 -1
- package/dist/types/constants.d.ts +2 -2
- package/dist/types/credential.d.ts +14 -5
- package/dist/types/index.d.ts +6 -4
- package/dist/types/sandbox.d.ts +31 -15
- package/dist/types/secret.d.ts +80 -0
- package/dist/types/session.d.ts +8 -6
- package/dist/types/vault.d.ts +38 -1
- package/package.json +1 -1
package/dist/services/vaults.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VaultsService = void 0;
|
|
4
|
+
const customer_key_1 = require("../customer-key");
|
|
4
5
|
const error_1 = require("../error");
|
|
5
6
|
const base_1 = require("./base");
|
|
6
7
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -11,7 +12,13 @@ const vaultPath = (id) => `/vaults/${encodeURIComponent(id)}`;
|
|
|
11
12
|
* Vaults name a set of environment variables whose values come from stored
|
|
12
13
|
* secrets. Pass one as `vault` to a sandbox process
|
|
13
14
|
* or sandbox create, or attach it to a browser session with
|
|
14
|
-
* `credentials: [{ vault }]` and fill its entries by name.
|
|
15
|
+
* `credentials: [{ vault }]` and fill its entries by name. A session
|
|
16
|
+
* attaches the vault by reference, so each fill uses its entries as they are
|
|
17
|
+
* then.
|
|
18
|
+
*
|
|
19
|
+
* Entries may be customer-protected secrets. Each sandbox or process use then
|
|
20
|
+
* passes the vault as `unwrap()` returns it, with those entries' envelopes
|
|
21
|
+
* unwrapped with your own key.
|
|
15
22
|
*
|
|
16
23
|
* Methods that take `vault` accept its ID or its exact name. A UUID-shaped
|
|
17
24
|
* argument is tried as an ID first and then as a name.
|
|
@@ -50,6 +57,35 @@ class VaultsService extends base_1.BaseService {
|
|
|
50
57
|
const { id } = await this.resolve(vault);
|
|
51
58
|
return await this.request(vaultPath(id), { method: "DELETE" });
|
|
52
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* The wrapped envelopes of a vault's customer-protected entries, each at
|
|
62
|
+
* the version its entry resolves to now. Most callers want `unwrap()`.
|
|
63
|
+
*/
|
|
64
|
+
async getWrapped(vault) {
|
|
65
|
+
const { id } = await this.resolve(vault);
|
|
66
|
+
return await this.request(`${vaultPath(id)}/wrapped`);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Unwrap a vault's customer-protected entries locally with your own key,
|
|
70
|
+
* giving the reference to pass as a sandbox's or process's `vault`. Each
|
|
71
|
+
* envelope is checked against the digest stored with its version. A vault
|
|
72
|
+
* with no customer-protected entries needs none and can be passed by name.
|
|
73
|
+
*
|
|
74
|
+
* `customerKey` may be several keys; each entry uses the one whose `kid`
|
|
75
|
+
* wrapped it. If an entry changes after this, uses fail with
|
|
76
|
+
* `SECRET_VAULT_CHANGED`: unwrap the vault again.
|
|
77
|
+
*/
|
|
78
|
+
async unwrap(vault, customerKey) {
|
|
79
|
+
const wrapped = await this.getWrapped(vault);
|
|
80
|
+
const unwrapped = {};
|
|
81
|
+
for (const [env, entry] of Object.entries(wrapped.entries ?? {})) {
|
|
82
|
+
unwrapped[env] = {
|
|
83
|
+
version: entry.version,
|
|
84
|
+
unwrapped: await (0, customer_key_1.unwrapVersion)(entry, customerKey, `Entry ${env} of vault ${wrapped.name} (version ${entry.version} of secret ${entry.name})`),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return { name: wrapped.name, unwrapped };
|
|
88
|
+
}
|
|
53
89
|
async resolve(key) {
|
|
54
90
|
if (typeof key !== "string" || !key.trim()) {
|
|
55
91
|
throw (0, error_1.invalidRequest)("A vault ID or name is required");
|
|
@@ -30,7 +30,7 @@ export type BrowserUseLlm = "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini
|
|
|
30
30
|
| "claude-3-5-sonnet-20241022"
|
|
31
31
|
/** @deprecated Retired; the API maps this to "claude-sonnet-5". */
|
|
32
32
|
| "claude-3-5-haiku-20241022" | "gemini-2.0-flash" | "gemini-2.5-flash" | "gemini-3.8-flash";
|
|
33
|
-
export type ClaudeComputerUseLlm = "claude-opus-5-5" | "claude-fable-5-1" | "claude-opus-5" | "claude-opus-4-8" | "claude-opus-4-7" | "claude-opus-4-6" | "claude-opus-4-5" | "claude-sonnet-5-5" | "claude-sonnet-5" | "claude-sonnet-4-6" | "claude-haiku-5-5" | "claude-haiku-4-5-20251001"
|
|
33
|
+
export type ClaudeComputerUseLlm = "claude-opus-5-5" | "claude-fable-5-2" | "claude-fable-5-1" | "claude-opus-5" | "claude-opus-4-8" | "claude-opus-4-7" | "claude-opus-4-6" | "claude-opus-4-5" | "claude-sonnet-5-5" | "claude-sonnet-5" | "claude-sonnet-4-6" | "claude-haiku-5-5" | "claude-haiku-4-5-20251001"
|
|
34
34
|
/** @deprecated Retires November 30, 2026; use "claude-sonnet-5-5". */
|
|
35
35
|
| "claude-sonnet-4-5"
|
|
36
36
|
/** @deprecated Retired; the API maps this to "claude-sonnet-4-6". */
|
|
@@ -42,7 +42,7 @@ export type ClaudeComputerUseLlm = "claude-opus-5-5" | "claude-fable-5-1" | "cla
|
|
|
42
42
|
/** @deprecated Retired legacy ID; the API maps this to "claude-opus-4-8". */
|
|
43
43
|
| "claude-4-opus-20250514";
|
|
44
44
|
export type ClaudeComputerUseReasoningEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
45
|
-
export type CuaLlm = "computer-use-preview" | "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6-sol" | "gpt-6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-5.6-luna" | "gpt-5.5" | "gpt-5.4" | "gpt-5.4-mini";
|
|
45
|
+
export type CuaLlm = "computer-use-preview" | "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | "gpt-6-sol" | "gpt-6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-5.6-luna" | "gpt-5.5" | "gpt-5.4" | "gpt-5.4-mini";
|
|
46
46
|
export type CuaReasoningEffort = "none" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
47
47
|
export type HyperAgentVersion = "0.8.0" | "1.1.0";
|
|
48
48
|
export type HyperAgentLlm = "gpt-6-luna" | "gpt-5.6-luna" | "gpt-5.5" | "gpt-5.2" | "gpt-5.1" | "gpt-5" | "gpt-5-mini" | "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "claude-sonnet-5" | "claude-sonnet-4-6" | "claude-haiku-5-5"
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
import type { SandboxStoredSecretReference } from "./sandbox";
|
|
1
2
|
/** A secret attached to a browser session, which fill may type into its pages. */
|
|
2
3
|
export interface SessionCredential {
|
|
3
4
|
id: string;
|
|
4
5
|
name: string;
|
|
5
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* A vault attached to a browser session by reference: each fill uses its
|
|
9
|
+
* entries as they are at that moment.
|
|
10
|
+
*/
|
|
11
|
+
export interface SessionVault {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
6
15
|
/**
|
|
7
16
|
* What to attach to a browser session at creation: a secret by name (or
|
|
8
|
-
* `{ secret }`), `{ vault }` for
|
|
9
|
-
* `{ onePassword }` for an `op_token` secret
|
|
10
|
-
* fields with.
|
|
17
|
+
* `{ secret }`), `{ vault }` for a vault by reference (each fill reads its
|
|
18
|
+
* entries as they are then), or `{ onePassword }` for an `op_token` secret
|
|
19
|
+
* that fills may read 1Password fields with.
|
|
11
20
|
*/
|
|
12
21
|
export type SessionCredentialSource = string | {
|
|
13
22
|
secret: string;
|
|
@@ -47,8 +56,8 @@ export interface CredentialFillField {
|
|
|
47
56
|
* the request names the origins it may be typed on.
|
|
48
57
|
*/
|
|
49
58
|
export interface CredentialFillOnePassword {
|
|
50
|
-
/** The `op_token` secret attached to the session
|
|
51
|
-
token: string;
|
|
59
|
+
/** The `op_token` secret attached to the session: its name (its latest version is used), or a reference. */
|
|
60
|
+
token: string | SandboxStoredSecretReference;
|
|
52
61
|
/** The 1Password vault's name or ID. */
|
|
53
62
|
vault: string;
|
|
54
63
|
/**
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,11 +12,13 @@ export { StartGrokComputerUseTaskParams, StartGrokComputerUseTaskResponse, GrokC
|
|
|
12
12
|
export { StartMetaComputerUseTaskParams, StartMetaComputerUseTaskResponse, MetaComputerUseTaskStatusResponse, MetaComputerUseTaskResponse, MetaComputerUseTaskData, MetaComputerUseStepResponse, MetaComputerUseStepError, MetaComputerUseStepIncompleteDetails, MetaComputerUseStepReasoning, MetaComputerUseApiKeys, MetaComputerUseTaskMetadata, } from "./agents/meta-computer-use";
|
|
13
13
|
export { StartJevComputerUseTaskParams, StartJevComputerUseTaskResponse, JevComputerUseTaskStatusResponse, JevComputerUseTaskResponse, JevComputerUseTaskData, JevComputerUseStepResponse, JevComputerUseApiKeys, JevComputerUseTaskMetadata, } from "./agents/jev-computer-use";
|
|
14
14
|
export { BasicResponse, BrowserMemorySize, SessionStatus, Session, SessionDetail, SessionGetParams, SessionListParams, SessionListResponse, ScreenConfig, CaptchaEvaluationPageResult, CaptchaEvaluationParams, CaptchaEvaluationResponse, CaptchaEvaluationTarget, CaptchaEvaluationType, CaptchaSolverType, CreateSessionParams, CreateSessionSnapshotResponse, GetSessionDownloadsUrlResponse, GetSessionVideoRecordingUrlResponse, GetSessionRecordingUrlResponse, ImageCaptchaParam, UploadFileResponse, UploadFileOptions, GetActiveSessionsCountResponse, SessionEventLogListParams, SessionEventLogListResponse, SessionEventLog, SessionProfile, SessionLaunchState, SessionWebBotAuth, SessionCreditBreakdown, StartSessionFromSnapshotParams, WebBotAuthParams, ProxyRoute, UpdateSessionProfileParams, UpdateSessionProxyLocationParams, UpdateSessionProxyParams, UpdateSessionScreenParams, UpdateSessionSolveCaptchasParams, UpdateSessionSolveCaptchasResponse, } from "./session";
|
|
15
|
-
export { SandboxStatus, SandboxRuntimeTarget, SandboxNetworkPolicy, SandboxNetworkPolicyPatch, SandboxNetworkUpdateResult, Sandbox, SandboxDetail, SandboxVolumeMountType, SandboxVolumeMount, SandboxSecretReference, SandboxSecrets, SandboxResolvedSecret, SandboxStoredSecretBinding, SandboxOnePasswordBinding, SandboxSecretSource, SandboxOnePassword, SandboxOnePasswordField, SandboxListParams, SandboxListResponse, SandboxImageSource, SandboxImageSummary, SandboxImageListParams, SandboxImageListResponse, SandboxSnapshotStatus, SandboxSnapshotSummary, SandboxSnapshotListParams, SandboxSnapshotListResponse, SandboxSnapshotDeleteResult, SandboxImageDeleteResult, SandboxImageInit, SandboxImageBuildStatus, SandboxImageBuildInputFormat, SandboxImageBuildSourcePlatform, SandboxImageBuildUpload, SandboxImageBuild, SandboxBuildContextBundle, SandboxBuildContextMode, SandboxBuildContextManifest, SandboxDockerImageConfig, SandboxDockerImageLayer, SandboxDockerImageManifest, CreateSandboxImageBuildParams, ReuseSandboxDockerImageParams, CompleteSandboxImageBuildParams, SandboxImageBuildCreateResult, SandboxDockerImageReuseResult, SandboxImageBuildResolutionOutcome, SandboxImageBuildResolution, SandboxImageBuildWaitOptions, BuildSandboxImageFromDockerImageOptions, BuildSandboxImageFromDockerfileOptions, GetOrBuildSandboxImageOptions, SandboxImageBuildListParams, SandboxImageBuildListResponse, CreateSandboxParams, SandboxMemorySnapshotParams, SandboxMemorySnapshotResult, SandboxExposeParams, SandboxExposeResult, SandboxUnexposeResult, SandboxProcessStatus, SandboxExecParams, SandboxExecOptions, SandboxProcessSummary, SandboxProcessResult, SandboxProcessListParams, SandboxProcessListResponse, SandboxProcessWaitParams, SandboxProcessSignal, SandboxProcessStdinParams, SandboxProcessOutputEvent, SandboxProcessExitEvent, SandboxProcessStreamEvent, SandboxFileType, SandboxFileInfo, SandboxFileWriteInfo, SandboxFileListOptions, SandboxFileReadFormat, SandboxFileReadOptions, SandboxFileWriteData, SandboxFileWriteEntry, SandboxFileTextWriteOptions, SandboxFileBytesWriteOptions, SandboxFileMakeDirOptions, SandboxFileCopyParams, SandboxFileChmodParams, SandboxFileChownParams, SandboxFileTransferResult, SandboxFileSystemEventType, SandboxFileSystemEvent, SandboxWatchDirOptions, SandboxPresignFileParams, SandboxPresignedUrl, SandboxTerminalCreateParams, SandboxTerminalOutputChunk, SandboxTerminalStatus, SandboxTerminalWaitParams, SandboxTerminalKillParams, SandboxTerminalEvent, } from "./sandbox";
|
|
15
|
+
export { SandboxStatus, SandboxRuntimeTarget, SandboxNetworkPolicy, SandboxNetworkPolicyPatch, SandboxNetworkUpdateResult, Sandbox, SandboxDetail, SandboxVolumeMountType, SandboxVolumeMount, SandboxSecretReference, SandboxStoredSecretReference, SandboxSecrets, SandboxVaultSource, SandboxResolvedSecret, SandboxStoredSecretBinding, SandboxOnePasswordBinding, SandboxSecretSource, SandboxOnePassword, SandboxOnePasswordField, SandboxListParams, SandboxListResponse, SandboxImageSource, SandboxImageSummary, SandboxImageListParams, SandboxImageListResponse, SandboxSnapshotStatus, SandboxSnapshotSummary, SandboxSnapshotListParams, SandboxSnapshotListResponse, SandboxSnapshotDeleteResult, SandboxImageDeleteResult, SandboxImageInit, SandboxImageBuildStatus, SandboxImageBuildInputFormat, SandboxImageBuildSourcePlatform, SandboxImageBuildUpload, SandboxImageBuild, SandboxBuildContextBundle, SandboxBuildContextMode, SandboxBuildContextManifest, SandboxDockerImageConfig, SandboxDockerImageLayer, SandboxDockerImageManifest, CreateSandboxImageBuildParams, ReuseSandboxDockerImageParams, CompleteSandboxImageBuildParams, SandboxImageBuildCreateResult, SandboxDockerImageReuseResult, SandboxImageBuildResolutionOutcome, SandboxImageBuildResolution, SandboxImageBuildWaitOptions, BuildSandboxImageFromDockerImageOptions, BuildSandboxImageFromDockerfileOptions, GetOrBuildSandboxImageOptions, SandboxImageBuildListParams, SandboxImageBuildListResponse, CreateSandboxParams, SandboxMemorySnapshotParams, SandboxMemorySnapshotResult, SandboxExposeParams, SandboxExposeResult, SandboxUnexposeResult, SandboxProcessStatus, SandboxExecParams, SandboxExecOptions, SandboxProcessSummary, SandboxProcessResult, SandboxProcessListParams, SandboxProcessListResponse, SandboxProcessWaitParams, SandboxProcessSignal, SandboxProcessStdinParams, SandboxProcessOutputEvent, SandboxProcessExitEvent, SandboxProcessStreamEvent, SandboxFileType, SandboxFileInfo, SandboxFileWriteInfo, SandboxFileListOptions, SandboxFileReadFormat, SandboxFileReadOptions, SandboxFileWriteData, SandboxFileWriteEntry, SandboxFileTextWriteOptions, SandboxFileBytesWriteOptions, SandboxFileMakeDirOptions, SandboxFileCopyParams, SandboxFileChmodParams, SandboxFileChownParams, SandboxFileTransferResult, SandboxFileSystemEventType, SandboxFileSystemEvent, SandboxWatchDirOptions, SandboxPresignFileParams, SandboxPresignedUrl, SandboxTerminalCreateParams, SandboxTerminalOutputChunk, SandboxTerminalStatus, SandboxTerminalWaitParams, SandboxTerminalKillParams, SandboxTerminalEvent, } from "./sandbox";
|
|
16
16
|
export { CreateVolumeParams, Volume, VolumeListParams, VolumeListResponse, VolumeDeleteResult, } from "./volume";
|
|
17
|
-
export { SecretValue, SecretType, SecretBrowserMetadata, SecretMetadata, UpdateSecretMetadata, SecretsPublicKey, SecretsPublicKeyJwk, Secret, SecretVersion, SecretDetail, CreateSecretParams, UpdateSecretParams, SecretListParams, SecretListResponse, SecretDeleteResult, SecretVersionDeleteResult, } from "./secret";
|
|
18
|
-
export { SessionCredential, SessionCredentialSource,
|
|
19
|
-
export {
|
|
17
|
+
export { SecretValue, SecretType, SecretProtection, SecretBrowserMetadata, SecretMetadata, UpdateSecretMetadata, SecretsPublicKey, SecretsPublicKeyJwk, Secret, SecretVersion, SecretDetail, CreateSecretParams, UpdateSecretParams, SecretListParams, SecretListResponse, SecretDeleteResult, SecretVersionDeleteResult, WrappedSecretVersion, UnwrappedSecretReference, UnwrapSecretOptions, AddSecretVersionOptions, ReplaceSecretVersionWrappingParams, RewrapSecretParams, } from "./secret";
|
|
18
|
+
export { SessionCredential, SessionCredentialSource, SessionVault } from "./credential";
|
|
19
|
+
export type { CustomerKey, CustomerKeyAlgorithm, CustomerKeyInput, CustomerKeyOptions, } from "../customer-key";
|
|
20
|
+
export { CredentialFillField, CredentialFillRef, CredentialFillOnePassword, FillCredentialParams, CredentialFillOutcome, CredentialFillFieldResult, CredentialFillResult, CredentialFillPage, } from "./credential";
|
|
21
|
+
export { Vault, VaultEntry, VaultEntryParams, CreateVaultParams, UpdateVaultParams, VaultListParams, VaultListResponse, VaultDeleteResult, WrappedVault, WrappedVaultEntry, VaultUnwrappedEntry, VaultReference, } from "./vault";
|
|
20
22
|
export { CreateProfileParams, ForkProfileParams, ProfileResponse, CreateProfileResponse, ProfileListParams, ProfileListResponse, } from "./profile";
|
|
21
23
|
export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
|
|
22
24
|
export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ClaudeComputerUseLlm, ClaudeComputerUseReasoningEffort, CuaLlm, CuaReasoningEffort, GeminiComputerUseLlm, GeminiComputerUseReasoningEffort, GrokComputerUseLlm, GrokReasoningEffort, MetaComputerUseLlm, MetaReasoningEffort, JevComputerUseLlm, JevTextLlm, ScrapeScreenshotFormat, ScrapeJobStatus, CrawlJobStatus, Country, State, ISO639_1, OperatingSystem, Platform, ScrapeFormat, ScrapeWaitUntil, ScrapePageStatus, CrawlPageStatus, RecordingStatus, DownloadsStatus, HyperAgentLlm, HyperAgentTaskStatus, ClaudeComputerUseTaskStatus, CuaTaskStatus, GeminiComputerUseTaskStatus, GrokComputerUseTaskStatus, MetaComputerUseTaskStatus, JevComputerUseTaskStatus, SessionEventLogType, SessionRegion, BrowserUseVersion, HyperAgentVersion, } from "./constants";
|
package/dist/types/sandbox.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Blob } from "buffer";
|
|
|
2
2
|
import type { ReadableStream } from "node:stream/web";
|
|
3
3
|
import { SessionRegion } from "./constants";
|
|
4
4
|
import { SessionLaunchState, SessionStatus } from "./session";
|
|
5
|
+
import type { VaultReference } from "./vault";
|
|
5
6
|
export type SandboxStatus = SessionStatus;
|
|
6
7
|
export interface SandboxNetworkPolicy {
|
|
7
8
|
allowInternetAccess?: boolean | null;
|
|
@@ -73,23 +74,38 @@ export interface SandboxDetail extends Sandbox {
|
|
|
73
74
|
}
|
|
74
75
|
export type SandboxVolumeMountType = "rw" | "ro";
|
|
75
76
|
/**
|
|
76
|
-
* A stored secret
|
|
77
|
-
*
|
|
77
|
+
* A stored secret by name, optionally pinned to a version. A
|
|
78
|
+
* customer-protected secret also carries `unwrapped`, the envelope the
|
|
79
|
+
* customer unwrapped, and must pin the version it came from;
|
|
80
|
+
* `secrets.unwrap()` returns one ready to pass.
|
|
78
81
|
*/
|
|
79
|
-
export
|
|
82
|
+
export interface SandboxStoredSecretReference {
|
|
80
83
|
name: string;
|
|
81
84
|
version?: number | "latest";
|
|
82
|
-
|
|
85
|
+
/** Customer-protected secrets only: the version's unwrapped inner envelope. */
|
|
86
|
+
unwrapped?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A stored secret to deliver as an environment variable: its name, or
|
|
90
|
+
* `{ name, version }` to pin a version. The latest version is used otherwise.
|
|
91
|
+
*/
|
|
92
|
+
export type SandboxSecretReference = string | SandboxStoredSecretReference;
|
|
83
93
|
/** Environment variable name to secret, at most 32 per process or sandbox. */
|
|
84
94
|
export type SandboxSecrets = Record<string, SandboxSecretReference>;
|
|
95
|
+
/**
|
|
96
|
+
* A vault whose entries become environment variables: its name, or, when it
|
|
97
|
+
* has customer-protected entries, the `VaultReference` from
|
|
98
|
+
* `vaults.unwrap()` with their unwrapped envelopes.
|
|
99
|
+
*/
|
|
100
|
+
export type SandboxVaultSource = string | VaultReference;
|
|
85
101
|
/**
|
|
86
102
|
* Fields of one 1Password vault to deliver as environment variables, read
|
|
87
103
|
* with a service account token kept as an `op_token` secret when the process
|
|
88
104
|
* starts. Nothing about it is stored.
|
|
89
105
|
*/
|
|
90
106
|
export interface SandboxOnePassword {
|
|
91
|
-
/** The
|
|
92
|
-
token: string;
|
|
107
|
+
/** The `op_token` secret: its name (its latest version is used), or a reference. */
|
|
108
|
+
token: string | SandboxStoredSecretReference;
|
|
93
109
|
/** The 1Password vault's name or ID. */
|
|
94
110
|
vault: string;
|
|
95
111
|
/**
|
|
@@ -193,11 +209,11 @@ export type CreateSandboxParams = (SandboxCreateCommonParams & {
|
|
|
193
209
|
*/
|
|
194
210
|
secrets?: SandboxSecrets;
|
|
195
211
|
/**
|
|
196
|
-
* A vault
|
|
197
|
-
*
|
|
198
|
-
*
|
|
212
|
+
* A vault whose entries become the startup command's environment
|
|
213
|
+
* variables; `secrets` is merged over it and wins on a clash. Same
|
|
214
|
+
* requirements as `secrets`.
|
|
199
215
|
*/
|
|
200
|
-
vault?:
|
|
216
|
+
vault?: SandboxVaultSource;
|
|
201
217
|
/** 1Password fields for the startup command. Same requirements as `secrets`. */
|
|
202
218
|
onePassword?: SandboxOnePassword;
|
|
203
219
|
});
|
|
@@ -526,12 +542,12 @@ export interface SandboxExecParams {
|
|
|
526
542
|
*/
|
|
527
543
|
secrets?: SandboxSecrets;
|
|
528
544
|
/**
|
|
529
|
-
* A vault
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
*
|
|
545
|
+
* A vault whose entries become environment variables of this process,
|
|
546
|
+
* delivered like `secrets`. `secrets` is merged over it and wins on a
|
|
547
|
+
* clash; `env` can't set a variable either of them sets. Together they hold
|
|
548
|
+
* at most 32 variables.
|
|
533
549
|
*/
|
|
534
|
-
vault?:
|
|
550
|
+
vault?: SandboxVaultSource;
|
|
535
551
|
/**
|
|
536
552
|
* Fields of a 1Password vault, read with an `op_token` secret when the
|
|
537
553
|
* process starts and delivered like `secrets`. A variable set here can't
|
package/dist/types/secret.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import type { CustomerKey } from "../customer-key";
|
|
1
2
|
/** A secret value: a UTF-8 string or its raw bytes, used byte-for-byte. */
|
|
2
3
|
export type SecretValue = string | Uint8Array;
|
|
4
|
+
/**
|
|
5
|
+
* Fixed at creation. `"customer"` secrets are also wrapped with your own
|
|
6
|
+
* `CustomerKey`, and each use passes what `secrets.unwrap()` or
|
|
7
|
+
* `vaults.unwrap()` returns; they can't be filled into browser pages.
|
|
8
|
+
*/
|
|
9
|
+
export type SecretProtection = "platform" | "customer";
|
|
3
10
|
/**
|
|
4
11
|
* What a secret's value is, fixed at creation:
|
|
5
12
|
* - `"secret"`: an opaque value. It can be a sandbox environment variable,
|
|
@@ -45,6 +52,11 @@ export interface Secret {
|
|
|
45
52
|
*/
|
|
46
53
|
type: string;
|
|
47
54
|
metadata: SecretMetadata;
|
|
55
|
+
/**
|
|
56
|
+
* A `SecretProtection`, typed as a string for values added later. Absent
|
|
57
|
+
* from API versions before customer protection, which means `"platform"`.
|
|
58
|
+
*/
|
|
59
|
+
protection?: string;
|
|
48
60
|
/** Bound into every envelope for this secret; the SDK uses it when encrypting. */
|
|
49
61
|
encryptionContext: string;
|
|
50
62
|
/** Null until a value is stored. */
|
|
@@ -54,9 +66,67 @@ export interface Secret {
|
|
|
54
66
|
}
|
|
55
67
|
export interface SecretVersion {
|
|
56
68
|
version: number;
|
|
69
|
+
/** The platform key the (inner) envelope was encrypted to. */
|
|
57
70
|
kid: string;
|
|
71
|
+
/** The customer key that wrapped this version; customer-protected secrets only. */
|
|
72
|
+
outerKid?: string;
|
|
73
|
+
/**
|
|
74
|
+
* When this version stops working because its platform key is retired.
|
|
75
|
+
* After then, uses fail with `SECRET_KEY_RETIRED`; add a new version and use
|
|
76
|
+
* that instead.
|
|
77
|
+
*/
|
|
78
|
+
retiresAt?: string | null;
|
|
58
79
|
createdAt: string;
|
|
59
80
|
}
|
|
81
|
+
/** A customer-protected version as the API stores it, for the customer to unwrap. */
|
|
82
|
+
export interface WrappedSecretVersion {
|
|
83
|
+
version: number;
|
|
84
|
+
/** The platform key the inner envelope is encrypted to. */
|
|
85
|
+
kid: string;
|
|
86
|
+
retiresAt: string | null;
|
|
87
|
+
/** The customer key that wrapped it. */
|
|
88
|
+
outerKid: string;
|
|
89
|
+
/** Unpadded base64url SHA-256 of the inner envelope. */
|
|
90
|
+
innerDigest: string;
|
|
91
|
+
/** The outer envelope, which only the customer key can open. */
|
|
92
|
+
envelope: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A customer-protected secret ready to use: pass it as a sandbox or process
|
|
96
|
+
* `secrets` entry, or as a 1Password `token`. It is the version's inner
|
|
97
|
+
* envelope, which only the platform can open, but anyone holding it can use
|
|
98
|
+
* that version, so treat it like the secret itself.
|
|
99
|
+
*/
|
|
100
|
+
export interface UnwrappedSecretReference {
|
|
101
|
+
name: string;
|
|
102
|
+
version: number;
|
|
103
|
+
unwrapped: string;
|
|
104
|
+
}
|
|
105
|
+
export interface UnwrapSecretOptions {
|
|
106
|
+
/** Defaults to the latest version. */
|
|
107
|
+
version?: number | "latest";
|
|
108
|
+
}
|
|
109
|
+
export interface AddSecretVersionOptions {
|
|
110
|
+
/** Required for customer-protected secrets, which it wraps the value with; not allowed otherwise. */
|
|
111
|
+
customerKey?: CustomerKey;
|
|
112
|
+
}
|
|
113
|
+
/** A new outer envelope for a version, wrapping the same inner envelope. */
|
|
114
|
+
export interface ReplaceSecretVersionWrappingParams {
|
|
115
|
+
envelope: string;
|
|
116
|
+
/** Must match the version's `innerDigest`: rewrapping can't change the value. */
|
|
117
|
+
innerDigest: string;
|
|
118
|
+
}
|
|
119
|
+
export interface RewrapSecretParams {
|
|
120
|
+
/** The key (or keys, picked by `kid`) the versions are wrapped with now. */
|
|
121
|
+
from: CustomerKey | readonly CustomerKey[];
|
|
122
|
+
/** The key to wrap them with instead. */
|
|
123
|
+
to: CustomerKey;
|
|
124
|
+
/**
|
|
125
|
+
* Versions to rewrap. Defaults to every version not already wrapped with
|
|
126
|
+
* `to`, so an interrupted rotation can be run again.
|
|
127
|
+
*/
|
|
128
|
+
versions?: number[];
|
|
129
|
+
}
|
|
60
130
|
export interface SecretDetail extends Secret {
|
|
61
131
|
versions: SecretVersion[];
|
|
62
132
|
}
|
|
@@ -87,6 +157,16 @@ export interface CreateSecretParams {
|
|
|
87
157
|
* `["https://github.com"]`; 1-20 entries. Not for `"op_token"` secrets.
|
|
88
158
|
*/
|
|
89
159
|
allowedOrigins?: string[];
|
|
160
|
+
/**
|
|
161
|
+
* Defaults to `"customer"` when `customerKey` is given and `"platform"`
|
|
162
|
+
* otherwise. Fixed at creation.
|
|
163
|
+
*/
|
|
164
|
+
protection?: SecretProtection;
|
|
165
|
+
/**
|
|
166
|
+
* The customer's own key, which wraps every version of a
|
|
167
|
+
* customer-protected secret. Required to store `value` in one.
|
|
168
|
+
*/
|
|
169
|
+
customerKey?: CustomerKey;
|
|
90
170
|
}
|
|
91
171
|
/**
|
|
92
172
|
* Metadata members sent replace the stored ones, `null` removes a member, and
|
package/dist/types/session.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import { Country, DownloadsStatus, ISO639_1, OperatingSystem, Platform, RecordingStatus, SessionEventLogType, SessionRegion, State } from "./constants";
|
|
3
|
-
import { SessionCredential, SessionCredentialSource } from "./credential";
|
|
3
|
+
import { SessionCredential, SessionCredentialSource, SessionVault } from "./credential";
|
|
4
4
|
export type SessionStatus = "active" | "closed" | "close-error" | "error";
|
|
5
5
|
export type BrowserMemorySize = "small" | "medium" | "large";
|
|
6
6
|
export interface BasicResponse {
|
|
@@ -76,6 +76,8 @@ export interface SessionDetail extends Session {
|
|
|
76
76
|
token: string;
|
|
77
77
|
/** The secrets attached at creation, when any were requested. */
|
|
78
78
|
credentials?: SessionCredential[];
|
|
79
|
+
/** The vaults attached at creation, by reference, when credentials were requested. */
|
|
80
|
+
vaults?: SessionVault[];
|
|
79
81
|
}
|
|
80
82
|
export interface SessionGetParams {
|
|
81
83
|
liveViewTtlSeconds?: number;
|
|
@@ -230,13 +232,13 @@ export interface CreateSessionParams {
|
|
|
230
232
|
startFromSnapshot?: StartSessionFromSnapshotParams;
|
|
231
233
|
/**
|
|
232
234
|
* Secrets that `sessions.credentials.fill` may type into pages, at most 20:
|
|
233
|
-
* a secret's name (or `{ secret: name }`), `{ vault: name }` for
|
|
234
|
-
*
|
|
235
|
+
* a secret's name (or `{ secret: name }`), `{ vault: name }` for a vault
|
|
236
|
+
* by reference, whose entries each fill reads as they are then, or
|
|
235
237
|
* `{ onePassword: name }` for an `op_token` secret whose 1Password fields
|
|
236
238
|
* fills may read.
|
|
237
|
-
* Secrets need allowed origins to be filled
|
|
238
|
-
*
|
|
239
|
-
* off.
|
|
239
|
+
* Secrets need allowed origins to be filled, and customer-protected ones
|
|
240
|
+
* can't be filled. They can only be attached at creation; the session runs
|
|
241
|
+
* on Firecracker with Chrome's password manager off.
|
|
240
242
|
*/
|
|
241
243
|
credentials?: SessionCredentialSource[];
|
|
242
244
|
}
|
package/dist/types/vault.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WrappedSecretVersion } from "./secret";
|
|
1
2
|
/** An entry of a vault: a stored secret. */
|
|
2
3
|
export interface VaultEntry {
|
|
3
4
|
/** The secret's name. */
|
|
@@ -5,6 +6,39 @@ export interface VaultEntry {
|
|
|
5
6
|
secretId: string;
|
|
6
7
|
/** A pinned version, or null to follow the secret's latest version. */
|
|
7
8
|
version: number | null;
|
|
9
|
+
/**
|
|
10
|
+
* The secret's `SecretProtection`. With `"customer"`, each use of the vault
|
|
11
|
+
* passes this entry's unwrapped envelope (see `vaults.unwrap()`). Absent
|
|
12
|
+
* from API versions before customer protection.
|
|
13
|
+
*/
|
|
14
|
+
protection?: string;
|
|
15
|
+
}
|
|
16
|
+
/** A customer-protected entry's wrapped envelope, at the version the entry resolves to now. */
|
|
17
|
+
export interface WrappedVaultEntry extends WrappedSecretVersion {
|
|
18
|
+
/** The secret's name. */
|
|
19
|
+
name: string;
|
|
20
|
+
secretId: string;
|
|
21
|
+
}
|
|
22
|
+
export interface WrappedVault {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
/** Customer-protected entries only, by environment variable. */
|
|
26
|
+
entries: Record<string, WrappedVaultEntry>;
|
|
27
|
+
}
|
|
28
|
+
/** The envelope the customer unwrapped for one entry, and the version it is from. */
|
|
29
|
+
export interface VaultUnwrappedEntry {
|
|
30
|
+
version: number;
|
|
31
|
+
unwrapped: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A vault with its customer-protected entries unwrapped, as `vaults.unwrap()`
|
|
35
|
+
* returns it, for a sandbox's or process's `vault`. Anyone holding it can use
|
|
36
|
+
* those versions.
|
|
37
|
+
*/
|
|
38
|
+
export interface VaultReference {
|
|
39
|
+
name: string;
|
|
40
|
+
/** Environment variable name to unwrapped envelope; at most 32. */
|
|
41
|
+
unwrapped: Record<string, VaultUnwrappedEntry>;
|
|
8
42
|
}
|
|
9
43
|
/** Named environment variables whose values come from stored secrets. A vault holds no values itself. */
|
|
10
44
|
export interface Vault {
|
|
@@ -16,7 +50,10 @@ export interface Vault {
|
|
|
16
50
|
createdAt: string;
|
|
17
51
|
updatedAt: string;
|
|
18
52
|
}
|
|
19
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* A stored secret, following its latest version unless one is pinned. It may
|
|
55
|
+
* be customer-protected; entries never hold unwrapped envelopes.
|
|
56
|
+
*/
|
|
20
57
|
export interface VaultEntryParams {
|
|
21
58
|
/** The secret's name. */
|
|
22
59
|
name: string;
|