@hyperbrowser/sdk 1.2.0 → 1.2.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.
- package/README.md +70 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +2 -0
- package/dist/error.d.ts +3 -0
- package/dist/error.js +5 -1
- package/dist/sandbox/process.d.ts +65 -3
- package/dist/sandbox/process.js +248 -4
- package/dist/sandbox/secret-references.d.ts +15 -0
- package/dist/sandbox/secret-references.js +56 -0
- package/dist/secrets-envelope.d.ts +25 -0
- package/dist/secrets-envelope.js +124 -0
- package/dist/services/base.js +51 -3
- package/dist/services/sandboxes.d.ts +10 -1
- package/dist/services/sandboxes.js +61 -2
- package/dist/services/secrets.d.ts +39 -0
- package/dist/services/secrets.js +203 -0
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/sandbox.d.ts +42 -0
- package/dist/types/secret.d.ts +67 -0
- package/dist/types/secret.js +2 -0
- package/package.json +1 -1
package/dist/types/sandbox.d.ts
CHANGED
|
@@ -59,12 +59,34 @@ export interface Sandbox {
|
|
|
59
59
|
network?: SandboxNetworkPolicy | null;
|
|
60
60
|
runtime: SandboxRuntimeTarget;
|
|
61
61
|
exposedPorts: SandboxExposeResult[];
|
|
62
|
+
/**
|
|
63
|
+
* Secrets were delivered into the sandbox, or it was restored from a
|
|
64
|
+
* snapshot that may hold them.
|
|
65
|
+
*/
|
|
66
|
+
containsSecrets?: boolean;
|
|
62
67
|
}
|
|
63
68
|
export interface SandboxDetail extends Sandbox {
|
|
64
69
|
token: string | null;
|
|
65
70
|
tokenExpiresAt: string | null;
|
|
66
71
|
}
|
|
67
72
|
export type SandboxVolumeMountType = "rw" | "ro";
|
|
73
|
+
/**
|
|
74
|
+
* A stored secret to deliver as an environment variable: its name, or
|
|
75
|
+
* `{ name, version }` to pin a version. The latest version is used otherwise.
|
|
76
|
+
*/
|
|
77
|
+
export type SandboxSecretReference = string | {
|
|
78
|
+
name: string;
|
|
79
|
+
version?: number | "latest";
|
|
80
|
+
};
|
|
81
|
+
/** Environment variable name to secret, at most 32 per process or sandbox. */
|
|
82
|
+
export type SandboxSecrets = Record<string, SandboxSecretReference>;
|
|
83
|
+
/** The secret version an environment variable received. */
|
|
84
|
+
export interface SandboxResolvedSecret {
|
|
85
|
+
env: string;
|
|
86
|
+
name: string;
|
|
87
|
+
secretId: string;
|
|
88
|
+
version: number;
|
|
89
|
+
}
|
|
68
90
|
export interface SandboxVolumeMount {
|
|
69
91
|
id: string;
|
|
70
92
|
type?: SandboxVolumeMountType;
|
|
@@ -89,6 +111,7 @@ export type CreateSandboxParams = (SandboxCreateCommonParams & {
|
|
|
89
111
|
cpu?: never;
|
|
90
112
|
memoryMiB?: never;
|
|
91
113
|
diskMiB?: never;
|
|
114
|
+
secrets?: never;
|
|
92
115
|
}) | (SandboxCreateCommonParams & {
|
|
93
116
|
snapshotName?: never;
|
|
94
117
|
snapshotId?: never;
|
|
@@ -97,6 +120,12 @@ export type CreateSandboxParams = (SandboxCreateCommonParams & {
|
|
|
97
120
|
cpu?: number;
|
|
98
121
|
memoryMiB?: number;
|
|
99
122
|
diskMiB?: number;
|
|
123
|
+
/**
|
|
124
|
+
* Secrets for the image's startup command only; requires the API key's
|
|
125
|
+
* `secrets.use` scope and is not supported with `runtimeClass:
|
|
126
|
+
* "gvisor-cpu"`. The sandbox is marked as containing secrets.
|
|
127
|
+
*/
|
|
128
|
+
secrets?: SandboxSecrets;
|
|
100
129
|
});
|
|
101
130
|
export interface SandboxListParams {
|
|
102
131
|
status?: SandboxStatus;
|
|
@@ -157,6 +186,8 @@ export interface SandboxSnapshotSummary {
|
|
|
157
186
|
compatibilityTag?: string | null;
|
|
158
187
|
metadata: Record<string, unknown>;
|
|
159
188
|
uploaded: boolean;
|
|
189
|
+
/** The snapshot's memory may hold secrets. */
|
|
190
|
+
containsSecrets?: boolean;
|
|
160
191
|
createdAt: string;
|
|
161
192
|
updatedAt: string;
|
|
162
193
|
}
|
|
@@ -409,6 +440,17 @@ export interface SandboxExecParams {
|
|
|
409
440
|
timeoutMs?: number;
|
|
410
441
|
timeoutSec?: number;
|
|
411
442
|
runAs?: string;
|
|
443
|
+
/**
|
|
444
|
+
* Stored secrets to deliver as environment variables of this process only.
|
|
445
|
+
* The process is started through the control API, which has the sandbox
|
|
446
|
+
* service decrypt them; requires the API key's `secrets.use` scope. Anything
|
|
447
|
+
* running as the same user (or root) in the sandbox can read the process's
|
|
448
|
+
* environment, and the sandbox is marked as containing secrets.
|
|
449
|
+
*
|
|
450
|
+
* Output is read back from the process's retained output rather than the
|
|
451
|
+
* start stream, so `maxOutputBytes` does not apply.
|
|
452
|
+
*/
|
|
453
|
+
secrets?: SandboxSecrets;
|
|
412
454
|
/** @deprecated Ignored for process APIs. */
|
|
413
455
|
useShell?: boolean;
|
|
414
456
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** A secret value: a UTF-8 string or its raw bytes, used byte-for-byte. */
|
|
2
|
+
export type SecretValue = string | Uint8Array;
|
|
3
|
+
export interface SecretsPublicKeyJwk {
|
|
4
|
+
kty: string;
|
|
5
|
+
n: string;
|
|
6
|
+
e: string;
|
|
7
|
+
}
|
|
8
|
+
/** The platform key that secret values are encrypted to before upload. */
|
|
9
|
+
export interface SecretsPublicKey {
|
|
10
|
+
kid: string;
|
|
11
|
+
alg: string;
|
|
12
|
+
enc: string;
|
|
13
|
+
jwk: SecretsPublicKeyJwk;
|
|
14
|
+
}
|
|
15
|
+
export interface Secret {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
/** Bound into every envelope for this secret; the SDK uses it when encrypting. */
|
|
20
|
+
encryptionContext: string;
|
|
21
|
+
/** Null until a value is stored. */
|
|
22
|
+
latestVersion: number | null;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SecretVersion {
|
|
27
|
+
version: number;
|
|
28
|
+
kid: string;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
}
|
|
31
|
+
export interface SecretDetail extends Secret {
|
|
32
|
+
versions: SecretVersion[];
|
|
33
|
+
}
|
|
34
|
+
export interface CreateSecretParams {
|
|
35
|
+
/** 1-128 letters, digits, '_' or '-', starting with a letter or digit. */
|
|
36
|
+
name: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The first version's value. It is validated and the platform key is checked
|
|
40
|
+
* before the secret is created, then encrypted locally and uploaded.
|
|
41
|
+
*/
|
|
42
|
+
value?: SecretValue;
|
|
43
|
+
}
|
|
44
|
+
export interface UpdateSecretParams {
|
|
45
|
+
description: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SecretListParams {
|
|
48
|
+
search?: string;
|
|
49
|
+
page?: number;
|
|
50
|
+
/** At most 100. */
|
|
51
|
+
limit?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface SecretListResponse {
|
|
54
|
+
secrets: Secret[];
|
|
55
|
+
totalCount: number;
|
|
56
|
+
page: number;
|
|
57
|
+
perPage: number;
|
|
58
|
+
}
|
|
59
|
+
export interface SecretDeleteResult {
|
|
60
|
+
deleted: boolean;
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
}
|
|
64
|
+
export interface SecretVersionDeleteResult {
|
|
65
|
+
deleted: boolean;
|
|
66
|
+
version: number;
|
|
67
|
+
}
|