@proof-holdings/sdk 0.0.0-stage → 1.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.
Files changed (253) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/LICENSE +21 -0
  3. package/README.md +239 -2
  4. package/dist/cjs/client.d.ts +48 -0
  5. package/dist/cjs/client.d.ts.map +1 -0
  6. package/dist/cjs/client.js +73 -0
  7. package/dist/cjs/client.js.map +1 -0
  8. package/dist/cjs/credentials.d.ts +46 -0
  9. package/dist/cjs/credentials.d.ts.map +1 -0
  10. package/dist/cjs/credentials.js +137 -0
  11. package/dist/cjs/credentials.js.map +1 -0
  12. package/dist/cjs/crypto/hitl-crypto.d.ts +95 -0
  13. package/dist/cjs/crypto/hitl-crypto.d.ts.map +1 -0
  14. package/dist/cjs/crypto/hitl-crypto.js +338 -0
  15. package/dist/cjs/crypto/hitl-crypto.js.map +1 -0
  16. package/dist/cjs/errors.d.ts +52 -0
  17. package/dist/cjs/errors.d.ts.map +1 -0
  18. package/dist/cjs/errors.js +121 -0
  19. package/dist/cjs/errors.js.map +1 -0
  20. package/dist/cjs/http.d.ts +62 -0
  21. package/dist/cjs/http.d.ts.map +1 -0
  22. package/dist/cjs/http.js +192 -0
  23. package/dist/cjs/http.js.map +1 -0
  24. package/dist/cjs/index.d.ts +26 -0
  25. package/dist/cjs/index.d.ts.map +1 -0
  26. package/dist/cjs/index.js +79 -0
  27. package/dist/cjs/index.js.map +1 -0
  28. package/dist/cjs/jwks/key-set-cache.d.ts +105 -0
  29. package/dist/cjs/jwks/key-set-cache.d.ts.map +1 -0
  30. package/dist/cjs/jwks/key-set-cache.js +277 -0
  31. package/dist/cjs/jwks/key-set-cache.js.map +1 -0
  32. package/dist/cjs/jwks/keyset.d.ts +139 -0
  33. package/dist/cjs/jwks/keyset.d.ts.map +1 -0
  34. package/dist/cjs/jwks/keyset.js +503 -0
  35. package/dist/cjs/jwks/keyset.js.map +1 -0
  36. package/dist/cjs/jwks/support.d.ts +9 -0
  37. package/dist/cjs/jwks/support.d.ts.map +1 -0
  38. package/dist/cjs/jwks/support.js +12 -0
  39. package/dist/cjs/jwks/support.js.map +1 -0
  40. package/dist/cjs/polling.d.ts +10 -0
  41. package/dist/cjs/polling.d.ts.map +1 -0
  42. package/dist/cjs/polling.js +74 -0
  43. package/dist/cjs/polling.js.map +1 -0
  44. package/dist/cjs/resources/auth-sessions.d.ts +41 -0
  45. package/dist/cjs/resources/auth-sessions.d.ts.map +1 -0
  46. package/dist/cjs/resources/auth-sessions.js +34 -0
  47. package/dist/cjs/resources/auth-sessions.js.map +1 -0
  48. package/dist/cjs/resources/authorizations.d.ts +23 -0
  49. package/dist/cjs/resources/authorizations.d.ts.map +1 -0
  50. package/dist/cjs/resources/authorizations.js +29 -0
  51. package/dist/cjs/resources/authorizations.js.map +1 -0
  52. package/dist/cjs/resources/circles.d.ts +38 -0
  53. package/dist/cjs/resources/circles.d.ts.map +1 -0
  54. package/dist/cjs/resources/circles.js +67 -0
  55. package/dist/cjs/resources/circles.js.map +1 -0
  56. package/dist/cjs/resources/confirmations.d.ts +111 -0
  57. package/dist/cjs/resources/confirmations.d.ts.map +1 -0
  58. package/dist/cjs/resources/confirmations.js +86 -0
  59. package/dist/cjs/resources/confirmations.js.map +1 -0
  60. package/dist/cjs/resources/delegations.d.ts +36 -0
  61. package/dist/cjs/resources/delegations.d.ts.map +1 -0
  62. package/dist/cjs/resources/delegations.js +47 -0
  63. package/dist/cjs/resources/delegations.js.map +1 -0
  64. package/dist/cjs/resources/hitl-chat-id.d.ts +42 -0
  65. package/dist/cjs/resources/hitl-chat-id.d.ts.map +1 -0
  66. package/dist/cjs/resources/hitl-chat-id.js +37 -0
  67. package/dist/cjs/resources/hitl-chat-id.js.map +1 -0
  68. package/dist/cjs/resources/hitl-keys.d.ts +13 -0
  69. package/dist/cjs/resources/hitl-keys.d.ts.map +1 -0
  70. package/dist/cjs/resources/hitl-keys.js +22 -0
  71. package/dist/cjs/resources/hitl-keys.js.map +1 -0
  72. package/dist/cjs/resources/hitl.d.ts +39 -0
  73. package/dist/cjs/resources/hitl.d.ts.map +1 -0
  74. package/dist/cjs/resources/hitl.js +58 -0
  75. package/dist/cjs/resources/hitl.js.map +1 -0
  76. package/dist/cjs/resources/me.d.ts +102 -0
  77. package/dist/cjs/resources/me.d.ts.map +1 -0
  78. package/dist/cjs/resources/me.js +85 -0
  79. package/dist/cjs/resources/me.js.map +1 -0
  80. package/dist/cjs/resources/profiles.d.ts +47 -0
  81. package/dist/cjs/resources/profiles.d.ts.map +1 -0
  82. package/dist/cjs/resources/profiles.js +70 -0
  83. package/dist/cjs/resources/profiles.js.map +1 -0
  84. package/dist/cjs/resources/proof-me.d.ts +48 -0
  85. package/dist/cjs/resources/proof-me.d.ts.map +1 -0
  86. package/dist/cjs/resources/proof-me.js +24 -0
  87. package/dist/cjs/resources/proof-me.js.map +1 -0
  88. package/dist/cjs/resources/proofs.d.ts +81 -0
  89. package/dist/cjs/resources/proofs.d.ts.map +1 -0
  90. package/dist/cjs/resources/proofs.js +437 -0
  91. package/dist/cjs/resources/proofs.js.map +1 -0
  92. package/dist/cjs/resources/public-profiles.d.ts +36 -0
  93. package/dist/cjs/resources/public-profiles.d.ts.map +1 -0
  94. package/dist/cjs/resources/public-profiles.js +49 -0
  95. package/dist/cjs/resources/public-profiles.js.map +1 -0
  96. package/dist/cjs/resources/sessions.d.ts +15 -0
  97. package/dist/cjs/resources/sessions.d.ts.map +1 -0
  98. package/dist/cjs/resources/sessions.js +26 -0
  99. package/dist/cjs/resources/sessions.js.map +1 -0
  100. package/dist/cjs/resources/templates.d.ts +25 -0
  101. package/dist/cjs/resources/templates.d.ts.map +1 -0
  102. package/dist/cjs/resources/templates.js +46 -0
  103. package/dist/cjs/resources/templates.js.map +1 -0
  104. package/dist/cjs/resources/verification-requests.d.ts +56 -0
  105. package/dist/cjs/resources/verification-requests.d.ts.map +1 -0
  106. package/dist/cjs/resources/verification-requests.js +61 -0
  107. package/dist/cjs/resources/verification-requests.js.map +1 -0
  108. package/dist/cjs/resources/verifications.d.ts +60 -0
  109. package/dist/cjs/resources/verifications.d.ts.map +1 -0
  110. package/dist/cjs/resources/verifications.js +91 -0
  111. package/dist/cjs/resources/verifications.js.map +1 -0
  112. package/dist/cjs/resources/webhook-deliveries.d.ts +15 -0
  113. package/dist/cjs/resources/webhook-deliveries.d.ts.map +1 -0
  114. package/dist/cjs/resources/webhook-deliveries.js +26 -0
  115. package/dist/cjs/resources/webhook-deliveries.js.map +1 -0
  116. package/dist/cjs/streaming.d.ts +87 -0
  117. package/dist/cjs/streaming.d.ts.map +1 -0
  118. package/dist/cjs/streaming.js +289 -0
  119. package/dist/cjs/streaming.js.map +1 -0
  120. package/dist/cjs/types.d.ts +1483 -0
  121. package/dist/cjs/types.d.ts.map +1 -0
  122. package/dist/cjs/types.js +6 -0
  123. package/dist/cjs/types.js.map +1 -0
  124. package/dist/cjs/version.d.ts +2 -0
  125. package/dist/cjs/version.d.ts.map +1 -0
  126. package/dist/cjs/version.js +5 -0
  127. package/dist/cjs/version.js.map +1 -0
  128. package/dist/esm/client.d.ts +48 -0
  129. package/dist/esm/client.d.ts.map +1 -0
  130. package/dist/esm/client.js +69 -0
  131. package/dist/esm/client.js.map +1 -0
  132. package/dist/esm/credentials.d.ts +46 -0
  133. package/dist/esm/credentials.d.ts.map +1 -0
  134. package/dist/esm/credentials.js +127 -0
  135. package/dist/esm/credentials.js.map +1 -0
  136. package/dist/esm/crypto/hitl-crypto.d.ts +95 -0
  137. package/dist/esm/crypto/hitl-crypto.d.ts.map +1 -0
  138. package/dist/esm/crypto/hitl-crypto.js +321 -0
  139. package/dist/esm/crypto/hitl-crypto.js.map +1 -0
  140. package/dist/esm/errors.d.ts +52 -0
  141. package/dist/esm/errors.d.ts.map +1 -0
  142. package/dist/esm/errors.js +106 -0
  143. package/dist/esm/errors.js.map +1 -0
  144. package/dist/esm/http.d.ts +62 -0
  145. package/dist/esm/http.d.ts.map +1 -0
  146. package/dist/esm/http.js +187 -0
  147. package/dist/esm/http.js.map +1 -0
  148. package/dist/esm/index.d.ts +26 -0
  149. package/dist/esm/index.d.ts.map +1 -0
  150. package/dist/esm/index.js +33 -0
  151. package/dist/esm/index.js.map +1 -0
  152. package/dist/esm/jwks/key-set-cache.d.ts +105 -0
  153. package/dist/esm/jwks/key-set-cache.d.ts.map +1 -0
  154. package/dist/esm/jwks/key-set-cache.js +268 -0
  155. package/dist/esm/jwks/key-set-cache.js.map +1 -0
  156. package/dist/esm/jwks/keyset.d.ts +139 -0
  157. package/dist/esm/jwks/keyset.d.ts.map +1 -0
  158. package/dist/esm/jwks/keyset.js +489 -0
  159. package/dist/esm/jwks/keyset.js.map +1 -0
  160. package/dist/esm/jwks/support.d.ts +9 -0
  161. package/dist/esm/jwks/support.d.ts.map +1 -0
  162. package/dist/esm/jwks/support.js +9 -0
  163. package/dist/esm/jwks/support.js.map +1 -0
  164. package/dist/esm/package.json +1 -0
  165. package/dist/esm/polling.d.ts +10 -0
  166. package/dist/esm/polling.d.ts.map +1 -0
  167. package/dist/esm/polling.js +71 -0
  168. package/dist/esm/polling.js.map +1 -0
  169. package/dist/esm/resources/auth-sessions.d.ts +41 -0
  170. package/dist/esm/resources/auth-sessions.d.ts.map +1 -0
  171. package/dist/esm/resources/auth-sessions.js +30 -0
  172. package/dist/esm/resources/auth-sessions.js.map +1 -0
  173. package/dist/esm/resources/authorizations.d.ts +23 -0
  174. package/dist/esm/resources/authorizations.d.ts.map +1 -0
  175. package/dist/esm/resources/authorizations.js +25 -0
  176. package/dist/esm/resources/authorizations.js.map +1 -0
  177. package/dist/esm/resources/circles.d.ts +38 -0
  178. package/dist/esm/resources/circles.d.ts.map +1 -0
  179. package/dist/esm/resources/circles.js +63 -0
  180. package/dist/esm/resources/circles.js.map +1 -0
  181. package/dist/esm/resources/confirmations.d.ts +111 -0
  182. package/dist/esm/resources/confirmations.d.ts.map +1 -0
  183. package/dist/esm/resources/confirmations.js +82 -0
  184. package/dist/esm/resources/confirmations.js.map +1 -0
  185. package/dist/esm/resources/delegations.d.ts +36 -0
  186. package/dist/esm/resources/delegations.d.ts.map +1 -0
  187. package/dist/esm/resources/delegations.js +43 -0
  188. package/dist/esm/resources/delegations.js.map +1 -0
  189. package/dist/esm/resources/hitl-chat-id.d.ts +42 -0
  190. package/dist/esm/resources/hitl-chat-id.d.ts.map +1 -0
  191. package/dist/esm/resources/hitl-chat-id.js +33 -0
  192. package/dist/esm/resources/hitl-chat-id.js.map +1 -0
  193. package/dist/esm/resources/hitl-keys.d.ts +13 -0
  194. package/dist/esm/resources/hitl-keys.d.ts.map +1 -0
  195. package/dist/esm/resources/hitl-keys.js +18 -0
  196. package/dist/esm/resources/hitl-keys.js.map +1 -0
  197. package/dist/esm/resources/hitl.d.ts +39 -0
  198. package/dist/esm/resources/hitl.d.ts.map +1 -0
  199. package/dist/esm/resources/hitl.js +54 -0
  200. package/dist/esm/resources/hitl.js.map +1 -0
  201. package/dist/esm/resources/me.d.ts +102 -0
  202. package/dist/esm/resources/me.d.ts.map +1 -0
  203. package/dist/esm/resources/me.js +81 -0
  204. package/dist/esm/resources/me.js.map +1 -0
  205. package/dist/esm/resources/profiles.d.ts +47 -0
  206. package/dist/esm/resources/profiles.d.ts.map +1 -0
  207. package/dist/esm/resources/profiles.js +66 -0
  208. package/dist/esm/resources/profiles.js.map +1 -0
  209. package/dist/esm/resources/proof-me.d.ts +48 -0
  210. package/dist/esm/resources/proof-me.d.ts.map +1 -0
  211. package/dist/esm/resources/proof-me.js +20 -0
  212. package/dist/esm/resources/proof-me.js.map +1 -0
  213. package/dist/esm/resources/proofs.d.ts +81 -0
  214. package/dist/esm/resources/proofs.d.ts.map +1 -0
  215. package/dist/esm/resources/proofs.js +433 -0
  216. package/dist/esm/resources/proofs.js.map +1 -0
  217. package/dist/esm/resources/public-profiles.d.ts +36 -0
  218. package/dist/esm/resources/public-profiles.d.ts.map +1 -0
  219. package/dist/esm/resources/public-profiles.js +45 -0
  220. package/dist/esm/resources/public-profiles.js.map +1 -0
  221. package/dist/esm/resources/sessions.d.ts +15 -0
  222. package/dist/esm/resources/sessions.d.ts.map +1 -0
  223. package/dist/esm/resources/sessions.js +22 -0
  224. package/dist/esm/resources/sessions.js.map +1 -0
  225. package/dist/esm/resources/templates.d.ts +25 -0
  226. package/dist/esm/resources/templates.d.ts.map +1 -0
  227. package/dist/esm/resources/templates.js +42 -0
  228. package/dist/esm/resources/templates.js.map +1 -0
  229. package/dist/esm/resources/verification-requests.d.ts +56 -0
  230. package/dist/esm/resources/verification-requests.d.ts.map +1 -0
  231. package/dist/esm/resources/verification-requests.js +57 -0
  232. package/dist/esm/resources/verification-requests.js.map +1 -0
  233. package/dist/esm/resources/verifications.d.ts +60 -0
  234. package/dist/esm/resources/verifications.d.ts.map +1 -0
  235. package/dist/esm/resources/verifications.js +87 -0
  236. package/dist/esm/resources/verifications.js.map +1 -0
  237. package/dist/esm/resources/webhook-deliveries.d.ts +15 -0
  238. package/dist/esm/resources/webhook-deliveries.d.ts.map +1 -0
  239. package/dist/esm/resources/webhook-deliveries.js +22 -0
  240. package/dist/esm/resources/webhook-deliveries.js.map +1 -0
  241. package/dist/esm/streaming.d.ts +87 -0
  242. package/dist/esm/streaming.d.ts.map +1 -0
  243. package/dist/esm/streaming.js +286 -0
  244. package/dist/esm/streaming.js.map +1 -0
  245. package/dist/esm/types.d.ts +1483 -0
  246. package/dist/esm/types.d.ts.map +1 -0
  247. package/dist/esm/types.js +5 -0
  248. package/dist/esm/types.js.map +1 -0
  249. package/dist/esm/version.d.ts +2 -0
  250. package/dist/esm/version.d.ts.map +1 -0
  251. package/dist/esm/version.js +2 -0
  252. package/dist/esm/version.js.map +1 -0
  253. package/package.json +64 -4
@@ -0,0 +1,41 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import { type StreamEvent, type StreamOptions } from '../streaming.js';
3
+ /**
4
+ * Auth session resource envelope, as `retrieve()` returns it; shape is left
5
+ * open so callers can narrow to their dashboard/login flow's own type.
6
+ */
7
+ export interface AuthSession {
8
+ id: string;
9
+ status: string;
10
+ [key: string]: unknown;
11
+ }
12
+ /** The `connected` frame of `authSessions.stream()`, written once when the connection opens. */
13
+ export interface AuthSessionStreamConnected {
14
+ session_id: string;
15
+ status: string;
16
+ channel: string;
17
+ }
18
+ /** The `update` frame of `authSessions.stream()`: a status signal, not the session. */
19
+ export interface AuthSessionStreamUpdate {
20
+ status: string;
21
+ timestamp: string;
22
+ }
23
+ export type AuthSessionStreamEvent = StreamEvent<'update', AuthSessionStreamConnected, AuthSessionStreamUpdate, AuthSession>;
24
+ /**
25
+ * Dashboard-side authentication sessions (magic-link / QR login). The
26
+ * session ID itself acts as the bearer secret — no API key required for the
27
+ * SSE endpoint, but format is enforced server-side (`auth_[a-f0-9]{32}`).
28
+ */
29
+ export declare class AuthSessions {
30
+ private readonly http;
31
+ constructor(http: HttpClient);
32
+ /** Retrieve an auth session by ID (polling fallback target). */
33
+ retrieve(id: string): Promise<AuthSession>;
34
+ /**
35
+ * Stream auth session status changes via Server-Sent Events: `connected` and
36
+ * `update` signals, not the session. When SSE is unavailable it falls back to
37
+ * polling `retrieve(id)` and yields the session as `poll` / `terminal` events.
38
+ */
39
+ stream(id: string, options?: StreamOptions): AsyncIterable<AuthSessionStreamEvent>;
40
+ }
41
+ //# sourceMappingURL=auth-sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-sessions.d.ts","sourceRoot":"","sources":["../../../src/resources/auth-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAkB,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEvF;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,gGAAgG;AAChG,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,uFAAuF;AACvF,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,QAAQ,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,WAAW,CAAC,CAAC;AAI7H;;;;GAIG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,gEAAgE;IAChE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI1C;;;;OAIG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,aAAa,CAAC,sBAAsB,CAAC;CAQnF"}
@@ -0,0 +1,30 @@
1
+ import { streamEndpoint } from '../streaming.js';
2
+ const TERMINAL_STATES = ['verified', 'failed', 'expired'];
3
+ /**
4
+ * Dashboard-side authentication sessions (magic-link / QR login). The
5
+ * session ID itself acts as the bearer secret — no API key required for the
6
+ * SSE endpoint, but format is enforced server-side (`auth_[a-f0-9]{32}`).
7
+ */
8
+ export class AuthSessions {
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ /** Retrieve an auth session by ID (polling fallback target). */
13
+ retrieve(id) {
14
+ return this.http.get(`/api/v1/auth/sessions/${encodeURIComponent(id)}`);
15
+ }
16
+ /**
17
+ * Stream auth session status changes via Server-Sent Events: `connected` and
18
+ * `update` signals, not the session. When SSE is unavailable it falls back to
19
+ * polling `retrieve(id)` and yields the session as `poll` / `terminal` events.
20
+ */
21
+ stream(id, options) {
22
+ return streamEndpoint(this.http, {
23
+ path: `/api/v1/auth/sessions/${encodeURIComponent(id)}/events`,
24
+ retrieve: () => this.retrieve(id),
25
+ terminalStates: TERMINAL_STATES,
26
+ label: `Auth session ${id}`,
27
+ }, options);
28
+ }
29
+ }
30
+ //# sourceMappingURL=auth-sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-sessions.js","sourceRoot":"","sources":["../../../src/resources/auth-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAwC,MAAM,iBAAiB,CAAC;AA2BvF,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAEnE;;;;GAIG;AACH,MAAM,OAAO,YAAY;IACvB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,gEAAgE;IAChE,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAc,yBAAyB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACvF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,EAAU,EAAE,OAAuB;QACxC,OAAO,cAAc,CAAsC,IAAI,CAAC,IAAI,EAAE;YACpE,IAAI,EAAE,yBAAyB,kBAAkB,CAAC,EAAE,CAAC,SAAS;YAC9D,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,cAAc,EAAE,eAAe;YAC/B,KAAK,EAAE,gBAAgB,EAAE,EAAE;SAC5B,EAAE,OAAO,CAAC,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { Authorization, CreateAuthorizationParams, AuthorizationListParams, AuthorizationListResponse, CreateAuthorizationResponse, AuthorizationExportParams, AuthorizationExportResponse, BinaryResponse } from '../types.js';
3
+ export declare class Authorizations {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ /** Create a new authorization request */
7
+ create(params: CreateAuthorizationParams): Promise<CreateAuthorizationResponse>;
8
+ /** Get an authorization by ID */
9
+ retrieve(id: string): Promise<Authorization>;
10
+ /** List authorizations with optional filters */
11
+ list(params?: AuthorizationListParams): Promise<AuthorizationListResponse>;
12
+ /** Revoke an authorization */
13
+ revoke(id: string, params?: {
14
+ reason?: string;
15
+ }): Promise<Authorization>;
16
+ /** Export authorizations as CSV — served as text/csv, returned as the binary envelope */
17
+ export(params: AuthorizationExportParams & {
18
+ format: 'csv';
19
+ }): Promise<BinaryResponse>;
20
+ /** Export authorizations as JSON */
21
+ export(params?: AuthorizationExportParams): Promise<AuthorizationExportResponse>;
22
+ }
23
+ //# sourceMappingURL=authorizations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorizations.d.ts","sourceRoot":"","sources":["../../../src/resources/authorizations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,aAAa,EACb,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,EAC3B,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,yCAAyC;IACzC,MAAM,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAI/E,iCAAiC;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAI5C,gDAAgD;IAChD,IAAI,CAAC,MAAM,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAI1E,8BAA8B;IAC9B,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAQxE,yFAAyF;IACzF,MAAM,CAAC,MAAM,EAAE,yBAAyB,GAAG;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IACtF,oCAAoC;IACpC,MAAM,CAAC,MAAM,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAIjF"}
@@ -0,0 +1,25 @@
1
+ export class Authorizations {
2
+ constructor(http) {
3
+ this.http = http;
4
+ }
5
+ /** Create a new authorization request */
6
+ create(params) {
7
+ return this.http.post('/api/v1/authorizations', params);
8
+ }
9
+ /** Get an authorization by ID */
10
+ retrieve(id) {
11
+ return this.http.get(`/api/v1/authorizations/${encodeURIComponent(id)}`);
12
+ }
13
+ /** List authorizations with optional filters */
14
+ list(params) {
15
+ return this.http.get('/api/v1/authorizations', params);
16
+ }
17
+ /** Revoke an authorization */
18
+ revoke(id, params) {
19
+ return this.http.request('DELETE', `/api/v1/authorizations/${encodeURIComponent(id)}`, { body: params });
20
+ }
21
+ export(params) {
22
+ return this.http.get('/api/v1/authorizations/export', params);
23
+ }
24
+ }
25
+ //# sourceMappingURL=authorizations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorizations.js","sourceRoot":"","sources":["../../../src/resources/authorizations.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,cAAc;IACzB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,yCAAyC;IACzC,MAAM,CAAC,MAAiC;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAA8B,wBAAwB,EAAE,MAAM,CAAC,CAAC;IACvF,CAAC;IAED,iCAAiC;IACjC,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAgB,0BAA0B,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED,gDAAgD;IAChD,IAAI,CAAC,MAAgC;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAA4B,wBAAwB,EAAE,MAA+D,CAAC,CAAC;IAC7I,CAAC;IAED,8BAA8B;IAC9B,MAAM,CAAC,EAAU,EAAE,MAA4B;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CACtB,QAAQ,EACR,0BAA0B,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAClD,EAAE,IAAI,EAAE,MAAM,EAAE,CACjB,CAAC;IACJ,CAAC;IAMD,MAAM,CAAC,MAAkC;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAA+C,+BAA+B,EAAE,MAA+D,CAAC,CAAC;IACvK,CAAC;CACF"}
@@ -0,0 +1,38 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { Circle, CreateCircleParams, UpdateCircleParams, CircleListParams, CircleListResponse, CircleMember, CircleMemberListResponse, CreateCircleMemberParams, CircleMemberInviteResponse, CircleMemberDrillResponse, AddCircleMemberChannelParams, CircleMemberChannel, CircleMemberChannelListResponse } from '../types.js';
3
+ /**
4
+ * Circle people-primitive: named groups of trusted contacts, their members, and
5
+ * per-member channels. Member and channel responses expose reachability booleans
6
+ * only — an identifier is NEVER returned (SEC-PM-006).
7
+ */
8
+ export declare class Circles {
9
+ private readonly http;
10
+ constructor(http: HttpClient);
11
+ /** Create a new Circle (optionally with initial members) */
12
+ create(params: CreateCircleParams): Promise<Circle>;
13
+ /** List Circles (archived excluded by default; pass `status: 'archived'` to surface them) */
14
+ list(params?: CircleListParams): Promise<CircleListResponse>;
15
+ /** Get a Circle by ID */
16
+ retrieve(id: string): Promise<Circle>;
17
+ /** Update a Circle's name (the profile binding is create-only) */
18
+ update(id: string, params: UpdateCircleParams): Promise<Circle>;
19
+ /** Archive a Circle (soft delete) */
20
+ archive(id: string): Promise<void>;
21
+ /** Add a pending member by name (+ an optional pre-declared WhatsApp phone) */
22
+ addMember(id: string, params: CreateCircleMemberParams): Promise<CircleMember>;
23
+ /** List a Circle's members (channel presence booleans and a masked enrollment phone only, never an identifier) */
24
+ listMembers(id: string): Promise<CircleMemberListResponse>;
25
+ /** Mint a single-use enrollment deep link (both channels + QR) for a member */
26
+ inviteMember(id: string, memberId: string): Promise<CircleMemberInviteResponse>;
27
+ /** Fire a cross-channel Proof-Me identity challenge against an enrolled member */
28
+ triggerDrill(id: string, memberId: string): Promise<CircleMemberDrillResponse>;
29
+ /** Remove a member (deletes its channels and revokes its live authorizations) */
30
+ removeMember(id: string, memberId: string): Promise<void>;
31
+ /** Declare a channel for a member (409 if that channel type already exists) */
32
+ addMemberChannel(id: string, memberId: string, params: AddCircleMemberChannelParams): Promise<CircleMemberChannel>;
33
+ /** List a member's channels (metadata only, never an identifier) */
34
+ listMemberChannels(id: string, memberId: string): Promise<CircleMemberChannelListResponse>;
35
+ /** Remove a member channel (removing the last channel is allowed) */
36
+ removeMemberChannel(id: string, memberId: string, channelId: string): Promise<void>;
37
+ }
38
+ //# sourceMappingURL=circles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circles.d.ts","sourceRoot":"","sources":["../../../src/resources/circles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EACzB,4BAA4B,EAC5B,mBAAmB,EACnB,+BAA+B,EAChC,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,4DAA4D;IAC5D,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAInD,6FAA6F;IAC7F,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,k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 * Circle people-primitive: named groups of trusted contacts, their members, and
3
+ * per-member channels. Member and channel responses expose reachability booleans
4
+ * only — an identifier is NEVER returned (SEC-PM-006).
5
+ */
6
+ export class Circles {
7
+ constructor(http) {
8
+ this.http = http;
9
+ }
10
+ /** Create a new Circle (optionally with initial members) */
11
+ create(params) {
12
+ return this.http.post('/api/v1/circles', params);
13
+ }
14
+ /** List Circles (archived excluded by default; pass `status: 'archived'` to surface them) */
15
+ list(params) {
16
+ return this.http.get('/api/v1/circles', params);
17
+ }
18
+ /** Get a Circle by ID */
19
+ retrieve(id) {
20
+ return this.http.get(`/api/v1/circles/${encodeURIComponent(id)}`);
21
+ }
22
+ /** Update a Circle's name (the profile binding is create-only) */
23
+ update(id, params) {
24
+ return this.http.request('PATCH', `/api/v1/circles/${encodeURIComponent(id)}`, { body: params });
25
+ }
26
+ /** Archive a Circle (soft delete) */
27
+ archive(id) {
28
+ return this.http.del(`/api/v1/circles/${encodeURIComponent(id)}`);
29
+ }
30
+ /** Add a pending member by name (+ an optional pre-declared WhatsApp phone) */
31
+ addMember(id, params) {
32
+ return this.http.post(`/api/v1/circles/${encodeURIComponent(id)}/members`, params);
33
+ }
34
+ /** List a Circle's members (channel presence booleans and a masked enrollment phone only, never an identifier) */
35
+ listMembers(id) {
36
+ return this.http.get(`/api/v1/circles/${encodeURIComponent(id)}/members`);
37
+ }
38
+ /** Mint a single-use enrollment deep link (both channels + QR) for a member */
39
+ inviteMember(id, memberId) {
40
+ return this.http.post(`/api/v1/circles/${encodeURIComponent(id)}/members/invite`, { member_id: memberId });
41
+ }
42
+ /** Fire a cross-channel Proof-Me identity challenge against an enrolled member */
43
+ triggerDrill(id, memberId) {
44
+ return this.http.post(`/api/v1/circles/${encodeURIComponent(id)}/members/${encodeURIComponent(memberId)}/drill`);
45
+ }
46
+ /** Remove a member (deletes its channels and revokes its live authorizations) */
47
+ removeMember(id, memberId) {
48
+ return this.http.del(`/api/v1/circles/${encodeURIComponent(id)}/members/${encodeURIComponent(memberId)}`);
49
+ }
50
+ /** Declare a channel for a member (409 if that channel type already exists) */
51
+ addMemberChannel(id, memberId, params) {
52
+ return this.http.post(`/api/v1/circles/${encodeURIComponent(id)}/members/${encodeURIComponent(memberId)}/channels`, params);
53
+ }
54
+ /** List a member's channels (metadata only, never an identifier) */
55
+ listMemberChannels(id, memberId) {
56
+ return this.http.get(`/api/v1/circles/${encodeURIComponent(id)}/members/${encodeURIComponent(memberId)}/channels`);
57
+ }
58
+ /** Remove a member channel (removing the last channel is allowed) */
59
+ removeMemberChannel(id, memberId, channelId) {
60
+ return this.http.del(`/api/v1/circles/${encodeURIComponent(id)}/members/${encodeURIComponent(memberId)}/channels/${encodeURIComponent(channelId)}`);
61
+ }
62
+ }
63
+ //# sourceMappingURL=circles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circles.js","sourceRoot":"","sources":["../../../src/resources/circles.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,MAAM,OAAO,OAAO;IAClB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,4DAA4D;IAC5D,MAAM,CAAC,MAA0B;QAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAS,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IAED,6FAA6F;IAC7F,IAAI,CAAC,MAAyB;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAqB,iBAAiB,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAED,yBAAyB;IACzB,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAS,mBAAmB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,kEAAkE;IAClE,MAAM,CAAC,EAAU,EAAE,MAA0B;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CACtB,OAAO,EACP,mBAAmB,kBAAkB,CAAC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,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CACnB,mBAAmB,kBAAkB,CAAC,EAAE,CAAC,YAAY,kBAAkB,CAAC,QAAQ,CAAC,WAAW,EAC5F,MAAM,CACP,CAAC;IACJ,CAAC;IAED,oEAAoE;IACpE,kBAAkB,CAAC,EAAU,EAAE,QAAgB;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAClB,mBAAmB,kBAAkB,CAAC,EAAE,CAAC,YAAY,kBAAkB,CAAC,QAAQ,CAAC,WAAW,CAC7F,CAAC;IACJ,CAAC;IAED,qEAAqE;IACrE,mBAAmB,CAAC,EAAU,EAAE,QAAgB,EAAE,SAAiB;QACjE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAClB,mBAAmB,kBAAkB,CAAC,EAAE,CAAC,YAAY,kBAAkB,CAAC,QAAQ,CAAC,aAAa,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAC9H,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,111 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import { type StreamEvent, type StreamOptions } from '../streaming.js';
3
+ import type { ApprovalLinkResponse, ConfirmAndWaitOptions } from '../types.js';
4
+ /**
5
+ * A HITL confirmation as the API returns it (the OpenAPI `Confirmation`
6
+ * component). The live frames of `stream()` are content-free signals; read the
7
+ * full confirmation via `retrieve(id)` when one arrives.
8
+ */
9
+ export interface Confirmation {
10
+ id: string;
11
+ hitl_id: string;
12
+ /** The stored ciphertext envelope, echoed back verbatim — never the plaintext sentence. */
13
+ message: string;
14
+ /** A timeout is `denied` with `response.channel` `'system'` and `response.text` `'timeout'`; there is no `expired` status. */
15
+ status: 'pending' | 'approved' | 'denied';
16
+ /** The approver's decision; null while pending. */
17
+ response?: {
18
+ action: 'approve' | 'deny';
19
+ /**
20
+ * The approver's optional comment, encrypted by the approval page: a ciphertext envelope (JSON).
21
+ * When `channel` is `'system'` no approver acted and this is the plaintext reason instead
22
+ * (`'timeout'`, `'key_rotated'`, `'config_archived'`).
23
+ */
24
+ text?: string | null;
25
+ channel?: string | null;
26
+ at: string;
27
+ /** The enrolled approver's Authorization that resolved it, verified server-side. */
28
+ authorization_id?: string | null;
29
+ } | null;
30
+ timeout_at?: string | null;
31
+ /** Signed proof of an approver's decision (approval or denial); null while pending and for a system denial. */
32
+ proof_token?: string | null;
33
+ resolved_at?: string | null;
34
+ created_at: string;
35
+ updated_at: string;
36
+ }
37
+ export interface CreateConfirmationParams {
38
+ hitl_id: string;
39
+ message: string;
40
+ [key: string]: unknown;
41
+ }
42
+ export interface ConfirmationListParams {
43
+ /** A stored status, or `'expired'`: the confirmations that timed out (system denials for `'timeout'`, and pending rows past `timeout_at`). */
44
+ status?: 'pending' | 'approved' | 'denied' | 'expired';
45
+ limit?: number;
46
+ page?: number;
47
+ [key: string]: string | number | boolean | undefined;
48
+ }
49
+ export interface ConfirmationListResponse {
50
+ data: Confirmation[];
51
+ pagination: {
52
+ page: number;
53
+ limit: number;
54
+ total: number;
55
+ total_pages: number;
56
+ };
57
+ }
58
+ /** The `connected` frame of `confirmations.stream()`, written once when the connection opens. */
59
+ export interface ConfirmationStreamConnected {
60
+ confirmation_id: string;
61
+ status: Confirmation['status'];
62
+ }
63
+ /** The `update` frame of `confirmations.stream()`: a resolution signal, not the confirmation. */
64
+ export interface ConfirmationStreamUpdate {
65
+ type: 'resolved';
66
+ status: Confirmation['status'];
67
+ resolved_at?: string;
68
+ }
69
+ export type ConfirmationStreamEvent = StreamEvent<'update', ConfirmationStreamConnected, ConfirmationStreamUpdate, Confirmation>;
70
+ export declare class Confirmations {
71
+ private readonly http;
72
+ constructor(http: HttpClient);
73
+ /** Create a new confirmation request */
74
+ create(params: CreateConfirmationParams): Promise<Confirmation>;
75
+ /** Get a confirmation by ID */
76
+ retrieve(id: string): Promise<Confirmation>;
77
+ /** List confirmations with optional filters */
78
+ list(params?: ConfirmationListParams): Promise<ConfirmationListResponse>;
79
+ /** Generate a fresh HMAC approval link for a pending confirmation */
80
+ approvalLink(id: string): Promise<ApprovalLinkResponse>;
81
+ /**
82
+ * Poll a confirmation until it reaches a terminal state (approved/denied/expired).
83
+ * Mirrors `verifications.waitForCompletion`. When `throwOnDenial` is set and the
84
+ * confirmation is denied, throws `ConfirmationDeniedError`; otherwise returns the
85
+ * terminal confirmation.
86
+ */
87
+ waitForResolution(id: string, options?: ConfirmAndWaitOptions): Promise<Confirmation>;
88
+ /**
89
+ * Encrypt a message with the HITL config's public key, create a confirmation,
90
+ * and poll until the approver resolves it — a one-call CI/CD approval gate.
91
+ *
92
+ * Uses the v1 (owner-key) envelope. If the HITL config has enrolled approvers,
93
+ * they cannot decrypt a v1 envelope (see docs/ENCRYPTION_ENVELOPE.md §2.5);
94
+ * v2 multi-recipient support is a planned follow-up.
95
+ *
96
+ * `throwOnDenial` defaults to `true` here (gate semantics): any terminal state
97
+ * other than `approved` — `denied`, including a timeout (the server records an
98
+ * unanswered confirmation as a system denial, `response.channel === 'system'`) —
99
+ * throws `ConfirmationDeniedError` rather than returning silently, so a CI/CD
100
+ * gate cannot pass on an un-approved confirmation. Pass `throwOnDenial: false`
101
+ * to receive the terminal confirmation and inspect `status` yourself.
102
+ */
103
+ createAndWait(hitlId: string, message: string, options?: ConfirmAndWaitOptions): Promise<Confirmation>;
104
+ /**
105
+ * Stream confirmation status changes via Server-Sent Events: a `connected`
106
+ * signal, then `update` signals, neither carrying the confirmation. When SSE is unavailable it falls back to polling
107
+ * `retrieve(id)` and yields the confirmation as `poll` / `terminal` events.
108
+ */
109
+ stream(id: string, options?: StreamOptions): AsyncIterable<ConfirmationStreamEvent>;
110
+ }
111
+ //# sourceMappingURL=confirmations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmations.d.ts","sourceRoot":"","sources":["../../../src/resources/confirmations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAkB,KAAK,WAAW,EAAE,KAAK,a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ACG,aAAa,CACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,YAAY,CAAC;IAiBxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,aAAa,CAAC,uBAAuB,CAAC;CAQpF"}
@@ -0,0 +1,82 @@
1
+ import { streamEndpoint } from '../streaming.js';
2
+ import { pollUntilComplete } from '../polling.js';
3
+ import { encryptMessage } from '../crypto/hitl-crypto.js';
4
+ import { ConfirmationDeniedError } from '../errors.js';
5
+ const TERMINAL_STATES = ['approved', 'denied', 'expired'];
6
+ export class Confirmations {
7
+ constructor(http) {
8
+ this.http = http;
9
+ }
10
+ /** Create a new confirmation request */
11
+ create(params) {
12
+ return this.http.post('/api/v1/confirmations', params);
13
+ }
14
+ /** Get a confirmation by ID */
15
+ retrieve(id) {
16
+ return this.http.get(`/api/v1/confirmations/${encodeURIComponent(id)}`);
17
+ }
18
+ /** List confirmations with optional filters */
19
+ list(params) {
20
+ return this.http.get('/api/v1/confirmations', params);
21
+ }
22
+ /** Generate a fresh HMAC approval link for a pending confirmation */
23
+ approvalLink(id) {
24
+ return this.http.post(`/api/v1/confirmations/${encodeURIComponent(id)}/approval-link`);
25
+ }
26
+ /**
27
+ * Poll a confirmation until it reaches a terminal state (approved/denied/expired).
28
+ * Mirrors `verifications.waitForCompletion`. When `throwOnDenial` is set and the
29
+ * confirmation is denied, throws `ConfirmationDeniedError`; otherwise returns the
30
+ * terminal confirmation.
31
+ */
32
+ async waitForResolution(id, options) {
33
+ const confirmation = await pollUntilComplete(() => this.retrieve(id), TERMINAL_STATES, `Confirmation ${id}`, options);
34
+ if (options?.throwOnDenial && confirmation.status === 'denied') {
35
+ throw new ConfirmationDeniedError(id, confirmation.status);
36
+ }
37
+ return confirmation;
38
+ }
39
+ /**
40
+ * Encrypt a message with the HITL config's public key, create a confirmation,
41
+ * and poll until the approver resolves it — a one-call CI/CD approval gate.
42
+ *
43
+ * Uses the v1 (owner-key) envelope. If the HITL config has enrolled approvers,
44
+ * they cannot decrypt a v1 envelope (see docs/ENCRYPTION_ENVELOPE.md §2.5);
45
+ * v2 multi-recipient support is a planned follow-up.
46
+ *
47
+ * `throwOnDenial` defaults to `true` here (gate semantics): any terminal state
48
+ * other than `approved` — `denied`, including a timeout (the server records an
49
+ * unanswered confirmation as a system denial, `response.channel === 'system'`) —
50
+ * throws `ConfirmationDeniedError` rather than returning silently, so a CI/CD
51
+ * gate cannot pass on an un-approved confirmation. Pass `throwOnDenial: false`
52
+ * to receive the terminal confirmation and inspect `status` yourself.
53
+ */
54
+ async createAndWait(hitlId, message, options) {
55
+ const keys = await this.http.get(`/api/v1/hitl/${encodeURIComponent(hitlId)}/keys`);
56
+ const envelope = encryptMessage(message, keys.public_key, hitlId);
57
+ const created = await this.create({
58
+ hitl_id: hitlId,
59
+ message: JSON.stringify(envelope),
60
+ ...(options?.proofExpiryDays !== undefined ? { proof_expiry_days: options.proofExpiryDays } : {}),
61
+ });
62
+ const resolved = await this.waitForResolution(created.id, { ...options, throwOnDenial: false });
63
+ if ((options?.throwOnDenial ?? true) && resolved.status !== 'approved') {
64
+ throw new ConfirmationDeniedError(created.id, resolved.status);
65
+ }
66
+ return resolved;
67
+ }
68
+ /**
69
+ * Stream confirmation status changes via Server-Sent Events: a `connected`
70
+ * signal, then `update` signals, neither carrying the confirmation. When SSE is unavailable it falls back to polling
71
+ * `retrieve(id)` and yields the confirmation as `poll` / `terminal` events.
72
+ */
73
+ stream(id, options) {
74
+ return streamEndpoint(this.http, {
75
+ path: `/api/v1/confirmations/${encodeURIComponent(id)}/events`,
76
+ retrieve: () => this.retrieve(id),
77
+ terminalStates: TERMINAL_STATES,
78
+ label: `Confirmation ${id}`,
79
+ }, options);
80
+ }
81
+ }
82
+ //# sourceMappingURL=confirmations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmations.js","sour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AI,CAAC,IAAI,EAAE;YACtE,IAAI,EAAE,yBAAyB,kBAAkB,CAAC,EAAE,CAAC,SAAS;YAC9D,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,cAAc,EAAE,eAAe;YAC/B,KAAK,EAAE,gBAAgB,EAAE,EAAE;SAC5B,EAAE,OAAO,CAAC,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { CreateDelegationParams, DelegationDetail, DelegationListItem, DelegationListParams, DelegationListResponse, RevokeDelegationParams } from '../types.js';
3
+ /**
4
+ * Delegations — Proof of Delegation. A control-proven domain authorizes a typed
5
+ * url/purl artifact for a set of capability scopes; the attestation is that the
6
+ * domain's controller authorized the artifact, nothing more.
7
+ */
8
+ export declare class Delegations {
9
+ private readonly http;
10
+ constructor(http: HttpClient);
11
+ /**
12
+ * Create a delegation from your active domain control proof (each mint is a billable proof).
13
+ *
14
+ * The result carries the publishable token AND the derived `effective_status`/`is_valid`,
15
+ * the same pair the reads carry — the shape does not depend on the verb.
16
+ */
17
+ create(params: CreateDelegationParams): Promise<DelegationDetail>;
18
+ /**
19
+ * List your own delegations (tokens are not included in the list).
20
+ *
21
+ * Each item carries the DERIVED `effective_status`/`is_valid` beside its stored `status` —
22
+ * render the derived one. `params.status` filters the stored record only.
23
+ */
24
+ list(params?: DelegationListParams): Promise<DelegationListResponse>;
25
+ /** Get a delegation by Mongo id or `ph_dlg_*` handle — returns the stored token and derived status */
26
+ retrieve(id: string): Promise<DelegationDetail>;
27
+ /**
28
+ * Revoke one delegation — the domain proof and sibling delegations stay valid.
29
+ *
30
+ * Idempotent: a repeat revoke answers 200 with the same body, here and on
31
+ * `POST /proofs/{handle}/revoke`. (A PROOF differs deliberately — that one answers
32
+ * `400 already_revoked`.) The result carries the derived `effective_status`/`is_valid`.
33
+ */
34
+ revoke(id: string, params?: RevokeDelegationParams): Promise<DelegationListItem>;
35
+ }
36
+ //# sourceMappingURL=delegations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegations.d.ts","sourceRoot":"","sources":["../../../src/resources/delegations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIjE;;;;;OAKG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIpE,sGAAsG;IACtG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAI/C;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAGjF"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Delegations — Proof of Delegation. A control-proven domain authorizes a typed
3
+ * url/purl artifact for a set of capability scopes; the attestation is that the
4
+ * domain's controller authorized the artifact, nothing more.
5
+ */
6
+ export class Delegations {
7
+ constructor(http) {
8
+ this.http = http;
9
+ }
10
+ /**
11
+ * Create a delegation from your active domain control proof (each mint is a billable proof).
12
+ *
13
+ * The result carries the publishable token AND the derived `effective_status`/`is_valid`,
14
+ * the same pair the reads carry — the shape does not depend on the verb.
15
+ */
16
+ create(params) {
17
+ return this.http.post('/api/v1/delegations', params);
18
+ }
19
+ /**
20
+ * List your own delegations (tokens are not included in the list).
21
+ *
22
+ * Each item carries the DERIVED `effective_status`/`is_valid` beside its stored `status` —
23
+ * render the derived one. `params.status` filters the stored record only.
24
+ */
25
+ list(params) {
26
+ return this.http.get('/api/v1/delegations', params);
27
+ }
28
+ /** Get a delegation by Mongo id or `ph_dlg_*` handle — returns the stored token and derived status */
29
+ retrieve(id) {
30
+ return this.http.get(`/api/v1/delegations/${encodeURIComponent(id)}`);
31
+ }
32
+ /**
33
+ * Revoke one delegation — the domain proof and sibling delegations stay valid.
34
+ *
35
+ * Idempotent: a repeat revoke answers 200 with the same body, here and on
36
+ * `POST /proofs/{handle}/revoke`. (A PROOF differs deliberately — that one answers
37
+ * `400 already_revoked`.) The result carries the derived `effective_status`/`is_valid`.
38
+ */
39
+ revoke(id, params) {
40
+ return this.http.post(`/api/v1/delegations/${encodeURIComponent(id)}/revoke`, params);
41
+ }
42
+ }
43
+ //# sourceMappingURL=delegations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegations.js","sourceRoot":"","sources":["../../../src/resources/delegations.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,MAAM,OAAO,WAAW;IACtB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;;OAKG;IACH,MAAM,CAAC,MAA8B;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAmB,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACzE,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,MAA6B;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAyB,qBAAqB,EAAE,MAA+D,CAAC,CAAC;IACvI,CAAC;IAED,sGAAsG;IACtG,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAmB,uBAAuB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,EAAU,EAAE,MAA+B;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAqB,uBAAuB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC5G,CAAC;CACF"}
@@ -0,0 +1,42 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import { type StreamEvent, type StreamOptions } from '../streaming.js';
3
+ import type { ChatIdDiscoveryCreateResponse } from '../types.js';
4
+ /** HITL chat-ID discovery session response shape. */
5
+ export interface ChatIdDiscovery {
6
+ token: string;
7
+ status: string;
8
+ chat_id?: string | null;
9
+ [key: string]: unknown;
10
+ }
11
+ /** The `connected` frame of `hitlChatIdDiscovery.stream()`, written once when the connection opens. */
12
+ export interface ChatIdDiscoveryStreamConnected {
13
+ token: string;
14
+ status: string;
15
+ chat_id?: string;
16
+ }
17
+ /** The `update` frame of `hitlChatIdDiscovery.stream()`: a status signal, not the discovery. */
18
+ export interface ChatIdDiscoveryStreamUpdate {
19
+ status: string;
20
+ timestamp: string;
21
+ chat_id?: string;
22
+ }
23
+ export type ChatIdDiscoveryStreamEvent = StreamEvent<'update', ChatIdDiscoveryStreamConnected, ChatIdDiscoveryStreamUpdate, ChatIdDiscovery>;
24
+ /**
25
+ * HITL Telegram chat-ID discovery session stream. Tokens are short-lived
26
+ * and scoped per-user. The polling fallback hits the poll endpoint
27
+ * `/api/v1/hitl/chat-id-discovery/:token`.
28
+ */
29
+ export declare class HitlChatIdDiscovery {
30
+ private readonly http;
31
+ constructor(http: HttpClient);
32
+ /** Create a chat-ID discovery token (Telegram deeplink + QR code). */
33
+ create(): Promise<ChatIdDiscoveryCreateResponse>;
34
+ /** Retrieve chat-ID discovery status by token (polling fallback target). */
35
+ retrieve(token: string): Promise<ChatIdDiscovery>;
36
+ /**
37
+ * Stream chat-ID discovery status via SSE (`connected` / `update` signals),
38
+ * with a polling fallback that yields the discovery as `poll` / `terminal`.
39
+ */
40
+ stream(token: string, options?: StreamOptions): AsyncIterable<ChatIdDiscoveryStreamEvent>;
41
+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EAAE,aAAa,GACtB,aAAa,CAAC,0BAA0B,CAAC;CAQ7C"}
@@ -0,0 +1,33 @@
1
+ import { streamEndpoint } from '../streaming.js';
2
+ const TERMINAL_STATES = ['completed', 'expired'];
3
+ /**
4
+ * HITL Telegram chat-ID discovery session stream. Tokens are short-lived
5
+ * and scoped per-user. The polling fallback hits the poll endpoint
6
+ * `/api/v1/hitl/chat-id-discovery/:token`.
7
+ */
8
+ export class HitlChatIdDiscovery {
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ /** Create a chat-ID discovery token (Telegram deeplink + QR code). */
13
+ create() {
14
+ return this.http.post('/api/v1/hitl/chat-id-discovery');
15
+ }
16
+ /** Retrieve chat-ID discovery status by token (polling fallback target). */
17
+ retrieve(token) {
18
+ return this.http.get(`/api/v1/hitl/chat-id-discovery/${encodeURIComponent(token)}`);
19
+ }
20
+ /**
21
+ * Stream chat-ID discovery status via SSE (`connected` / `update` signals),
22
+ * with a polling fallback that yields the discovery as `poll` / `terminal`.
23
+ */
24
+ stream(token, options) {
25
+ return streamEndpoint(this.http, {
26
+ path: `/api/v1/hitl/chat-id-discovery/${encodeURIComponent(token)}/events`,
27
+ retrieve: () => this.retrieve(token),
28
+ terminalStates: TERMINAL_STATES,
29
+ label: `Chat ID discovery ${token}`,
30
+ }, options);
31
+ }
32
+ }
33
+ //# sourceMappingURL=hitl-chat-id.js.map