@greensecurity/javascript-sdk 0.45.0-beta.15 → 0.45.0-beta.17

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 (238) hide show
  1. package/dist/commonjs/__tests__/vendors.test.js +1 -1
  2. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  3. package/dist/commonjs/__tests__/webhooks.test.js +5 -6
  4. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  5. package/dist/commonjs/__tests__/zones.test.js +2 -27
  6. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  7. package/dist/commonjs/funcs/reportsGetFullReport.d.ts +3 -3
  8. package/dist/commonjs/funcs/reportsGetFullReport.js +3 -3
  9. package/dist/commonjs/funcs/usersPostAuthenticate.d.ts +37 -0
  10. package/dist/commonjs/funcs/usersPostAuthenticate.d.ts.map +1 -1
  11. package/dist/commonjs/funcs/usersPostAuthenticate.js +37 -0
  12. package/dist/commonjs/funcs/usersPostAuthenticate.js.map +1 -1
  13. package/dist/commonjs/funcs/validateWebhook.d.ts +1 -1
  14. package/dist/commonjs/funcs/validateWebhook.d.ts.map +1 -1
  15. package/dist/commonjs/funcs/validateWebhook.js +3 -0
  16. package/dist/commonjs/funcs/validateWebhook.js.map +1 -1
  17. package/dist/commonjs/funcs/vendorsSendDownloadCode.js +1 -1
  18. package/dist/commonjs/funcs/vendorsSendDownloadCode.js.map +1 -1
  19. package/dist/commonjs/lib/config.d.ts +2 -2
  20. package/dist/commonjs/lib/config.js +2 -2
  21. package/dist/commonjs/models/components/authenticatesuccessresponse.d.ts +91 -0
  22. package/dist/commonjs/models/components/authenticatesuccessresponse.d.ts.map +1 -0
  23. package/dist/commonjs/models/components/authenticatesuccessresponse.js +100 -0
  24. package/dist/commonjs/models/components/authenticatesuccessresponse.js.map +1 -0
  25. package/dist/commonjs/models/components/fullreport.d.ts +107 -0
  26. package/dist/commonjs/models/components/fullreport.d.ts.map +1 -0
  27. package/dist/commonjs/models/components/fullreport.js +125 -0
  28. package/dist/commonjs/models/components/fullreport.js.map +1 -0
  29. package/dist/commonjs/models/components/index.d.ts +3 -0
  30. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  31. package/dist/commonjs/models/components/index.js +3 -0
  32. package/dist/commonjs/models/components/index.js.map +1 -1
  33. package/dist/commonjs/models/components/loginemailandpassword.d.ts +34 -0
  34. package/dist/commonjs/models/components/loginemailandpassword.d.ts.map +1 -1
  35. package/dist/commonjs/models/components/loginemailandpassword.js +2 -0
  36. package/dist/commonjs/models/components/loginemailandpassword.js.map +1 -1
  37. package/dist/commonjs/models/components/loginrequirementsfromemail.d.ts +34 -0
  38. package/dist/commonjs/models/components/loginrequirementsfromemail.d.ts.map +1 -1
  39. package/dist/commonjs/models/components/loginrequirementsfromemail.js +2 -0
  40. package/dist/commonjs/models/components/loginrequirementsfromemail.js.map +1 -1
  41. package/dist/commonjs/models/components/mfarequiredresponse.d.ts +33 -0
  42. package/dist/commonjs/models/components/mfarequiredresponse.d.ts.map +1 -1
  43. package/dist/commonjs/models/components/mfarequiredresponse.js +2 -0
  44. package/dist/commonjs/models/components/mfarequiredresponse.js.map +1 -1
  45. package/dist/commonjs/models/components/passwordnotsetresponse.d.ts +34 -1
  46. package/dist/commonjs/models/components/passwordnotsetresponse.d.ts.map +1 -1
  47. package/dist/commonjs/models/components/passwordnotsetresponse.js +2 -0
  48. package/dist/commonjs/models/components/passwordnotsetresponse.js.map +1 -1
  49. package/dist/commonjs/models/components/passwordrequiredresponse.d.ts +33 -0
  50. package/dist/commonjs/models/components/passwordrequiredresponse.d.ts.map +1 -1
  51. package/dist/commonjs/models/components/passwordrequiredresponse.js +6 -0
  52. package/dist/commonjs/models/components/passwordrequiredresponse.js.map +1 -1
  53. package/dist/commonjs/models/components/samlloginrequiredresponse.d.ts +33 -0
  54. package/dist/commonjs/models/components/samlloginrequiredresponse.d.ts.map +1 -1
  55. package/dist/commonjs/models/components/samlloginrequiredresponse.js +2 -0
  56. package/dist/commonjs/models/components/samlloginrequiredresponse.js.map +1 -1
  57. package/dist/commonjs/models/components/ssocontinuation.d.ts +44 -0
  58. package/dist/commonjs/models/components/ssocontinuation.d.ts.map +1 -0
  59. package/dist/commonjs/models/components/ssocontinuation.js +56 -0
  60. package/dist/commonjs/models/components/ssocontinuation.js.map +1 -0
  61. package/dist/commonjs/models/components/webhooksubscription.d.ts +3 -0
  62. package/dist/commonjs/models/components/webhooksubscription.d.ts.map +1 -1
  63. package/dist/commonjs/models/components/webhooksubscription.js +3 -0
  64. package/dist/commonjs/models/components/webhooksubscription.js.map +1 -1
  65. package/dist/commonjs/models/components/webhooksubscriptiondetail.d.ts +1 -0
  66. package/dist/commonjs/models/components/webhooksubscriptiondetail.d.ts.map +1 -1
  67. package/dist/commonjs/models/components/webhooksubscriptiondetail.js +1 -0
  68. package/dist/commonjs/models/components/webhooksubscriptiondetail.js.map +1 -1
  69. package/dist/commonjs/models/operations/postauthenticate.d.ts +1 -1
  70. package/dist/commonjs/models/operations/postauthenticate.d.ts.map +1 -1
  71. package/dist/commonjs/models/operations/postauthenticate.js +1 -1
  72. package/dist/commonjs/models/operations/postauthenticate.js.map +1 -1
  73. package/dist/commonjs/models/webhooks/index.d.ts +3 -0
  74. package/dist/commonjs/models/webhooks/index.d.ts.map +1 -1
  75. package/dist/commonjs/models/webhooks/index.js +3 -0
  76. package/dist/commonjs/models/webhooks/index.js.map +1 -1
  77. package/dist/commonjs/models/webhooks/sendfullreportcreated.d.ts +42 -0
  78. package/dist/commonjs/models/webhooks/sendfullreportcreated.d.ts.map +1 -0
  79. package/dist/commonjs/models/webhooks/sendfullreportcreated.js +85 -0
  80. package/dist/commonjs/models/webhooks/sendfullreportcreated.js.map +1 -0
  81. package/dist/commonjs/models/webhooks/sendfullreportdestroyed.d.ts +42 -0
  82. package/dist/commonjs/models/webhooks/sendfullreportdestroyed.d.ts.map +1 -0
  83. package/dist/commonjs/models/webhooks/sendfullreportdestroyed.js +85 -0
  84. package/dist/commonjs/models/webhooks/sendfullreportdestroyed.js.map +1 -0
  85. package/dist/commonjs/models/webhooks/sendfullreportupdated.d.ts +42 -0
  86. package/dist/commonjs/models/webhooks/sendfullreportupdated.d.ts.map +1 -0
  87. package/dist/commonjs/models/webhooks/sendfullreportupdated.js +85 -0
  88. package/dist/commonjs/models/webhooks/sendfullreportupdated.js.map +1 -0
  89. package/dist/commonjs/react-query/reportsGetFullReport.d.ts +6 -6
  90. package/dist/commonjs/react-query/reportsGetFullReport.js +6 -6
  91. package/dist/commonjs/react-query/usersPostAuthenticate.d.ts +37 -0
  92. package/dist/commonjs/react-query/usersPostAuthenticate.d.ts.map +1 -1
  93. package/dist/commonjs/react-query/usersPostAuthenticate.js +37 -0
  94. package/dist/commonjs/react-query/usersPostAuthenticate.js.map +1 -1
  95. package/dist/commonjs/sdk/reports.d.ts +3 -3
  96. package/dist/commonjs/sdk/reports.js +3 -3
  97. package/dist/commonjs/sdk/sdk.d.ts +1 -1
  98. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  99. package/dist/commonjs/sdk/sdk.js.map +1 -1
  100. package/dist/commonjs/sdk/users.d.ts +37 -0
  101. package/dist/commonjs/sdk/users.d.ts.map +1 -1
  102. package/dist/commonjs/sdk/users.js +37 -0
  103. package/dist/commonjs/sdk/users.js.map +1 -1
  104. package/dist/esm/__tests__/vendors.test.js +1 -1
  105. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  106. package/dist/esm/__tests__/webhooks.test.js +5 -6
  107. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  108. package/dist/esm/__tests__/zones.test.js +2 -27
  109. package/dist/esm/__tests__/zones.test.js.map +1 -1
  110. package/dist/esm/funcs/reportsGetFullReport.d.ts +3 -3
  111. package/dist/esm/funcs/reportsGetFullReport.js +3 -3
  112. package/dist/esm/funcs/usersPostAuthenticate.d.ts +37 -0
  113. package/dist/esm/funcs/usersPostAuthenticate.d.ts.map +1 -1
  114. package/dist/esm/funcs/usersPostAuthenticate.js +37 -0
  115. package/dist/esm/funcs/usersPostAuthenticate.js.map +1 -1
  116. package/dist/esm/funcs/validateWebhook.d.ts +1 -1
  117. package/dist/esm/funcs/validateWebhook.d.ts.map +1 -1
  118. package/dist/esm/funcs/validateWebhook.js +3 -0
  119. package/dist/esm/funcs/validateWebhook.js.map +1 -1
  120. package/dist/esm/funcs/vendorsSendDownloadCode.js +1 -1
  121. package/dist/esm/funcs/vendorsSendDownloadCode.js.map +1 -1
  122. package/dist/esm/lib/config.d.ts +2 -2
  123. package/dist/esm/lib/config.js +2 -2
  124. package/dist/esm/models/components/authenticatesuccessresponse.d.ts +91 -0
  125. package/dist/esm/models/components/authenticatesuccessresponse.d.ts.map +1 -0
  126. package/dist/esm/models/components/authenticatesuccessresponse.js +61 -0
  127. package/dist/esm/models/components/authenticatesuccessresponse.js.map +1 -0
  128. package/dist/esm/models/components/fullreport.d.ts +107 -0
  129. package/dist/esm/models/components/fullreport.d.ts.map +1 -0
  130. package/dist/esm/models/components/fullreport.js +87 -0
  131. package/dist/esm/models/components/fullreport.js.map +1 -0
  132. package/dist/esm/models/components/index.d.ts +3 -0
  133. package/dist/esm/models/components/index.d.ts.map +1 -1
  134. package/dist/esm/models/components/index.js +3 -0
  135. package/dist/esm/models/components/index.js.map +1 -1
  136. package/dist/esm/models/components/loginemailandpassword.d.ts +34 -0
  137. package/dist/esm/models/components/loginemailandpassword.d.ts.map +1 -1
  138. package/dist/esm/models/components/loginemailandpassword.js +2 -0
  139. package/dist/esm/models/components/loginemailandpassword.js.map +1 -1
  140. package/dist/esm/models/components/loginrequirementsfromemail.d.ts +34 -0
  141. package/dist/esm/models/components/loginrequirementsfromemail.d.ts.map +1 -1
  142. package/dist/esm/models/components/loginrequirementsfromemail.js +2 -0
  143. package/dist/esm/models/components/loginrequirementsfromemail.js.map +1 -1
  144. package/dist/esm/models/components/mfarequiredresponse.d.ts +33 -0
  145. package/dist/esm/models/components/mfarequiredresponse.d.ts.map +1 -1
  146. package/dist/esm/models/components/mfarequiredresponse.js +2 -0
  147. package/dist/esm/models/components/mfarequiredresponse.js.map +1 -1
  148. package/dist/esm/models/components/passwordnotsetresponse.d.ts +34 -1
  149. package/dist/esm/models/components/passwordnotsetresponse.d.ts.map +1 -1
  150. package/dist/esm/models/components/passwordnotsetresponse.js +2 -0
  151. package/dist/esm/models/components/passwordnotsetresponse.js.map +1 -1
  152. package/dist/esm/models/components/passwordrequiredresponse.d.ts +33 -0
  153. package/dist/esm/models/components/passwordrequiredresponse.d.ts.map +1 -1
  154. package/dist/esm/models/components/passwordrequiredresponse.js +6 -0
  155. package/dist/esm/models/components/passwordrequiredresponse.js.map +1 -1
  156. package/dist/esm/models/components/samlloginrequiredresponse.d.ts +33 -0
  157. package/dist/esm/models/components/samlloginrequiredresponse.d.ts.map +1 -1
  158. package/dist/esm/models/components/samlloginrequiredresponse.js +2 -0
  159. package/dist/esm/models/components/samlloginrequiredresponse.js.map +1 -1
  160. package/dist/esm/models/components/ssocontinuation.d.ts +44 -0
  161. package/dist/esm/models/components/ssocontinuation.d.ts.map +1 -0
  162. package/dist/esm/models/components/ssocontinuation.js +19 -0
  163. package/dist/esm/models/components/ssocontinuation.js.map +1 -0
  164. package/dist/esm/models/components/webhooksubscription.d.ts +3 -0
  165. package/dist/esm/models/components/webhooksubscription.d.ts.map +1 -1
  166. package/dist/esm/models/components/webhooksubscription.js +3 -0
  167. package/dist/esm/models/components/webhooksubscription.js.map +1 -1
  168. package/dist/esm/models/components/webhooksubscriptiondetail.d.ts +1 -0
  169. package/dist/esm/models/components/webhooksubscriptiondetail.d.ts.map +1 -1
  170. package/dist/esm/models/components/webhooksubscriptiondetail.js +1 -0
  171. package/dist/esm/models/components/webhooksubscriptiondetail.js.map +1 -1
  172. package/dist/esm/models/operations/postauthenticate.d.ts +1 -1
  173. package/dist/esm/models/operations/postauthenticate.d.ts.map +1 -1
  174. package/dist/esm/models/operations/postauthenticate.js +1 -1
  175. package/dist/esm/models/operations/postauthenticate.js.map +1 -1
  176. package/dist/esm/models/webhooks/index.d.ts +3 -0
  177. package/dist/esm/models/webhooks/index.d.ts.map +1 -1
  178. package/dist/esm/models/webhooks/index.js +3 -0
  179. package/dist/esm/models/webhooks/index.js.map +1 -1
  180. package/dist/esm/models/webhooks/sendfullreportcreated.d.ts +42 -0
  181. package/dist/esm/models/webhooks/sendfullreportcreated.d.ts.map +1 -0
  182. package/dist/esm/models/webhooks/sendfullreportcreated.js +47 -0
  183. package/dist/esm/models/webhooks/sendfullreportcreated.js.map +1 -0
  184. package/dist/esm/models/webhooks/sendfullreportdestroyed.d.ts +42 -0
  185. package/dist/esm/models/webhooks/sendfullreportdestroyed.d.ts.map +1 -0
  186. package/dist/esm/models/webhooks/sendfullreportdestroyed.js +47 -0
  187. package/dist/esm/models/webhooks/sendfullreportdestroyed.js.map +1 -0
  188. package/dist/esm/models/webhooks/sendfullreportupdated.d.ts +42 -0
  189. package/dist/esm/models/webhooks/sendfullreportupdated.d.ts.map +1 -0
  190. package/dist/esm/models/webhooks/sendfullreportupdated.js +47 -0
  191. package/dist/esm/models/webhooks/sendfullreportupdated.js.map +1 -0
  192. package/dist/esm/react-query/reportsGetFullReport.d.ts +6 -6
  193. package/dist/esm/react-query/reportsGetFullReport.js +6 -6
  194. package/dist/esm/react-query/usersPostAuthenticate.d.ts +37 -0
  195. package/dist/esm/react-query/usersPostAuthenticate.d.ts.map +1 -1
  196. package/dist/esm/react-query/usersPostAuthenticate.js +37 -0
  197. package/dist/esm/react-query/usersPostAuthenticate.js.map +1 -1
  198. package/dist/esm/sdk/reports.d.ts +3 -3
  199. package/dist/esm/sdk/reports.js +3 -3
  200. package/dist/esm/sdk/sdk.d.ts +1 -1
  201. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  202. package/dist/esm/sdk/sdk.js.map +1 -1
  203. package/dist/esm/sdk/users.d.ts +37 -0
  204. package/dist/esm/sdk/users.d.ts.map +1 -1
  205. package/dist/esm/sdk/users.js +37 -0
  206. package/dist/esm/sdk/users.js.map +1 -1
  207. package/jsr.json +1 -1
  208. package/package.json +1 -1
  209. package/src/__tests__/vendors.test.ts +1 -1
  210. package/src/__tests__/webhooks.test.ts +5 -6
  211. package/src/__tests__/zones.test.ts +2 -27
  212. package/src/funcs/reportsGetFullReport.ts +3 -3
  213. package/src/funcs/usersPostAuthenticate.ts +37 -0
  214. package/src/funcs/validateWebhook.ts +6 -0
  215. package/src/funcs/vendorsSendDownloadCode.ts +1 -0
  216. package/src/lib/config.ts +2 -2
  217. package/src/models/components/authenticatesuccessresponse.ts +189 -0
  218. package/src/models/components/fullreport.ts +193 -0
  219. package/src/models/components/index.ts +3 -0
  220. package/src/models/components/loginemailandpassword.ts +36 -0
  221. package/src/models/components/loginrequirementsfromemail.ts +36 -0
  222. package/src/models/components/mfarequiredresponse.ts +35 -0
  223. package/src/models/components/passwordnotsetresponse.ts +36 -1
  224. package/src/models/components/passwordrequiredresponse.ts +39 -0
  225. package/src/models/components/samlloginrequiredresponse.ts +35 -0
  226. package/src/models/components/ssocontinuation.ts +71 -0
  227. package/src/models/components/webhooksubscription.ts +3 -0
  228. package/src/models/components/webhooksubscriptiondetail.ts +1 -0
  229. package/src/models/operations/postauthenticate.ts +2 -2
  230. package/src/models/webhooks/index.ts +3 -0
  231. package/src/models/webhooks/sendfullreportcreated.ts +104 -0
  232. package/src/models/webhooks/sendfullreportdestroyed.ts +104 -0
  233. package/src/models/webhooks/sendfullreportupdated.ts +104 -0
  234. package/src/react-query/reportsGetFullReport.ts +6 -6
  235. package/src/react-query/usersPostAuthenticate.ts +37 -0
  236. package/src/sdk/reports.ts +3 -3
  237. package/src/sdk/sdk.ts +3 -0
  238. package/src/sdk/users.ts +37 -0
@@ -17,12 +17,46 @@ export type LoginRequirementsFromEmail = {
17
17
  * A proper URI where the user should be sent after completing a SAML login. This is encoded into the response you will get if the user requires a SAML login.
18
18
  */
19
19
  returnUrl: string;
20
+ /**
21
+ * Opaque, signed state that Green Security issues when a third-party service
22
+ *
23
+ * @remarks
24
+ * provider starts a "Login with Green Security" SAML flow at
25
+ * `/saml/idp/sso`. The login screen receives it as the `sso_state` query
26
+ * string parameter and must pass it back, byte for byte, on every call to
27
+ * this endpoint for the remainder of the login journey — including the
28
+ * second call that carries an `mfa_code`.
29
+ *
30
+ * The blob is signed, not encrypted, and it expires five minutes after the
31
+ * service provider's request arrives. Do not parse it, shorten it, decode
32
+ * it, or re-encode it.
33
+ *
34
+ * **An invalid blob does not fail the login.** This is the opposite of what
35
+ * most integrators assume, so it is worth stating plainly: a forged, edited
36
+ * or expired `sso_state` is silently discarded, and the request then
37
+ * proceeds as an ordinary login. Valid credentials still authenticate and
38
+ * still return `200` — just with no `sso` object, leaving the user signed in
39
+ * to Green Security with no way back to the service provider that sent them.
40
+ * Never treat a `200` as proof that the SSO hand-off survived; check for
41
+ * `sso` explicitly.
42
+ *
43
+ * Every `202` response echoes the *verified* blob back in its own
44
+ * `sso_state` field. Always send back the value from the response you just
45
+ * received rather than the one you started with, so that a blob the server
46
+ * has already rejected is never resent, and so a client does not have to
47
+ * hold state of its own across the login journey.
48
+ *
49
+ * Omit this field entirely for an ordinary login that did not originate
50
+ * from a service provider.
51
+ */
52
+ ssoState?: string | undefined;
20
53
  };
21
54
 
22
55
  /** @internal */
23
56
  export type LoginRequirementsFromEmail$Outbound = {
24
57
  email: string;
25
58
  return_url: string;
59
+ sso_state?: string | undefined;
26
60
  };
27
61
 
28
62
  /** @internal */
@@ -33,9 +67,11 @@ export const LoginRequirementsFromEmail$outboundSchema: z.ZodType<
33
67
  > = z.object({
34
68
  email: z.string(),
35
69
  returnUrl: z.string(),
70
+ ssoState: z.string().optional(),
36
71
  }).transform((v) => {
37
72
  return remap$(v, {
38
73
  returnUrl: "return_url",
74
+ ssoState: "sso_state",
39
75
  });
40
76
  });
41
77
 
@@ -36,6 +36,39 @@ export type MfaRequiredResponse = {
36
36
  */
37
37
  mobilePhone?: string | undefined;
38
38
  mfaMethod?: MfaMethod | undefined;
39
+ /**
40
+ * Opaque, signed state that Green Security issues when a third-party service
41
+ *
42
+ * @remarks
43
+ * provider starts a "Login with Green Security" SAML flow at
44
+ * `/saml/idp/sso`. The login screen receives it as the `sso_state` query
45
+ * string parameter and must pass it back, byte for byte, on every call to
46
+ * this endpoint for the remainder of the login journey — including the
47
+ * second call that carries an `mfa_code`.
48
+ *
49
+ * The blob is signed, not encrypted, and it expires five minutes after the
50
+ * service provider's request arrives. Do not parse it, shorten it, decode
51
+ * it, or re-encode it.
52
+ *
53
+ * **An invalid blob does not fail the login.** This is the opposite of what
54
+ * most integrators assume, so it is worth stating plainly: a forged, edited
55
+ * or expired `sso_state` is silently discarded, and the request then
56
+ * proceeds as an ordinary login. Valid credentials still authenticate and
57
+ * still return `200` — just with no `sso` object, leaving the user signed in
58
+ * to Green Security with no way back to the service provider that sent them.
59
+ * Never treat a `200` as proof that the SSO hand-off survived; check for
60
+ * `sso` explicitly.
61
+ *
62
+ * Every `202` response echoes the *verified* blob back in its own
63
+ * `sso_state` field. Always send back the value from the response you just
64
+ * received rather than the one you started with, so that a blob the server
65
+ * has already rejected is never resent, and so a client does not have to
66
+ * hold state of its own across the login journey.
67
+ *
68
+ * Omit this field entirely for an ordinary login that did not originate
69
+ * from a service provider.
70
+ */
71
+ ssoState?: string | undefined;
39
72
  };
40
73
 
41
74
  /** @internal */
@@ -56,10 +89,12 @@ export const MfaRequiredResponse$inboundSchema: z.ZodType<
56
89
  error: types.string(),
57
90
  mobile_phone: types.optional(types.string()),
58
91
  mfa_method: types.optional(MfaMethod$inboundSchema),
92
+ sso_state: types.optional(types.string()),
59
93
  }).transform((v) => {
60
94
  return remap$(v, {
61
95
  "mobile_phone": "mobilePhone",
62
96
  "mfa_method": "mfaMethod",
97
+ "sso_state": "ssoState",
63
98
  });
64
99
  });
65
100
 
@@ -20,9 +20,42 @@ export type PasswordNotSetResponse = {
20
20
  */
21
21
  error: string;
22
22
  /**
23
- * URL to redirect the user to set their password (forgot password flow). Includes return_url query param when provided in the request.
23
+ * URL to redirect the user to set their password (forgot password flow). Carries the `return_url` and `sso_state` query params when those were provided on the request, because the browser follows this redirect and leaves the JSON body behind.
24
24
  */
25
25
  redirectUrl: string;
26
+ /**
27
+ * Opaque, signed state that Green Security issues when a third-party service
28
+ *
29
+ * @remarks
30
+ * provider starts a "Login with Green Security" SAML flow at
31
+ * `/saml/idp/sso`. The login screen receives it as the `sso_state` query
32
+ * string parameter and must pass it back, byte for byte, on every call to
33
+ * this endpoint for the remainder of the login journey — including the
34
+ * second call that carries an `mfa_code`.
35
+ *
36
+ * The blob is signed, not encrypted, and it expires five minutes after the
37
+ * service provider's request arrives. Do not parse it, shorten it, decode
38
+ * it, or re-encode it.
39
+ *
40
+ * **An invalid blob does not fail the login.** This is the opposite of what
41
+ * most integrators assume, so it is worth stating plainly: a forged, edited
42
+ * or expired `sso_state` is silently discarded, and the request then
43
+ * proceeds as an ordinary login. Valid credentials still authenticate and
44
+ * still return `200` — just with no `sso` object, leaving the user signed in
45
+ * to Green Security with no way back to the service provider that sent them.
46
+ * Never treat a `200` as proof that the SSO hand-off survived; check for
47
+ * `sso` explicitly.
48
+ *
49
+ * Every `202` response echoes the *verified* blob back in its own
50
+ * `sso_state` field. Always send back the value from the response you just
51
+ * received rather than the one you started with, so that a blob the server
52
+ * has already rejected is never resent, and so a client does not have to
53
+ * hold state of its own across the login journey.
54
+ *
55
+ * Omit this field entirely for an ordinary login that did not originate
56
+ * from a service provider.
57
+ */
58
+ ssoState?: string | undefined;
26
59
  };
27
60
 
28
61
  /** @internal */
@@ -35,9 +68,11 @@ export const PasswordNotSetResponse$inboundSchema: z.ZodType<
35
68
  success: types.boolean(),
36
69
  error: types.string(),
37
70
  redirect_url: types.string(),
71
+ sso_state: types.optional(types.string()),
38
72
  }).transform((v) => {
39
73
  return remap$(v, {
40
74
  "redirect_url": "redirectUrl",
75
+ "sso_state": "ssoState",
41
76
  });
42
77
  });
43
78
 
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
6
7
  import { safeParse } from "../../lib/schemas.js";
7
8
  import { Result as SafeParseResult } from "../../types/fp.js";
8
9
  import * as types from "../../types/primitives.js";
@@ -18,6 +19,39 @@ export type PasswordRequiredResponse = {
18
19
  * Error describing the exact condition of what further steps are needed to finish the login process.
19
20
  */
20
21
  error: string;
22
+ /**
23
+ * Opaque, signed state that Green Security issues when a third-party service
24
+ *
25
+ * @remarks
26
+ * provider starts a "Login with Green Security" SAML flow at
27
+ * `/saml/idp/sso`. The login screen receives it as the `sso_state` query
28
+ * string parameter and must pass it back, byte for byte, on every call to
29
+ * this endpoint for the remainder of the login journey — including the
30
+ * second call that carries an `mfa_code`.
31
+ *
32
+ * The blob is signed, not encrypted, and it expires five minutes after the
33
+ * service provider's request arrives. Do not parse it, shorten it, decode
34
+ * it, or re-encode it.
35
+ *
36
+ * **An invalid blob does not fail the login.** This is the opposite of what
37
+ * most integrators assume, so it is worth stating plainly: a forged, edited
38
+ * or expired `sso_state` is silently discarded, and the request then
39
+ * proceeds as an ordinary login. Valid credentials still authenticate and
40
+ * still return `200` — just with no `sso` object, leaving the user signed in
41
+ * to Green Security with no way back to the service provider that sent them.
42
+ * Never treat a `200` as proof that the SSO hand-off survived; check for
43
+ * `sso` explicitly.
44
+ *
45
+ * Every `202` response echoes the *verified* blob back in its own
46
+ * `sso_state` field. Always send back the value from the response you just
47
+ * received rather than the one you started with, so that a blob the server
48
+ * has already rejected is never resent, and so a client does not have to
49
+ * hold state of its own across the login journey.
50
+ *
51
+ * Omit this field entirely for an ordinary login that did not originate
52
+ * from a service provider.
53
+ */
54
+ ssoState?: string | undefined;
21
55
  };
22
56
 
23
57
  /** @internal */
@@ -29,6 +63,11 @@ export const PasswordRequiredResponse$inboundSchema: z.ZodType<
29
63
  requires: types.literal("password"),
30
64
  success: types.boolean(),
31
65
  error: types.string(),
66
+ sso_state: types.optional(types.string()),
67
+ }).transform((v) => {
68
+ return remap$(v, {
69
+ "sso_state": "ssoState",
70
+ });
32
71
  });
33
72
 
34
73
  export function passwordRequiredResponseFromJSON(
@@ -28,6 +28,39 @@ export type SamlLoginRequiredResponse = {
28
28
  * This is the URL that should be opened to initiate the SAML login flow
29
29
  */
30
30
  ssoUrl: string;
31
+ /**
32
+ * Opaque, signed state that Green Security issues when a third-party service
33
+ *
34
+ * @remarks
35
+ * provider starts a "Login with Green Security" SAML flow at
36
+ * `/saml/idp/sso`. The login screen receives it as the `sso_state` query
37
+ * string parameter and must pass it back, byte for byte, on every call to
38
+ * this endpoint for the remainder of the login journey — including the
39
+ * second call that carries an `mfa_code`.
40
+ *
41
+ * The blob is signed, not encrypted, and it expires five minutes after the
42
+ * service provider's request arrives. Do not parse it, shorten it, decode
43
+ * it, or re-encode it.
44
+ *
45
+ * **An invalid blob does not fail the login.** This is the opposite of what
46
+ * most integrators assume, so it is worth stating plainly: a forged, edited
47
+ * or expired `sso_state` is silently discarded, and the request then
48
+ * proceeds as an ordinary login. Valid credentials still authenticate and
49
+ * still return `200` — just with no `sso` object, leaving the user signed in
50
+ * to Green Security with no way back to the service provider that sent them.
51
+ * Never treat a `200` as proof that the SSO hand-off survived; check for
52
+ * `sso` explicitly.
53
+ *
54
+ * Every `202` response echoes the *verified* blob back in its own
55
+ * `sso_state` field. Always send back the value from the response you just
56
+ * received rather than the one you started with, so that a blob the server
57
+ * has already rejected is never resent, and so a client does not have to
58
+ * hold state of its own across the login journey.
59
+ *
60
+ * Omit this field entirely for an ordinary login that did not originate
61
+ * from a service provider.
62
+ */
63
+ ssoState?: string | undefined;
31
64
  };
32
65
 
33
66
  /** @internal */
@@ -41,10 +74,12 @@ export const SamlLoginRequiredResponse$inboundSchema: z.ZodType<
41
74
  error: types.string(),
42
75
  sso_instructions: types.optional(types.string()),
43
76
  sso_url: types.string(),
77
+ sso_state: types.optional(types.string()),
44
78
  }).transform((v) => {
45
79
  return remap$(v, {
46
80
  "sso_instructions": "ssoInstructions",
47
81
  "sso_url": "ssoUrl",
82
+ "sso_state": "ssoState",
48
83
  });
49
84
  });
50
85
 
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ /**
13
+ * Where to send the browser to finish a "Login with Green Security" flow.
14
+ *
15
+ * @remarks
16
+ *
17
+ * Present on a `200` from `POST /users/authenticate` only when the request
18
+ * carried a valid, unexpired `sso_state`. Its absence means the login
19
+ * succeeded but the SAML flow did not resume — treat the login as an
20
+ * ordinary one rather than retrying.
21
+ *
22
+ * This object is additive. The login itself is unaffected by it: the
23
+ * caller's own permanent token is in `user_token` exactly as it would be on
24
+ * any other successful authentication, and it is not the token embedded in
25
+ * `continue_url`.
26
+ */
27
+ export type SsoContinuation = {
28
+ /**
29
+ * An absolute, single-use URL on Green Security's domain. Navigate the
30
+ *
31
+ * @remarks
32
+ * browser to it (a full page navigation, not `fetch`); it answers with a
33
+ * self-submitting form that POSTs the signed `SAMLResponse` and the
34
+ * original `RelayState` to the service provider's assertion consumer
35
+ * service URL.
36
+ *
37
+ * The `token` in this URL is a separate **one-time** token that is
38
+ * consumed the first time the URL is followed, so the URL is good for
39
+ * exactly one navigation. It is not the caller's permanent token, which
40
+ * is returned unchanged in `user_token`. Treat the URL as a secret:
41
+ * whoever follows it first receives that user's assertion.
42
+ *
43
+ * Never fetch this URL from your own back end: the response is meant for
44
+ * the user's browser, and posting the assertion from anywhere else
45
+ * breaks the flow.
46
+ */
47
+ continueUrl: string;
48
+ };
49
+
50
+ /** @internal */
51
+ export const SsoContinuation$inboundSchema: z.ZodType<
52
+ SsoContinuation,
53
+ z.ZodTypeDef,
54
+ unknown
55
+ > = z.object({
56
+ continue_url: types.string(),
57
+ }).transform((v) => {
58
+ return remap$(v, {
59
+ "continue_url": "continueUrl",
60
+ });
61
+ });
62
+
63
+ export function ssoContinuationFromJSON(
64
+ jsonString: string,
65
+ ): SafeParseResult<SsoContinuation, SDKValidationError> {
66
+ return safeParse(
67
+ jsonString,
68
+ (x) => SsoContinuation$inboundSchema.parse(JSON.parse(x)),
69
+ `Failed to parse 'SsoContinuation' from JSON`,
70
+ );
71
+ }
@@ -12,6 +12,9 @@ import { ClosedEnum } from "../../types/enums.js";
12
12
  * and `destroyed` lifecycle of every entity that supports webhooks.
13
13
  */
14
14
  export const WebhookSubscription = {
15
+ FullReportCreated: "FullReport.created",
16
+ FullReportUpdated: "FullReport.updated",
17
+ FullReportDestroyed: "FullReport.destroyed",
15
18
  TargetFacilityStatusChangeCreated: "TargetFacilityStatusChange.created",
16
19
  TargetFacilityStatusChangeUpdated: "TargetFacilityStatusChange.updated",
17
20
  TargetFacilityStatusChangeDestroyed: "TargetFacilityStatusChange.destroyed",
@@ -14,6 +14,7 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
14
14
  * The entity the event is about.
15
15
  */
16
16
  export const Model = {
17
+ FullReport: "FullReport",
17
18
  TargetFacilityStatusChange: "TargetFacilityStatusChange",
18
19
  Vendor: "Vendor",
19
20
  VendorScan: "VendorScan",
@@ -26,7 +26,7 @@ export type PostAuthenticateResponseBody =
26
26
  | components.PasswordNotSetResponse;
27
27
 
28
28
  export type PostAuthenticateResponse =
29
- | components.User
29
+ | components.AuthenticateSuccessResponse
30
30
  | components.MfaRequiredResponse
31
31
  | components.SamlLoginRequiredResponse
32
32
  | components.PasswordRequiredResponse
@@ -85,7 +85,7 @@ export const PostAuthenticateResponse$inboundSchema: z.ZodType<
85
85
  z.ZodTypeDef,
86
86
  unknown
87
87
  > = smartUnion([
88
- components.User$inboundSchema,
88
+ components.AuthenticateSuccessResponse$inboundSchema,
89
89
  z.union([
90
90
  components.MfaRequiredResponse$inboundSchema,
91
91
  components.SamlLoginRequiredResponse$inboundSchema,
@@ -2,6 +2,9 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ export * from "./sendfullreportcreated.js";
6
+ export * from "./sendfullreportdestroyed.js";
7
+ export * from "./sendfullreportupdated.js";
5
8
  export * from "./sendtargetfacilitystatuschangecreated.js";
6
9
  export * from "./sendtargetfacilitystatuschangedestroyed.js";
7
10
  export * from "./sendtargetfacilitystatuschangeupdated.js";
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type SendFullReportCreatedRequest = {
14
+ /**
15
+ * `t=<unix seconds>,v1=<hex hmac>`, one `v1` per active secret. Each is
16
+ *
17
+ * @remarks
18
+ * `HMAC-SHA256(secret, "<t>.<raw body>")`. Compare with a constant-time function and
19
+ * reject a timestamp that is not recent.
20
+ */
21
+ greenSecuritySignature: string;
22
+ /**
23
+ * The event this delivery belongs to. Route on it when one URL serves several events.
24
+ */
25
+ greenSecurityEvent: string;
26
+ /**
27
+ * Stable per delivery, including across retries. Key your de-duplication on it.
28
+ */
29
+ greenSecurityIdempotencyKey: string;
30
+ /**
31
+ * The entity in the body.
32
+ */
33
+ greenWebhookId: string;
34
+ fullReport: components.FullReport;
35
+ };
36
+
37
+ /** @internal */
38
+ export const SendFullReportCreatedRequest$inboundSchema: z.ZodType<
39
+ SendFullReportCreatedRequest,
40
+ z.ZodTypeDef,
41
+ unknown
42
+ > = z.object({
43
+ "Green-Security-Signature": types.string(),
44
+ "Green-Security-Event": types.string(),
45
+ "Green-Security-Idempotency-Key": types.string(),
46
+ "Green-Webhook-Id": types.string(),
47
+ FullReport: components.FullReport$inboundSchema,
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ "Green-Security-Signature": "greenSecuritySignature",
51
+ "Green-Security-Event": "greenSecurityEvent",
52
+ "Green-Security-Idempotency-Key": "greenSecurityIdempotencyKey",
53
+ "Green-Webhook-Id": "greenWebhookId",
54
+ "FullReport": "fullReport",
55
+ });
56
+ });
57
+ /** @internal */
58
+ export type SendFullReportCreatedRequest$Outbound = {
59
+ "Green-Security-Signature": string;
60
+ "Green-Security-Event": string;
61
+ "Green-Security-Idempotency-Key": string;
62
+ "Green-Webhook-Id": string;
63
+ FullReport: components.FullReport$Outbound;
64
+ };
65
+
66
+ /** @internal */
67
+ export const SendFullReportCreatedRequest$outboundSchema: z.ZodType<
68
+ SendFullReportCreatedRequest$Outbound,
69
+ z.ZodTypeDef,
70
+ SendFullReportCreatedRequest
71
+ > = z.object({
72
+ greenSecuritySignature: z.string(),
73
+ greenSecurityEvent: z.string(),
74
+ greenSecurityIdempotencyKey: z.string(),
75
+ greenWebhookId: z.string(),
76
+ fullReport: components.FullReport$outboundSchema,
77
+ }).transform((v) => {
78
+ return remap$(v, {
79
+ greenSecuritySignature: "Green-Security-Signature",
80
+ greenSecurityEvent: "Green-Security-Event",
81
+ greenSecurityIdempotencyKey: "Green-Security-Idempotency-Key",
82
+ greenWebhookId: "Green-Webhook-Id",
83
+ fullReport: "FullReport",
84
+ });
85
+ });
86
+
87
+ export function sendFullReportCreatedRequestToJSON(
88
+ sendFullReportCreatedRequest: SendFullReportCreatedRequest,
89
+ ): string {
90
+ return JSON.stringify(
91
+ SendFullReportCreatedRequest$outboundSchema.parse(
92
+ sendFullReportCreatedRequest,
93
+ ),
94
+ );
95
+ }
96
+ export function sendFullReportCreatedRequestFromJSON(
97
+ jsonString: string,
98
+ ): SafeParseResult<SendFullReportCreatedRequest, SDKValidationError> {
99
+ return safeParse(
100
+ jsonString,
101
+ (x) => SendFullReportCreatedRequest$inboundSchema.parse(JSON.parse(x)),
102
+ `Failed to parse 'SendFullReportCreatedRequest' from JSON`,
103
+ );
104
+ }
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type SendFullReportDestroyedRequest = {
14
+ /**
15
+ * `t=<unix seconds>,v1=<hex hmac>`, one `v1` per active secret. Each is
16
+ *
17
+ * @remarks
18
+ * `HMAC-SHA256(secret, "<t>.<raw body>")`. Compare with a constant-time function and
19
+ * reject a timestamp that is not recent.
20
+ */
21
+ greenSecuritySignature: string;
22
+ /**
23
+ * The event this delivery belongs to. Route on it when one URL serves several events.
24
+ */
25
+ greenSecurityEvent: string;
26
+ /**
27
+ * Stable per delivery, including across retries. Key your de-duplication on it.
28
+ */
29
+ greenSecurityIdempotencyKey: string;
30
+ /**
31
+ * The entity in the body.
32
+ */
33
+ greenWebhookId: string;
34
+ fullReport: components.FullReport;
35
+ };
36
+
37
+ /** @internal */
38
+ export const SendFullReportDestroyedRequest$inboundSchema: z.ZodType<
39
+ SendFullReportDestroyedRequest,
40
+ z.ZodTypeDef,
41
+ unknown
42
+ > = z.object({
43
+ "Green-Security-Signature": types.string(),
44
+ "Green-Security-Event": types.string(),
45
+ "Green-Security-Idempotency-Key": types.string(),
46
+ "Green-Webhook-Id": types.string(),
47
+ FullReport: components.FullReport$inboundSchema,
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ "Green-Security-Signature": "greenSecuritySignature",
51
+ "Green-Security-Event": "greenSecurityEvent",
52
+ "Green-Security-Idempotency-Key": "greenSecurityIdempotencyKey",
53
+ "Green-Webhook-Id": "greenWebhookId",
54
+ "FullReport": "fullReport",
55
+ });
56
+ });
57
+ /** @internal */
58
+ export type SendFullReportDestroyedRequest$Outbound = {
59
+ "Green-Security-Signature": string;
60
+ "Green-Security-Event": string;
61
+ "Green-Security-Idempotency-Key": string;
62
+ "Green-Webhook-Id": string;
63
+ FullReport: components.FullReport$Outbound;
64
+ };
65
+
66
+ /** @internal */
67
+ export const SendFullReportDestroyedRequest$outboundSchema: z.ZodType<
68
+ SendFullReportDestroyedRequest$Outbound,
69
+ z.ZodTypeDef,
70
+ SendFullReportDestroyedRequest
71
+ > = z.object({
72
+ greenSecuritySignature: z.string(),
73
+ greenSecurityEvent: z.string(),
74
+ greenSecurityIdempotencyKey: z.string(),
75
+ greenWebhookId: z.string(),
76
+ fullReport: components.FullReport$outboundSchema,
77
+ }).transform((v) => {
78
+ return remap$(v, {
79
+ greenSecuritySignature: "Green-Security-Signature",
80
+ greenSecurityEvent: "Green-Security-Event",
81
+ greenSecurityIdempotencyKey: "Green-Security-Idempotency-Key",
82
+ greenWebhookId: "Green-Webhook-Id",
83
+ fullReport: "FullReport",
84
+ });
85
+ });
86
+
87
+ export function sendFullReportDestroyedRequestToJSON(
88
+ sendFullReportDestroyedRequest: SendFullReportDestroyedRequest,
89
+ ): string {
90
+ return JSON.stringify(
91
+ SendFullReportDestroyedRequest$outboundSchema.parse(
92
+ sendFullReportDestroyedRequest,
93
+ ),
94
+ );
95
+ }
96
+ export function sendFullReportDestroyedRequestFromJSON(
97
+ jsonString: string,
98
+ ): SafeParseResult<SendFullReportDestroyedRequest, SDKValidationError> {
99
+ return safeParse(
100
+ jsonString,
101
+ (x) => SendFullReportDestroyedRequest$inboundSchema.parse(JSON.parse(x)),
102
+ `Failed to parse 'SendFullReportDestroyedRequest' from JSON`,
103
+ );
104
+ }