@@ -18,8 +18,7 @@ class BlindingWrapper : public Napi::ObjectWrap<BlindingWrapper> {
18
18
19
19
public:
20
20
BlindingWrapper (const Napi::CallbackInfo& info) : Napi::ObjectWrap<BlindingWrapper>{info} {
21
- throw std::invalid_argument (
22
- " BlindingWrapper is static and doesn't need to be constructed" );
21
+ throw std::invalid_argument (" BlindingWrapper is static and doesn't need to be constructed" );
23
22
}
24
23
25
24
static void Init (Napi::Env env, Napi::Object exports) {
@@ -32,11 +31,14 @@ class BlindingWrapper : public Napi::ObjectWrap<BlindingWrapper> {
32
31
" blindVersionPubkey" ,
33
32
static_cast <napi_property_attributes>(
34
33
napi_writable | napi_configurable)),
34
+ StaticMethod<&BlindingWrapper::blindVersionSignRequest>(
35
+ " blindVersionSignRequest" ,
36
+ static_cast <napi_property_attributes>(
37
+ napi_writable | napi_configurable)),
35
38
StaticMethod<&BlindingWrapper::blindVersionSign>(
36
39
" blindVersionSign" ,
37
40
static_cast <napi_property_attributes>(
38
41
napi_writable | napi_configurable)),
39
-
40
42
});
41
43
}
42
44
@@ -67,6 +69,43 @@ class BlindingWrapper : public Napi::ObjectWrap<BlindingWrapper> {
67
69
});
68
70
};
69
71
72
+ static Napi::Value blindVersionSignRequest (const Napi::CallbackInfo& info) {
73
+ return wrapResult (info, [&] {
74
+ assertInfoLength (info, 1 );
75
+ assertIsObject (info[0 ]);
76
+ auto obj = info[0 ].As <Napi::Object>();
77
+
78
+ if (obj.IsEmpty ())
79
+ throw std::invalid_argument (" blindVersionSignRequest received empty" );
80
+
81
+ assertIsUInt8Array (
82
+ obj.Get (" ed25519SecretKey" ), " blindVersionSignRequest.ed25519SecretKey" );
83
+ auto ed25519_secret_key = toCppBuffer (
84
+ obj.Get (" ed25519SecretKey" ), " blindVersionSignRequest.ed25519SecretKey" );
85
+
86
+ assertIsNumber (
87
+ obj.Get (" sigTimestampSeconds" ), " blindVersionSignRequest.sigTimestampSeconds" );
88
+ auto sig_timestamp = toCppInteger (
89
+ obj.Get (" sigTimestampSeconds" ),
90
+ " blindVersionSignRequest.sigTimestampSeconds" ,
91
+ false );
92
+
93
+ assertIsString (obj.Get (" sigMethod" ));
94
+ auto sig_method =
95
+ toCppString (obj.Get (" sigMethod" ), " blindVersionSignRequest.sigMethod" );
96
+
97
+ assertIsString (obj.Get (" sigPath" ));
98
+ auto sig_path = toCppString (obj.Get (" sigPath" ), " blindVersionSignRequest.sigPath" );
99
+
100
+ assertIsUInt8ArrayOrNull (obj.Get (" sigBody" ));
101
+ auto sig_body =
102
+ maybeNonemptyBuffer (obj.Get (" sigBody" ), " blindVersionSignRequest.sigBody" );
103
+
104
+ return session::blind_version_sign_request (
105
+ ed25519_secret_key, sig_timestamp, sig_method, sig_path, sig_body);
106
+ });
107
+ };
108
+
70
109
static Napi::Value blindVersionSign (const Napi::CallbackInfo& info) {
71
110
return wrapResult (info, [&] {
72
111
assertInfoLength (info, 1 );
0 commit comments