@getstackrun/sdk 4.0.0 → 4.4.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.
Files changed (240) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +326 -10
  3. package/dist/agent-auth.d.ts.map +1 -1
  4. package/dist/agent-auth.js +3 -4
  5. package/dist/agent-auth.js.map +1 -1
  6. package/dist/browser-bootstrap.js +1 -1
  7. package/dist/browser-bootstrap.js.map +1 -1
  8. package/dist/client.d.ts +86 -1
  9. package/dist/client.d.ts.map +1 -1
  10. package/dist/client.js +235 -40
  11. package/dist/client.js.map +1 -1
  12. package/dist/control-socket-server.d.ts +134 -0
  13. package/dist/control-socket-server.d.ts.map +1 -0
  14. package/dist/control-socket-server.js +108 -0
  15. package/dist/control-socket-server.js.map +1 -0
  16. package/dist/credentials-file.d.ts +7 -0
  17. package/dist/credentials-file.d.ts.map +1 -1
  18. package/dist/credentials-file.js +57 -2
  19. package/dist/credentials-file.js.map +1 -1
  20. package/dist/errors.d.ts +316 -0
  21. package/dist/errors.d.ts.map +1 -1
  22. package/dist/errors.js +572 -0
  23. package/dist/errors.js.map +1 -1
  24. package/dist/index.d.ts +126 -24
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +150 -22
  27. package/dist/index.js.map +1 -1
  28. package/dist/network-install-key.d.ts +56 -0
  29. package/dist/network-install-key.d.ts.map +1 -0
  30. package/dist/network-install-key.js +92 -0
  31. package/dist/network-install-key.js.map +1 -0
  32. package/dist/network-install.d.ts +134 -0
  33. package/dist/network-install.d.ts.map +1 -0
  34. package/dist/network-install.js +70 -0
  35. package/dist/network-install.js.map +1 -0
  36. package/dist/service-mcp.d.ts +49 -0
  37. package/dist/service-mcp.d.ts.map +1 -0
  38. package/dist/service-mcp.js +122 -0
  39. package/dist/service-mcp.js.map +1 -0
  40. package/dist/services/accounts.d.ts +1548 -0
  41. package/dist/services/accounts.d.ts.map +1 -0
  42. package/dist/services/accounts.js +724 -0
  43. package/dist/services/accounts.js.map +1 -0
  44. package/dist/services/agent-identity.d.ts +58 -0
  45. package/dist/services/agent-identity.d.ts.map +1 -0
  46. package/dist/services/agent-identity.js +50 -0
  47. package/dist/services/agent-identity.js.map +1 -0
  48. package/dist/services/agents.d.ts +78 -3
  49. package/dist/services/agents.d.ts.map +1 -1
  50. package/dist/services/agents.js +29 -2
  51. package/dist/services/agents.js.map +1 -1
  52. package/dist/services/audit.d.ts +5 -0
  53. package/dist/services/audit.d.ts.map +1 -1
  54. package/dist/services/audit.js +5 -0
  55. package/dist/services/audit.js.map +1 -1
  56. package/dist/services/billing.d.ts +67 -0
  57. package/dist/services/billing.d.ts.map +1 -0
  58. package/dist/services/billing.js +42 -0
  59. package/dist/services/billing.js.map +1 -0
  60. package/dist/services/brain.d.ts +122 -0
  61. package/dist/services/brain.d.ts.map +1 -0
  62. package/dist/services/brain.js +40 -0
  63. package/dist/services/brain.js.map +1 -0
  64. package/dist/services/calendar.d.ts +256 -0
  65. package/dist/services/calendar.d.ts.map +1 -0
  66. package/dist/services/calendar.js +75 -0
  67. package/dist/services/calendar.js.map +1 -0
  68. package/dist/services/catalogue.d.ts +185 -0
  69. package/dist/services/catalogue.d.ts.map +1 -0
  70. package/dist/services/catalogue.js +31 -0
  71. package/dist/services/catalogue.js.map +1 -0
  72. package/dist/services/chat-channels.d.ts +82 -0
  73. package/dist/services/chat-channels.d.ts.map +1 -0
  74. package/dist/services/chat-channels.js +42 -0
  75. package/dist/services/chat-channels.js.map +1 -0
  76. package/dist/services/control-policies.d.ts +409 -0
  77. package/dist/services/control-policies.d.ts.map +1 -0
  78. package/dist/services/control-policies.js +101 -0
  79. package/dist/services/control-policies.js.map +1 -0
  80. package/dist/services/control-socket.d.ts +201 -0
  81. package/dist/services/control-socket.d.ts.map +1 -0
  82. package/dist/services/control-socket.js +165 -0
  83. package/dist/services/control-socket.js.map +1 -0
  84. package/dist/services/credentials.d.ts +2 -1
  85. package/dist/services/credentials.d.ts.map +1 -1
  86. package/dist/services/credentials.js +3 -2
  87. package/dist/services/credentials.js.map +1 -1
  88. package/dist/services/detector-config.d.ts +13 -12
  89. package/dist/services/detector-config.d.ts.map +1 -1
  90. package/dist/services/detector-config.js +13 -12
  91. package/dist/services/detector-config.js.map +1 -1
  92. package/dist/services/drive.d.ts +257 -0
  93. package/dist/services/drive.d.ts.map +1 -0
  94. package/dist/services/drive.js +167 -0
  95. package/dist/services/drive.js.map +1 -0
  96. package/dist/services/dropoffs.d.ts +5 -1
  97. package/dist/services/dropoffs.d.ts.map +1 -1
  98. package/dist/services/dropoffs.js +3 -1
  99. package/dist/services/dropoffs.js.map +1 -1
  100. package/dist/services/evidence-packs.d.ts +4 -2
  101. package/dist/services/evidence-packs.d.ts.map +1 -1
  102. package/dist/services/evidence-packs.js +4 -2
  103. package/dist/services/evidence-packs.js.map +1 -1
  104. package/dist/services/flagged-content.d.ts +30 -0
  105. package/dist/services/flagged-content.d.ts.map +1 -0
  106. package/dist/services/flagged-content.js +24 -0
  107. package/dist/services/flagged-content.js.map +1 -0
  108. package/dist/services/governance.d.ts +69 -0
  109. package/dist/services/governance.d.ts.map +1 -0
  110. package/dist/services/governance.js +39 -0
  111. package/dist/services/governance.js.map +1 -0
  112. package/dist/services/identity.d.ts +44 -4
  113. package/dist/services/identity.d.ts.map +1 -1
  114. package/dist/services/identity.js +54 -6
  115. package/dist/services/identity.js.map +1 -1
  116. package/dist/services/inbound-webhooks.d.ts +12 -1
  117. package/dist/services/inbound-webhooks.d.ts.map +1 -1
  118. package/dist/services/inbound-webhooks.js +7 -0
  119. package/dist/services/inbound-webhooks.js.map +1 -1
  120. package/dist/services/intents.d.ts +8 -2
  121. package/dist/services/intents.d.ts.map +1 -1
  122. package/dist/services/intents.js +7 -3
  123. package/dist/services/intents.js.map +1 -1
  124. package/dist/services/llm.d.ts +73 -1
  125. package/dist/services/llm.d.ts.map +1 -1
  126. package/dist/services/llm.js +62 -0
  127. package/dist/services/llm.js.map +1 -1
  128. package/dist/services/making.d.ts +263 -0
  129. package/dist/services/making.d.ts.map +1 -0
  130. package/dist/services/making.js +114 -0
  131. package/dist/services/making.js.map +1 -0
  132. package/dist/services/meetings.d.ts +183 -0
  133. package/dist/services/meetings.d.ts.map +1 -0
  134. package/dist/services/meetings.js +148 -0
  135. package/dist/services/meetings.js.map +1 -0
  136. package/dist/services/memory.d.ts +288 -0
  137. package/dist/services/memory.d.ts.map +1 -0
  138. package/dist/services/memory.js +116 -0
  139. package/dist/services/memory.js.map +1 -0
  140. package/dist/services/message-access.d.ts +50 -0
  141. package/dist/services/message-access.d.ts.map +1 -0
  142. package/dist/services/message-access.js +36 -0
  143. package/dist/services/message-access.js.map +1 -0
  144. package/dist/services/missions.d.ts +93 -7
  145. package/dist/services/missions.d.ts.map +1 -1
  146. package/dist/services/missions.js +29 -1
  147. package/dist/services/missions.js.map +1 -1
  148. package/dist/services/network.d.ts +266 -0
  149. package/dist/services/network.d.ts.map +1 -0
  150. package/dist/services/network.js +209 -0
  151. package/dist/services/network.js.map +1 -0
  152. package/dist/services/partner-accounts.d.ts +215 -0
  153. package/dist/services/partner-accounts.d.ts.map +1 -0
  154. package/dist/services/partner-accounts.js +133 -0
  155. package/dist/services/partner-accounts.js.map +1 -0
  156. package/dist/services/passports.d.ts +3 -2
  157. package/dist/services/passports.d.ts.map +1 -1
  158. package/dist/services/passports.js +3 -2
  159. package/dist/services/passports.js.map +1 -1
  160. package/dist/services/payments.d.ts +126 -0
  161. package/dist/services/payments.d.ts.map +1 -0
  162. package/dist/services/payments.js +66 -0
  163. package/dist/services/payments.js.map +1 -0
  164. package/dist/services/pii-config.d.ts +7 -17
  165. package/dist/services/pii-config.d.ts.map +1 -1
  166. package/dist/services/pii-config.js +9 -19
  167. package/dist/services/pii-config.js.map +1 -1
  168. package/dist/services/post.d.ts +240 -0
  169. package/dist/services/post.d.ts.map +1 -0
  170. package/dist/services/post.js +99 -0
  171. package/dist/services/post.js.map +1 -0
  172. package/dist/services/proxy.d.ts +20 -2
  173. package/dist/services/proxy.d.ts.map +1 -1
  174. package/dist/services/proxy.js +31 -1
  175. package/dist/services/proxy.js.map +1 -1
  176. package/dist/services/rentahuman.d.ts +92 -0
  177. package/dist/services/rentahuman.d.ts.map +1 -0
  178. package/dist/services/rentahuman.js +53 -0
  179. package/dist/services/rentahuman.js.map +1 -0
  180. package/dist/services/scan.d.ts +1 -1
  181. package/dist/services/scan.d.ts.map +1 -1
  182. package/dist/services/scan.js +1 -1
  183. package/dist/services/scan.js.map +1 -1
  184. package/dist/services/services.d.ts +28 -2
  185. package/dist/services/services.d.ts.map +1 -1
  186. package/dist/services/services.js +49 -1
  187. package/dist/services/services.js.map +1 -1
  188. package/dist/services/team.d.ts +13 -1
  189. package/dist/services/team.d.ts.map +1 -1
  190. package/dist/services/team.js +12 -0
  191. package/dist/services/team.js.map +1 -1
  192. package/dist/services/trust.d.ts +39 -0
  193. package/dist/services/trust.d.ts.map +1 -0
  194. package/dist/services/trust.js +35 -0
  195. package/dist/services/trust.js.map +1 -0
  196. package/dist/services/usage.d.ts +1 -1
  197. package/dist/services/usage.js +1 -1
  198. package/dist/services/wake.d.ts +257 -0
  199. package/dist/services/wake.d.ts.map +1 -0
  200. package/dist/services/wake.js +80 -0
  201. package/dist/services/wake.js.map +1 -0
  202. package/dist/services/website.d.ts +188 -0
  203. package/dist/services/website.d.ts.map +1 -0
  204. package/dist/services/website.js +135 -0
  205. package/dist/services/website.js.map +1 -0
  206. package/dist/types.d.ts +259 -25
  207. package/dist/types.d.ts.map +1 -1
  208. package/dist/verify-agent-identity.d.ts +73 -0
  209. package/dist/verify-agent-identity.d.ts.map +1 -0
  210. package/dist/verify-agent-identity.js +106 -0
  211. package/dist/verify-agent-identity.js.map +1 -0
  212. package/dist/verify-network.d.ts +159 -0
  213. package/dist/verify-network.d.ts.map +1 -0
  214. package/dist/verify-network.js +153 -0
  215. package/dist/verify-network.js.map +1 -0
  216. package/dist/wake-webhook.d.ts +57 -0
  217. package/dist/wake-webhook.d.ts.map +1 -0
  218. package/dist/wake-webhook.js +60 -0
  219. package/dist/wake-webhook.js.map +1 -0
  220. package/dist/wallet-key.d.ts +30 -0
  221. package/dist/wallet-key.d.ts.map +1 -0
  222. package/dist/wallet-key.js +108 -0
  223. package/dist/wallet-key.js.map +1 -0
  224. package/dist/webhook.d.ts +63 -0
  225. package/dist/webhook.d.ts.map +1 -0
  226. package/dist/webhook.js +136 -0
  227. package/dist/webhook.js.map +1 -0
  228. package/dist/x402-pay.d.ts +139 -0
  229. package/dist/x402-pay.d.ts.map +1 -0
  230. package/dist/x402-pay.js +235 -0
  231. package/dist/x402-pay.js.map +1 -0
  232. package/package.json +2 -1
  233. package/dist/services/partner-connect.d.ts +0 -64
  234. package/dist/services/partner-connect.d.ts.map +0 -1
  235. package/dist/services/partner-connect.js +0 -42
  236. package/dist/services/partner-connect.js.map +0 -1
  237. package/dist/services/partner-tenants.d.ts +0 -126
  238. package/dist/services/partner-tenants.d.ts.map +0 -1
  239. package/dist/services/partner-tenants.js +0 -79
  240. package/dist/services/partner-tenants.js.map +0 -1
@@ -0,0 +1,266 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import { InstallKey, type InstallPublicJwk } from '../network-install-key.js';
3
+ import { type NetworkKeySource, type RevocationList } from '../verify-network.js';
4
+ export type NetworkRevocationKind = 'passport' | 'agent' | 'key' | 'install';
5
+ export type NetworkRevocationReason = 'unspecified' | 'key_compromise' | 'agent_decommissioned' | 'superseded' | 'policy_violation' | 'owner_request';
6
+ export interface NetworkInstallKey {
7
+ id: string;
8
+ /** The key's thumbprint: its id in the network. */
9
+ kid: string;
10
+ status: 'active' | 'revoked';
11
+ /** When a rolled-over key stops working; null for the newest. */
12
+ valid_until: string | null;
13
+ /** True when the key can sign a request right now. */
14
+ usable: boolean;
15
+ created_at: string;
16
+ revoked_at: string | null;
17
+ revoked_reason: string | null;
18
+ public_jwk: InstallPublicJwk;
19
+ }
20
+ export interface NetworkInstall {
21
+ id: string;
22
+ name: string;
23
+ status: 'active' | 'revoked';
24
+ created_at: string;
25
+ revoked_at: string | null;
26
+ keys: NetworkInstallKey[];
27
+ }
28
+ export interface NetworkKeyChallenge {
29
+ nonce: string;
30
+ expires_at: string;
31
+ audience: 'stack:network';
32
+ install: string;
33
+ }
34
+ export interface NetworkRevocation {
35
+ id: string;
36
+ seq: number;
37
+ kind: NetworkRevocationKind;
38
+ subject: string;
39
+ /** The install the subject belongs to: every revocation names one. */
40
+ install: string;
41
+ reason: NetworkRevocationReason;
42
+ by: 'install' | 'owner' | 'stack';
43
+ at: string;
44
+ }
45
+ export interface PublishNetworkRevocationInput {
46
+ kind: NetworkRevocationKind;
47
+ /** passport: its digest; agent: its id; key: its thumbprint; install: its id. */
48
+ subject: string;
49
+ /**
50
+ * The install the subject belongs to: required for every kind. An install is itself, a key is one of its keys,
51
+ * a passport digest is one STACK countersigned for it, and an agent is a name STACK countersigned for it; anything else is `NOT_FOUND`.
52
+ */
53
+ install: string;
54
+ reason?: NetworkRevocationReason;
55
+ }
56
+ export interface NetworkSubscription {
57
+ id: string;
58
+ url: string;
59
+ /** The installs followed, or null for every revocation. */
60
+ installs: string[] | null;
61
+ status: 'active' | 'failing' | 'paused';
62
+ last_delivered_seq: number;
63
+ last_error: string | null;
64
+ /** False for a subscription made before deliveries were signed: rotate its secret to start signing them. */
65
+ signed: boolean;
66
+ created_at: string;
67
+ }
68
+ /** A new subscription: the signing secret is returned once, here. An OAuth sign-in gets `null` and a note. */
69
+ export interface CreatedNetworkSubscription extends NetworkSubscription {
70
+ signing_secret: string | null;
71
+ signing_secret_note?: string;
72
+ }
73
+ export interface NetworkSubscriptionSecretRotation {
74
+ /** The new secret, returned once. */
75
+ signing_secret: string;
76
+ /** The previous secret keeps signing beside the new one until then (null when there was none). */
77
+ previous_valid_until: string | null;
78
+ }
79
+ export interface CreateNetworkSubscriptionInput {
80
+ /** Where STACK posts each new revocation: https, publicly reachable. */
81
+ url: string;
82
+ /** Follow only these installs. */
83
+ installs?: string[];
84
+ }
85
+ /** A licence key your account revoked. The key itself is never kept or returned. */
86
+ export interface NetworkLicenceRevocation {
87
+ /** The key's id: what the network checks on every request. */
88
+ jti: string;
89
+ customer: string;
90
+ reason: NetworkRevocationReason;
91
+ /** When the key would have expired; the entry is dropped some time after. */
92
+ expires_at: string;
93
+ revoked_at: string;
94
+ }
95
+ export interface NetworkVerifyResult {
96
+ valid: boolean;
97
+ /** Why not, as short codes, when `valid` is false. */
98
+ reasons: string[];
99
+ checked_at: string;
100
+ install: string | null;
101
+ owner: string | null;
102
+ passport_digest: string | null;
103
+ countersignature_expires_at: string | null;
104
+ revoked: {
105
+ kind: string;
106
+ at: string;
107
+ reason: string;
108
+ } | null;
109
+ }
110
+ export interface NetworkVerifiedStatus {
111
+ status: 'live' | 'expired' | 'revoked';
112
+ /** A compact JWS signed by STACK; check it with `verifyVerifiedStatement`. */
113
+ statement: string;
114
+ }
115
+ export interface NetworkGovernedOptions {
116
+ /** The approval id from `GovernanceApprovalRequiredError`, once a person approved it. Call again with the same input. */
117
+ governanceApprovalId?: string;
118
+ }
119
+ /** Your installs and their keys. */
120
+ export declare class NetworkInstallsService {
121
+ private readonly client;
122
+ constructor(client: HttpClient);
123
+ /** Register an install. It can sign nothing until it has a key. */
124
+ register(name: string): Promise<NetworkInstall>;
125
+ list(): Promise<NetworkInstall[]>;
126
+ get(id: string): Promise<NetworkInstall>;
127
+ /**
128
+ * Ask for the challenge the install signs with the key it is registering. A
129
+ * governance action: see the note at the top of this file. The challenge is
130
+ * single use and good for five minutes.
131
+ */
132
+ requestKeyChallenge(id: string, options?: NetworkGovernedOptions): Promise<NetworkKeyChallenge>;
133
+ /**
134
+ * Register a key from its challenge answer (`InstallKey.signKeyProof`). The
135
+ * install's other keys keep working for `rolloverSeconds` (24 hours when omitted,
136
+ * at most 7 days, 0 for none), then stop; at most three keys are live at once.
137
+ */
138
+ addKey(id: string, input: {
139
+ publicJwk: InstallPublicJwk;
140
+ proof: string;
141
+ rolloverSeconds?: number;
142
+ }): Promise<NetworkInstall>;
143
+ /**
144
+ * Register a key end to end: ask for a challenge, answer it with the key and
145
+ * register it. The challenge is the governance step; pass the approval id on the
146
+ * second call, as for `requestKeyChallenge`.
147
+ */
148
+ registerKey(id: string, key: InstallKey, options?: NetworkGovernedOptions & {
149
+ rolloverSeconds?: number;
150
+ }): Promise<NetworkInstall>;
151
+ /** Stop one key at once and publish it. Every countersignature made under it stops being live. Never needs approval. */
152
+ revokeKey(id: string, keyId: string, reason?: NetworkRevocationReason): Promise<NetworkInstall>;
153
+ /** Stop an install and all its keys at once and publish it. Never needs approval. */
154
+ revoke(id: string, reason?: NetworkRevocationReason): Promise<NetworkInstall>;
155
+ }
156
+ /** Counterparty subscriptions: where STACK posts each new revocation. */
157
+ export declare class NetworkSubscriptionsService {
158
+ private readonly client;
159
+ constructor(client: HttpClient);
160
+ /**
161
+ * STACK posts `{ "type": "stack.network.revocations", "list": "<signed list>" }` to
162
+ * the address, in order and at least once. The list is signed with STACK's key:
163
+ * check it with `verifyRevocationList`. The request is signed as a Standard Webhooks
164
+ * message with the `signing_secret` this call returns once: check it with
165
+ * `verifyWebhook`, which refuses a forged or stale request.
166
+ */
167
+ create(input: CreateNetworkSubscriptionInput): Promise<CreatedNetworkSubscription>;
168
+ list(): Promise<NetworkSubscription[]>;
169
+ delete(id: string): Promise<void>;
170
+ /**
171
+ * A fresh signing secret, returned once, for an API key or a dashboard session. The one it
172
+ * replaces keeps signing beside it for 24 hours, so the receiver can switch without a gap.
173
+ */
174
+ rotateSecret(id: string): Promise<NetworkSubscriptionSecretRotation>;
175
+ /** Put a paused or failing subscription back to work; it is sent what it missed. */
176
+ resume(id: string): Promise<NetworkSubscription>;
177
+ }
178
+ /**
179
+ * The licence keys STACK issued to your account. A key is accepted by the network
180
+ * as your account's credential for live detection rules and the hosted
181
+ * classifier, so one that leaks costs you money until it expires: revoke it here.
182
+ */
183
+ export declare class NetworkLicencesService {
184
+ private readonly client;
185
+ constructor(client: HttpClient);
186
+ /**
187
+ * Revoke a licence key before it expires. The key is the proof it is yours: its
188
+ * claims, signed by STACK, name your account and carry the key's id. From the
189
+ * next call the network refuses it, on every machine. Revoking a key again
190
+ * returns the first revocation. A key that is not yours, that STACK did not
191
+ * sign or that carries no id answers `LICENCE_NOT_REVOCABLE` (400). An owner or
192
+ * admin decision, never available to an agent; never needs approval, never charged.
193
+ */
194
+ revoke(licenceKey: string, reason?: NetworkRevocationReason): Promise<NetworkLicenceRevocation>;
195
+ /** The keys your account revoked, newest first. */
196
+ list(): Promise<NetworkLicenceRevocation[]>;
197
+ }
198
+ /**
199
+ * The STACK network.
200
+ *
201
+ * @example
202
+ * ```ts
203
+ * const install = await stack.network.installs.register('office');
204
+ * const key = await InstallKey.generate();
205
+ * await stack.network.installs.registerKey(install.id, key); // a person approves the key in a browser
206
+ * const verdict = await stack.network.verify({ countersignature, passport });
207
+ * ```
208
+ */
209
+ export declare class NetworkService {
210
+ private readonly client;
211
+ readonly installs: NetworkInstallsService;
212
+ readonly subscriptions: NetworkSubscriptionsService;
213
+ readonly licences: NetworkLicencesService;
214
+ constructor(client: HttpClient);
215
+ /** Publish a revocation of something that is yours. Never metered. */
216
+ publishRevocation(input: PublishNetworkRevocationInput): Promise<NetworkRevocation>;
217
+ /** STACK's public keys, current and retired, for checking every signed object of the network. */
218
+ jwks(): Promise<{
219
+ keys: import('jose').JWK[];
220
+ }>;
221
+ /**
222
+ * The signed list of revocations after a cursor, as STACK serves it. Check it
223
+ * with `verifyRevocationList` or use `revocations`, which does.
224
+ */
225
+ signedRevocations(query?: {
226
+ after?: number;
227
+ limit?: number;
228
+ install?: string;
229
+ }): Promise<{
230
+ list: string;
231
+ }>;
232
+ /**
233
+ * The revocations after a cursor, with the list's signature checked against
234
+ * STACK's published keys (or the keys you pin with `keys`). Resume from
235
+ * `resumeFrom`.
236
+ */
237
+ revocations(query?: {
238
+ after?: number;
239
+ limit?: number;
240
+ install?: string;
241
+ keys?: NetworkKeySource;
242
+ now?: Date;
243
+ }): Promise<RevocationList>;
244
+ /**
245
+ * Check a countersignature now, revocation included: STACK's signature, whether
246
+ * the key, install, agent or passport was revoked, and with `passport` that it
247
+ * is the passport the countersignature covers and the install signed it.
248
+ */
249
+ verify(input: {
250
+ countersignature: string;
251
+ passport?: string;
252
+ }): Promise<NetworkVerifyResult>;
253
+ /**
254
+ * The signed "STACK-verified" statement for a passport (by its digest) or for an
255
+ * install's agent: a five-minute snapshot of whether it is countersigned and live.
256
+ * Rejects with a 404 when STACK never countersigned it. Check the statement with
257
+ * `verifyVerifiedStatement`.
258
+ */
259
+ verified(query: {
260
+ passportDigest: string;
261
+ } | {
262
+ install: string;
263
+ agent: string;
264
+ }): Promise<NetworkVerifiedStatus>;
265
+ }
266
+ //# sourceMappingURL=network.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/services/network.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAwB,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAiBxG,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;AAC7E,MAAM,MAAM,uBAAuB,GAC/B,aAAa,GACb,gBAAgB,GAChB,sBAAsB,GACtB,YAAY,GACZ,kBAAkB,GAClB,eAAe,CAAC;AAEpB,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,iEAAiE;IACjE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,sDAAsD;IACtD,MAAM,EAAE,OAAO,CAAC;I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AAI,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,MAAM,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC;IAIrD;;;OAGG;IACG,iBAAiB,CAAC,KAAK,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAUpH;;;;OAIG;IACG,WAAW,CAAC,KAAK,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC;QAAC,GAAG,CAAC,EAAE,IAAI,CAAA;KAAO,GAAG,OAAO,CAAC,cAAc,CAAC;IAKjJ;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAIlG;;;;;OAKG;IACG,QAAQ,CAAC,KAAK,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAOvH"}
@@ -0,0 +1,209 @@
1
+ import { verifyRevocationList } from '../verify-network.js';
2
+ const seg = encodeURIComponent;
3
+ function governed(options) {
4
+ return options?.governanceApprovalId ? { headers: { 'X-Governance-Approval': options.governanceApprovalId } } : undefined;
5
+ }
6
+ /** Your installs and their keys. */
7
+ export class NetworkInstallsService {
8
+ client;
9
+ constructor(client) {
10
+ this.client = client;
11
+ }
12
+ /** Register an install. It can sign nothing until it has a key. */
13
+ async register(name) {
14
+ return this.client.post('/v1/network/installs', { name });
15
+ }
16
+ async list() {
17
+ return (await this.client.get('/v1/network/installs')).installs;
18
+ }
19
+ async get(id) {
20
+ return this.client.get(`/v1/network/installs/${seg(id)}`);
21
+ }
22
+ /**
23
+ * Ask for the challenge the install signs with the key it is registering. A
24
+ * governance action: see the note at the top of this file. The challenge is
25
+ * single use and good for five minutes.
26
+ */
27
+ async requestKeyChallenge(id, options) {
28
+ return this.client.post(`/v1/network/installs/${seg(id)}/key-challenges`, {}, governed(options));
29
+ }
30
+ /**
31
+ * Register a key from its challenge answer (`InstallKey.signKeyProof`). The
32
+ * install's other keys keep working for `rolloverSeconds` (24 hours when omitted,
33
+ * at most 7 days, 0 for none), then stop; at most three keys are live at once.
34
+ */
35
+ async addKey(id, input) {
36
+ return this.client.post(`/v1/network/installs/${seg(id)}/keys`, {
37
+ public_jwk: input.publicJwk,
38
+ proof: input.proof,
39
+ ...(input.rolloverSeconds !== undefined ? { rollover_seconds: input.rolloverSeconds } : {}),
40
+ });
41
+ }
42
+ /**
43
+ * Register a key end to end: ask for a challenge, answer it with the key and
44
+ * register it. The challenge is the governance step; pass the approval id on the
45
+ * second call, as for `requestKeyChallenge`.
46
+ */
47
+ async registerKey(id, key, options = {}) {
48
+ const challenge = await this.requestKeyChallenge(id, options);
49
+ return this.addKey(id, {
50
+ publicJwk: key.publicJwk,
51
+ proof: await key.signKeyProof(id, challenge.nonce),
52
+ ...(options.rolloverSeconds !== undefined ? { rolloverSeconds: options.rolloverSeconds } : {}),
53
+ });
54
+ }
55
+ /** Stop one key at once and publish it. Every countersignature made under it stops being live. Never needs approval. */
56
+ async revokeKey(id, keyId, reason) {
57
+ return this.client.post(`/v1/network/installs/${seg(id)}/keys/${seg(keyId)}/revoke`, reason ? { reason } : {});
58
+ }
59
+ /** Stop an install and all its keys at once and publish it. Never needs approval. */
60
+ async revoke(id, reason) {
61
+ return this.client.post(`/v1/network/installs/${seg(id)}/revoke`, reason ? { reason } : {});
62
+ }
63
+ }
64
+ /** Counterparty subscriptions: where STACK posts each new revocation. */
65
+ export class NetworkSubscriptionsService {
66
+ client;
67
+ constructor(client) {
68
+ this.client = client;
69
+ }
70
+ /**
71
+ * STACK posts `{ "type": "stack.network.revocations", "list": "<signed list>" }` to
72
+ * the address, in order and at least once. The list is signed with STACK's key:
73
+ * check it with `verifyRevocationList`. The request is signed as a Standard Webhooks
74
+ * message with the `signing_secret` this call returns once: check it with
75
+ * `verifyWebhook`, which refuses a forged or stale request.
76
+ */
77
+ async create(input) {
78
+ return this.client.post('/v1/network/subscriptions', {
79
+ url: input.url,
80
+ ...(input.installs ? { installs: input.installs } : {}),
81
+ });
82
+ }
83
+ async list() {
84
+ return (await this.client.get('/v1/network/subscriptions')).subscriptions;
85
+ }
86
+ async delete(id) {
87
+ await this.client.delete(`/v1/network/subscriptions/${seg(id)}`);
88
+ }
89
+ /**
90
+ * A fresh signing secret, returned once, for an API key or a dashboard session. The one it
91
+ * replaces keeps signing beside it for 24 hours, so the receiver can switch without a gap.
92
+ */
93
+ async rotateSecret(id) {
94
+ return this.client.post(`/v1/network/subscriptions/${seg(id)}/rotate-secret`, {});
95
+ }
96
+ /** Put a paused or failing subscription back to work; it is sent what it missed. */
97
+ async resume(id) {
98
+ return this.client.post(`/v1/network/subscriptions/${seg(id)}/resume`, {});
99
+ }
100
+ }
101
+ /**
102
+ * The licence keys STACK issued to your account. A key is accepted by the network
103
+ * as your account's credential for live detection rules and the hosted
104
+ * classifier, so one that leaks costs you money until it expires: revoke it here.
105
+ */
106
+ export class NetworkLicencesService {
107
+ client;
108
+ constructor(client) {
109
+ this.client = client;
110
+ }
111
+ /**
112
+ * Revoke a licence key before it expires. The key is the proof it is yours: its
113
+ * claims, signed by STACK, name your account and carry the key's id. From the
114
+ * next call the network refuses it, on every machine. Revoking a key again
115
+ * returns the first revocation. A key that is not yours, that STACK did not
116
+ * sign or that carries no id answers `LICENCE_NOT_REVOCABLE` (400). An owner or
117
+ * admin decision, never available to an agent; never needs approval, never charged.
118
+ */
119
+ async revoke(licenceKey, reason) {
120
+ return this.client.post('/v1/network/licences/revoke', {
121
+ licence_key: licenceKey,
122
+ ...(reason ? { reason } : {}),
123
+ });
124
+ }
125
+ /** The keys your account revoked, newest first. */
126
+ async list() {
127
+ return (await this.client.get('/v1/network/licences/revoked')).revoked;
128
+ }
129
+ }
130
+ /**
131
+ * The STACK network.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * const install = await stack.network.installs.register('office');
136
+ * const key = await InstallKey.generate();
137
+ * await stack.network.installs.registerKey(install.id, key); // a person approves the key in a browser
138
+ * const verdict = await stack.network.verify({ countersignature, passport });
139
+ * ```
140
+ */
141
+ export class NetworkService {
142
+ client;
143
+ installs;
144
+ subscriptions;
145
+ licences;
146
+ constructor(client) {
147
+ this.client = client;
148
+ this.installs = new NetworkInstallsService(client);
149
+ this.subscriptions = new NetworkSubscriptionsService(client);
150
+ this.licences = new NetworkLicencesService(client);
151
+ }
152
+ /** Publish a revocation of something that is yours. Never metered. */
153
+ async publishRevocation(input) {
154
+ return this.client.post('/v1/network/revocations', {
155
+ kind: input.kind,
156
+ subject: input.subject,
157
+ install: input.install,
158
+ ...(input.reason ? { reason: input.reason } : {}),
159
+ });
160
+ }
161
+ /** STACK's public keys, current and retired, for checking every signed object of the network. */
162
+ async jwks() {
163
+ return this.client.publicRequest('GET', '/v1/network/jwks.json');
164
+ }
165
+ /**
166
+ * The signed list of revocations after a cursor, as STACK serves it. Check it
167
+ * with `verifyRevocationList` or use `revocations`, which does.
168
+ */
169
+ async signedRevocations(query = {}) {
170
+ return this.client.publicRequest('GET', '/v1/network/revocations', {
171
+ query: {
172
+ after: query.after !== undefined ? String(query.after) : undefined,
173
+ limit: query.limit !== undefined ? String(query.limit) : undefined,
174
+ install: query.install,
175
+ },
176
+ });
177
+ }
178
+ /**
179
+ * The revocations after a cursor, with the list's signature checked against
180
+ * STACK's published keys (or the keys you pin with `keys`). Resume from
181
+ * `resumeFrom`.
182
+ */
183
+ async revocations(query = {}) {
184
+ const { list } = await this.signedRevocations(query);
185
+ return verifyRevocationList(list, { ...(query.keys ?? { jwks: await this.jwks() }), ...(query.now ? { now: query.now } : {}) });
186
+ }
187
+ /**
188
+ * Check a countersignature now, revocation included: STACK's signature, whether
189
+ * the key, install, agent or passport was revoked, and with `passport` that it
190
+ * is the passport the countersignature covers and the install signed it.
191
+ */
192
+ async verify(input) {
193
+ return this.client.publicRequest('POST', '/v1/network/verify', { body: input });
194
+ }
195
+ /**
196
+ * The signed "STACK-verified" statement for a passport (by its digest) or for an
197
+ * install's agent: a five-minute snapshot of whether it is countersigned and live.
198
+ * Rejects with a 404 when STACK never countersigned it. Check the statement with
199
+ * `verifyVerifiedStatement`.
200
+ */
201
+ async verified(query) {
202
+ return this.client.publicRequest('GET', '/v1/network/verified', {
203
+ query: 'passportDigest' in query
204
+ ? { passport_digest: query.passportDigest }
205
+ : { install: query.install, agent: query.agent },
206
+ });
207
+ }
208
+ }
209
+ //# sourceMappingURL=network.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/services/network.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAA8C,MAAM,sBAAsB,CAAC;AAoJxG,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAE/B,SAAS,QAAQ,CAAC,OAAgC;IAChD,OAAO,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,uBAAuB,EAAE,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5H,CAAC;AAED,oCAAoC;AACpC,MAAM,OAAO,sBAAsB;IACJ;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD,mEAAmE;IACnE,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAiB,sBAAsB,EAAE,EAAE,IAAI,EAAE,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