@@ -111,22 +111,6 @@ class ProWrapper : public Napi::ObjectWrap<ProWrapper> {
111111 " proStatusRequestBody" ,
112112 static_cast <napi_property_attributes>(
113113 napi_writable | napi_configurable)),
114-
115- // Note: those are not plugged in for now as we do this parsing through zod
116- // on desktop.
117- // Pro responses parsing
118- // StaticMethod<&ProWrapper::proProofParseResponse>(
119- // "proProofParseResponse",
120- // static_cast<napi_property_attributes>(
121- // napi_writable | napi_configurable)),
122- // StaticMethod<&ProWrapper::proRevocationsParseResponse>(
123- // "proRevocationsParseResponse",
124- // static_cast<napi_property_attributes>(
125- // napi_writable | napi_configurable)),
126- // StaticMethod<&ProWrapper::proStatusParseResponse>(
127- // "proStatusParseResponse",
128- // static_cast<napi_property_attributes>(
129- // napi_writable | napi_configurable)),
130114 });
131115 }
132116
@@ -206,13 +190,9 @@ class ProWrapper : public Napi::ObjectWrap<ProWrapper> {
206190 std::string rotating_privkey =
207191 toCppString (rotating_privkey_js, " proProofRequestBody.rotatingPrivKeyHex" );
208192
209-
210193 auto master_privkey_decoded = from_hex (master_privkey);
211194 auto rotating_privkey_decoded = from_hex (rotating_privkey);
212195
213- assert_length (master_privkey_decoded, 64 , " masterPrivKeyHex" );
214- assert_length (rotating_privkey_decoded, 64 , " rotatingPrivkey" );
215-
216196 std::string json = pro_backend::GetProProofRequest::build_to_json (
217197 static_cast <uint8_t >(requestVersion.Int32Value ()),
218198 to_span (master_privkey_decoded),
@@ -223,33 +203,6 @@ class ProWrapper : public Napi::ObjectWrap<ProWrapper> {
223203 });
224204 };
225205
226- static Napi::Value proProofParseResponse (const Napi::CallbackInfo& info) {
227- return wrapResult (info, [&] {
228- // we expect arguments that match:
229- // first: {
230- // "json": string,
231- // }
232-
233- assertInfoLength (info, 1 );
234- assertIsObject (info[0 ]);
235- auto env = info.Env ();
236-
237- auto first = info[0 ].As <Napi::Object>();
238-
239- if (first.IsEmpty ())
240- throw std::invalid_argument (" proProofParseResponse first received empty" );
241-
242- assertIsString (first.Get (" json" ), " proProofParseResponse.json" );
243- auto json_str = toCppString (first.Get (" json" ), " proProofParseResponse.json" );
244- auto parsed = pro_backend::AddProPaymentOrGetProProofResponse::parse (json_str);
245-
246- auto obj = toJs (env, static_cast <pro_backend::ResponseHeader>(parsed));
247- obj[" proof" ] = toJsOrNullIfErrors (env, parsed.proof , parsed.errors );
248-
249- return obj;
250- });
251- };
252-
253206 static Napi::Value proRevocationsRequestBody (const Napi::CallbackInfo& info) {
254207 return wrapResult (info, [&] {
255208 // we expect arguments that match:
@@ -281,35 +234,6 @@ class ProWrapper : public Napi::ObjectWrap<ProWrapper> {
281234 });
282235 };
283236
284- static Napi::Value proRevocationsParseResponse (const Napi::CallbackInfo& info) {
285- return wrapResult (info, [&] {
286- // we expect arguments that match:
287- // first: {
288- // "json": string,
289- // }
290-
291- assertInfoLength (info, 1 );
292- assertIsObject (info[0 ]);
293- auto env = info.Env ();
294-
295- auto first = info[0 ].As <Napi::Object>();
296-
297- if (first.IsEmpty ())
298- throw std::invalid_argument (" proRevocationsParseResponse first received empty" );
299-
300- assertIsString (first.Get (" json" ), " proRevocationsParseResponse.json" );
301- auto json_str = toCppString (first.Get (" json" ), " proRevocationsParseResponse.json" );
302- auto parsed = pro_backend::GetProRevocationsResponse::parse (json_str);
303-
304- auto obj = toJs (env, static_cast <pro_backend::ResponseHeader>(parsed));
305- // if error is set, the body might not be parsable so don't try to use it
306- obj[" ticket" ] = parsed.errors .size () ? env.Null () : toJs (env, parsed.ticket );
307- obj[" items" ] = parsed.errors .size () ? env.Null () : toJs (env, parsed.items );
308-
309- return obj;
310- });
311- };
312-
313237 static Napi::Value proStatusRequestBody (const Napi::CallbackInfo& info) {
314238 return wrapResult (info, [&] {
315239 // we expect arguments that match:
@@ -344,7 +268,6 @@ class ProWrapper : public Napi::ObjectWrap<ProWrapper> {
344268 toCppString (master_privkey_js, " proStatusRequestBody.masterPrivKeyHex" );
345269
346270 auto master_privkey_decoded = from_hex (master_privkey);
347- assert_length (master_privkey_decoded, 64 , " proStatusRequestBody.masterPrivKeyHex" );
348271
349272 auto json = pro_backend::GetProStatusRequest::build_to_json (
350273 static_cast <uint8_t >(requestVersion.Int32Value ()),
@@ -355,44 +278,6 @@ class ProWrapper : public Napi::ObjectWrap<ProWrapper> {
355278 return json;
356279 });
357280 };
358-
359- static Napi::Value proStatusParseResponse (const Napi::CallbackInfo& info) {
360- return wrapResult (info, [&] {
361- // we expect arguments that match:
362- // first: {
363- // "json": string,
364- // }
365-
366- assertInfoLength (info, 1 );
367- assertIsObject (info[0 ]);
368- auto env = info.Env ();
369-
370- auto first = info[0 ].As <Napi::Object>();
371-
372- if (first.IsEmpty ())
373- throw std::invalid_argument (" proStatusParseResponse first received empty" );
374-
375- assertIsString (first.Get (" json" ), " proStatusParseResponse.json" );
376- auto json_str = toCppString (first.Get (" json" ), " proStatusParseResponse.json" );
377- auto parsed = pro_backend::GetProStatusResponse::parse (json_str);
378-
379- auto obj = toJs (env, static_cast <pro_backend::ResponseHeader>(parsed));
380-
381- obj[" items" ] = toJsOrNullIfErrors (env, parsed.items , parsed.errors );
382- obj[" userStatus" ] = toJsOrNullIfErrors (
383- env, proBackendEnumToString (parsed.user_status ), parsed.errors );
384-
385- obj[" errorReport" ] = toJsOrNullIfErrors (
386- env, proBackendEnumToString (parsed.error_report ), parsed.errors );
387-
388- obj[" autoRenewing" ] = toJsOrNullIfErrors (env, parsed.auto_renewing , parsed.errors );
389- obj[" expiryTsMs" ] = toJsOrNullIfErrors (env, parsed.expiry_unix_ts_ms , parsed.errors );
390- obj[" gracePeriodMs" ] =
391- toJsOrNullIfErrors (env, parsed.grace_period_duration_ms , parsed.errors );
392-
393- return obj;
394- });
395- };
396281};
397282
398283}; // namespace session::nodeapi
0 commit comments