@@ -120,234 +120,217 @@ ByteBuffer stringToByteBuffer(std::string str) {
120
120
121
121
jsi::Value revocationRegistryDefinitionFromJson (jsi::Runtime &rt,
122
122
jsi::Object options) {
123
- auto json = jsiToValue<std::string >(rt, options, " json" );
123
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
124
124
125
125
ObjectHandle out;
126
126
127
- ByteBuffer b = stringToByteBuffer (json);
128
- ErrorCode code = anoncreds_revocation_registry_definition_from_json (b, &out);
129
-
127
+ ErrorCode code = anoncreds_revocation_registry_definition_from_json (json, &out);
130
128
auto returnValue = createReturnValue (rt, code, &out);
131
129
132
- // free data
133
- delete[] b .data ;
130
+ // Free memory
131
+ delete[] json .data ;
134
132
135
133
return returnValue;
136
134
};
137
135
138
136
jsi::Value revocationRegistryFromJson (jsi::Runtime &rt, jsi::Object options) {
139
- auto json = jsiToValue<std::string >(rt, options, " json" );
137
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
140
138
141
139
ObjectHandle out;
142
- ByteBuffer b = stringToByteBuffer (json);
143
140
144
- ErrorCode code = anoncreds_revocation_registry_from_json (b , &out);
141
+ ErrorCode code = anoncreds_revocation_registry_from_json (json , &out);
145
142
auto returnValue = createReturnValue (rt, code, &out);
146
143
147
144
// Free memory
148
- delete[] b .data ;
145
+ delete[] json .data ;
149
146
150
147
return returnValue;
151
148
};
152
149
153
150
jsi::Value revocationStatusListFromJson (jsi::Runtime &rt,
154
151
jsi::Object options) {
155
- auto json = jsiToValue<std::string >(rt, options, " json" );
152
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
156
153
157
154
ObjectHandle out;
158
155
159
- ByteBuffer b = stringToByteBuffer (json);
160
- ErrorCode code = anoncreds_revocation_status_list_from_json (b, &out);
161
-
156
+ ErrorCode code = anoncreds_revocation_status_list_from_json (json, &out);
162
157
auto returnValue = createReturnValue (rt, code, &out);
163
158
164
- // free data
165
- delete[] b .data ;
159
+ // Free memory
160
+ delete[] json .data ;
166
161
167
162
return returnValue;
168
163
};
169
164
170
165
171
166
jsi::Value presentationFromJson (jsi::Runtime &rt, jsi::Object options) {
172
- auto json = jsiToValue<std::string >(rt, options, " json" );
167
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
173
168
174
169
ObjectHandle out;
175
- ByteBuffer b = stringToByteBuffer (json);
176
170
177
- ErrorCode code = anoncreds_presentation_from_json (b , &out);
171
+ ErrorCode code = anoncreds_presentation_from_json (json , &out);
178
172
auto returnValue = createReturnValue (rt, code, &out);
179
173
180
174
// Free memory
181
- delete[] b .data ;
175
+ delete[] json .data ;
182
176
183
177
return returnValue;
184
178
};
185
179
186
180
jsi::Value presentationRequestFromJson (jsi::Runtime &rt, jsi::Object options) {
187
- auto json = jsiToValue<std::string >(rt, options, " json" );
181
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
188
182
189
183
ObjectHandle out;
190
- ByteBuffer b = stringToByteBuffer (json);
191
184
192
- ErrorCode code = anoncreds_presentation_request_from_json (b , &out);
185
+ ErrorCode code = anoncreds_presentation_request_from_json (json , &out);
193
186
auto returnValue = createReturnValue (rt, code, &out);
194
187
195
188
// Free memory
196
- delete[] b .data ;
189
+ delete[] json .data ;
197
190
198
191
return returnValue;
199
192
};
200
193
201
194
jsi::Value credentialOfferFromJson (jsi::Runtime &rt, jsi::Object options) {
202
- auto json = jsiToValue<std::string >(rt, options, " json" );
195
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
203
196
204
197
ObjectHandle out;
205
- ByteBuffer b = stringToByteBuffer (json);
206
198
207
- ErrorCode code = anoncreds_credential_offer_from_json (b , &out);
199
+ ErrorCode code = anoncreds_credential_offer_from_json (json , &out);
208
200
auto returnValue = createReturnValue (rt, code, &out);
209
201
210
202
// Free memory
211
- delete[] b .data ;
203
+ delete[] json .data ;
212
204
213
205
return returnValue;
214
206
};
215
207
216
208
jsi::Value schemaFromJson (jsi::Runtime &rt, jsi::Object options) {
217
- auto json = jsiToValue<std::string >(rt, options, " json" );
209
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
218
210
219
211
ObjectHandle out;
220
- ByteBuffer b = stringToByteBuffer (json);
221
212
222
- ErrorCode code = anoncreds_schema_from_json (b , &out);
213
+ ErrorCode code = anoncreds_schema_from_json (json , &out);
223
214
auto returnValue = createReturnValue (rt, code, &out);
224
215
225
216
// Free memory
226
- delete[] b .data ;
217
+ delete[] json .data ;
227
218
228
219
return returnValue;
229
220
};
230
221
231
222
jsi::Value credentialRequestFromJson (jsi::Runtime &rt, jsi::Object options) {
232
- auto json = jsiToValue<std::string >(rt, options, " json" );
223
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
233
224
234
225
ObjectHandle out;
235
- ByteBuffer b = stringToByteBuffer (json);
236
226
237
- ErrorCode code = anoncreds_credential_request_from_json (b , &out);
227
+ ErrorCode code = anoncreds_credential_request_from_json (json , &out);
238
228
auto returnValue = createReturnValue (rt, code, &out);
239
229
240
230
// Free memory
241
- delete[] b .data ;
231
+ delete[] json .data ;
242
232
243
233
return returnValue;
244
234
};
245
235
246
236
jsi::Value credentialRequestMetadataFromJson (jsi::Runtime &rt,
247
237
jsi::Object options) {
248
- auto json = jsiToValue<std::string >(rt, options, " json" );
238
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
249
239
250
240
ObjectHandle out;
251
- ByteBuffer b = stringToByteBuffer (json);
252
241
253
- ErrorCode code = anoncreds_credential_request_metadata_from_json (b , &out);
242
+ ErrorCode code = anoncreds_credential_request_metadata_from_json (json , &out);
254
243
auto returnValue = createReturnValue (rt, code, &out);
255
244
256
245
// Free memory
257
- delete[] b .data ;
246
+ delete[] json .data ;
258
247
259
248
return returnValue;
260
249
};
261
250
262
251
jsi::Value credentialFromJson (jsi::Runtime &rt, jsi::Object options) {
263
- auto json = jsiToValue<std::string >(rt, options, " json" );
252
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
264
253
265
254
ObjectHandle out;
266
- ByteBuffer b = stringToByteBuffer (json);
267
255
268
- ErrorCode code = anoncreds_credential_from_json (b , &out);
256
+ ErrorCode code = anoncreds_credential_from_json (json , &out);
269
257
auto returnValue = createReturnValue (rt, code, &out);
270
258
271
259
// Free memory
272
- delete[] b .data ;
260
+ delete[] json .data ;
273
261
274
262
return returnValue;
275
263
};
276
264
277
265
jsi::Value revocationRegistryDefinitionPrivateFromJson (jsi::Runtime &rt,
278
266
jsi::Object options) {
279
- auto json = jsiToValue<std::string >(rt, options, " json" );
267
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
280
268
281
269
ObjectHandle out;
282
- ByteBuffer b = stringToByteBuffer (json);
283
270
284
271
ErrorCode code =
285
- anoncreds_revocation_registry_definition_private_from_json (b , &out);
272
+ anoncreds_revocation_registry_definition_private_from_json (json , &out);
286
273
auto returnValue = createReturnValue (rt, code, &out);
287
274
288
275
// Free memory
289
- delete[] b .data ;
276
+ delete[] json .data ;
290
277
291
278
return returnValue;
292
279
};
293
280
294
281
jsi::Value revocationStateFromJson (jsi::Runtime &rt, jsi::Object options) {
295
- auto json = jsiToValue<std::string >(rt, options, " json" );
282
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
296
283
297
284
ObjectHandle out;
298
- ByteBuffer b = stringToByteBuffer (json);
299
285
300
- ErrorCode code = anoncreds_revocation_state_from_json (b , &out);
286
+ ErrorCode code = anoncreds_revocation_state_from_json (json , &out);
301
287
auto returnValue = createReturnValue (rt, code, &out);
302
288
303
289
// Free memory
304
- delete[] b .data ;
290
+ delete[] json .data ;
305
291
306
292
return returnValue;
307
293
};
308
294
309
295
jsi::Value credentialDefinitionFromJson (jsi::Runtime &rt, jsi::Object options) {
310
- auto json = jsiToValue<std::string >(rt, options, " json" );
296
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
311
297
312
298
ObjectHandle out;
313
- ByteBuffer b = stringToByteBuffer (json);
314
299
315
- ErrorCode code = anoncreds_credential_definition_from_json (b , &out);
300
+ ErrorCode code = anoncreds_credential_definition_from_json (json , &out);
316
301
auto returnValue = createReturnValue (rt, code, &out);
317
302
318
303
// Free memory
319
- delete[] b .data ;
304
+ delete[] json .data ;
320
305
321
306
return returnValue;
322
307
};
323
308
324
309
jsi::Value credentialDefinitionPrivateFromJson (jsi::Runtime &rt,
325
310
jsi::Object options) {
326
- auto json = jsiToValue<std::string >(rt, options, " json" );
311
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
327
312
328
313
ObjectHandle out;
329
- ByteBuffer b = stringToByteBuffer (json);
330
314
331
- ErrorCode code = anoncreds_credential_definition_private_from_json (b , &out);
315
+ ErrorCode code = anoncreds_credential_definition_private_from_json (json , &out);
332
316
auto returnValue = createReturnValue (rt, code, &out);
333
317
334
318
// Free memory
335
- delete[] b .data ;
319
+ delete[] json .data ;
336
320
337
321
return returnValue;
338
322
};
339
323
340
324
jsi::Value keyCorrectnessProofFromJson (jsi::Runtime &rt, jsi::Object options) {
341
- auto json = jsiToValue<std::string >(rt, options, " json" );
325
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
342
326
343
327
ObjectHandle out;
344
- ByteBuffer b = stringToByteBuffer (json);
345
328
346
- ErrorCode code = anoncreds_key_correctness_proof_from_json (b , &out);
329
+ ErrorCode code = anoncreds_key_correctness_proof_from_json (json , &out);
347
330
auto returnValue = createReturnValue (rt, code, &out);
348
331
349
332
// Free memory
350
- delete[] b .data ;
333
+ delete[] json .data ;
351
334
352
335
return returnValue;
353
336
};
@@ -683,31 +666,29 @@ jsi::Value revocationRegistryDefinitionGetAttribute(jsi::Runtime &rt,
683
666
};
684
667
685
668
jsi::Value w3cPresentationFromJson (jsi::Runtime &rt, jsi::Object options) {
686
- auto json = jsiToValue<std::string >(rt, options, " json" );
669
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
687
670
688
671
ObjectHandle out;
689
- ByteBuffer b = stringToByteBuffer (json);
690
672
691
- ErrorCode code = anoncreds_w3c_presentation_from_json (b , &out);
673
+ ErrorCode code = anoncreds_w3c_presentation_from_json (json , &out);
692
674
auto returnValue = createReturnValue (rt, code, &out);
693
675
694
676
// Free memory
695
- delete[] b .data ;
677
+ delete[] json .data ;
696
678
697
679
return returnValue;
698
680
};
699
681
700
682
jsi::Value w3cCredentialFromJson (jsi::Runtime &rt, jsi::Object options) {
701
- auto json = jsiToValue<std::string >(rt, options, " json" );
683
+ auto json = jsiToValue<ByteBuffer >(rt, options, " json" );
702
684
703
685
ObjectHandle out;
704
- ByteBuffer b = stringToByteBuffer (json);
705
686
706
- ErrorCode code = anoncreds_w3c_credential_from_json (b , &out);
687
+ ErrorCode code = anoncreds_w3c_credential_from_json (json , &out);
707
688
auto returnValue = createReturnValue (rt, code, &out);
708
689
709
690
// Free memory
710
- delete[] b .data ;
691
+ delete[] json .data ;
711
692
712
693
return returnValue;
713
694
};
0 commit comments