github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/certificateprovider/bindings/ffi_bindings.ts (about) 1 import { importModule, Application, heap, Pointer } from "@ffi"; 2 3 importModule("plat/js/webext/certificateprovider", (A: Application) => { 4 const WEBEXT = typeof globalThis.browser === "undefined" ? globalThis.chrome : globalThis.browser; 5 6 return { 7 "constof_Algorithm": (ref: heap.Ref<string>): number => { 8 const idx = [ 9 "RSASSA_PKCS1_v1_5_MD5_SHA1", 10 "RSASSA_PKCS1_v1_5_SHA1", 11 "RSASSA_PKCS1_v1_5_SHA256", 12 "RSASSA_PKCS1_v1_5_SHA384", 13 "RSASSA_PKCS1_v1_5_SHA512", 14 "RSASSA_PSS_SHA256", 15 "RSASSA_PSS_SHA384", 16 "RSASSA_PSS_SHA512", 17 ].indexOf(A.H.get(ref)); 18 return idx < 0 ? 0 : idx + 1; 19 }, 20 "constof_Hash": (ref: heap.Ref<string>): number => { 21 const idx = ["MD5_SHA1", "SHA1", "SHA256", "SHA384", "SHA512"].indexOf(A.H.get(ref)); 22 return idx < 0 ? 0 : idx + 1; 23 }, 24 25 "store_CertificateInfo": (ptr: Pointer, ref: heap.Ref<any>) => { 26 const x = A.H.get<any>(ref); 27 28 if (typeof x === "undefined") { 29 A.store.Bool(ptr + 8, false); 30 A.store.Ref(ptr + 0, undefined); 31 A.store.Ref(ptr + 4, undefined); 32 } else { 33 A.store.Bool(ptr + 8, true); 34 A.store.Ref(ptr + 0, x["certificate"]); 35 A.store.Ref(ptr + 4, x["supportedHashes"]); 36 } 37 }, 38 "load_CertificateInfo": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 39 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 40 41 x["certificate"] = A.load.Ref(ptr + 0, undefined); 42 x["supportedHashes"] = A.load.Ref(ptr + 4, undefined); 43 return create === A.H.TRUE ? A.H.push(x) : ref; 44 }, 45 46 "store_CertificatesUpdateRequest": (ptr: Pointer, ref: heap.Ref<any>) => { 47 const x = A.H.get<any>(ref); 48 49 if (typeof x === "undefined") { 50 A.store.Bool(ptr + 5, false); 51 A.store.Bool(ptr + 4, false); 52 A.store.Int32(ptr + 0, 0); 53 } else { 54 A.store.Bool(ptr + 5, true); 55 A.store.Bool(ptr + 4, "certificatesRequestId" in x ? true : false); 56 A.store.Int32(ptr + 0, x["certificatesRequestId"] === undefined ? 0 : (x["certificatesRequestId"] as number)); 57 } 58 }, 59 "load_CertificatesUpdateRequest": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 60 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 61 62 if (A.load.Bool(ptr + 4)) { 63 x["certificatesRequestId"] = A.load.Int32(ptr + 0); 64 } else { 65 delete x["certificatesRequestId"]; 66 } 67 return create === A.H.TRUE ? A.H.push(x) : ref; 68 }, 69 70 "store_ClientCertificateInfo": (ptr: Pointer, ref: heap.Ref<any>) => { 71 const x = A.H.get<any>(ref); 72 73 if (typeof x === "undefined") { 74 A.store.Bool(ptr + 8, false); 75 A.store.Ref(ptr + 0, undefined); 76 A.store.Ref(ptr + 4, undefined); 77 } else { 78 A.store.Bool(ptr + 8, true); 79 A.store.Ref(ptr + 0, x["certificateChain"]); 80 A.store.Ref(ptr + 4, x["supportedAlgorithms"]); 81 } 82 }, 83 "load_ClientCertificateInfo": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 84 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 85 86 x["certificateChain"] = A.load.Ref(ptr + 0, undefined); 87 x["supportedAlgorithms"] = A.load.Ref(ptr + 4, undefined); 88 return create === A.H.TRUE ? A.H.push(x) : ref; 89 }, 90 "constof_Error": (ref: heap.Ref<string>): number => { 91 const idx = ["GENERAL_ERROR"].indexOf(A.H.get(ref)); 92 return idx < 0 ? 0 : idx + 1; 93 }, 94 "constof_PinRequestErrorType": (ref: heap.Ref<string>): number => { 95 const idx = ["INVALID_PIN", "INVALID_PUK", "MAX_ATTEMPTS_EXCEEDED", "UNKNOWN_ERROR"].indexOf(A.H.get(ref)); 96 return idx < 0 ? 0 : idx + 1; 97 }, 98 "constof_PinRequestType": (ref: heap.Ref<string>): number => { 99 const idx = ["PIN", "PUK"].indexOf(A.H.get(ref)); 100 return idx < 0 ? 0 : idx + 1; 101 }, 102 103 "store_PinResponseDetails": (ptr: Pointer, ref: heap.Ref<any>) => { 104 const x = A.H.get<any>(ref); 105 106 if (typeof x === "undefined") { 107 A.store.Bool(ptr + 4, false); 108 A.store.Ref(ptr + 0, undefined); 109 } else { 110 A.store.Bool(ptr + 4, true); 111 A.store.Ref(ptr + 0, x["userInput"]); 112 } 113 }, 114 "load_PinResponseDetails": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 115 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 116 117 x["userInput"] = A.load.Ref(ptr + 0, undefined); 118 return create === A.H.TRUE ? A.H.push(x) : ref; 119 }, 120 121 "store_ReportSignatureDetails": (ptr: Pointer, ref: heap.Ref<any>) => { 122 const x = A.H.get<any>(ref); 123 124 if (typeof x === "undefined") { 125 A.store.Bool(ptr + 13, false); 126 A.store.Bool(ptr + 12, false); 127 A.store.Int32(ptr + 0, 0); 128 A.store.Enum(ptr + 4, -1); 129 A.store.Ref(ptr + 8, undefined); 130 } else { 131 A.store.Bool(ptr + 13, true); 132 A.store.Bool(ptr + 12, "signRequestId" in x ? true : false); 133 A.store.Int32(ptr + 0, x["signRequestId"] === undefined ? 0 : (x["signRequestId"] as number)); 134 A.store.Enum(ptr + 4, ["GENERAL_ERROR"].indexOf(x["error"] as string)); 135 A.store.Ref(ptr + 8, x["signature"]); 136 } 137 }, 138 "load_ReportSignatureDetails": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 139 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 140 141 if (A.load.Bool(ptr + 12)) { 142 x["signRequestId"] = A.load.Int32(ptr + 0); 143 } else { 144 delete x["signRequestId"]; 145 } 146 x["error"] = A.load.Enum(ptr + 4, ["GENERAL_ERROR"]); 147 x["signature"] = A.load.Ref(ptr + 8, undefined); 148 return create === A.H.TRUE ? A.H.push(x) : ref; 149 }, 150 151 "store_RequestPinDetails": (ptr: Pointer, ref: heap.Ref<any>) => { 152 const x = A.H.get<any>(ref); 153 154 if (typeof x === "undefined") { 155 A.store.Bool(ptr + 18, false); 156 A.store.Bool(ptr + 16, false); 157 A.store.Int32(ptr + 0, 0); 158 A.store.Enum(ptr + 4, -1); 159 A.store.Enum(ptr + 8, -1); 160 A.store.Bool(ptr + 17, false); 161 A.store.Int32(ptr + 12, 0); 162 } else { 163 A.store.Bool(ptr + 18, true); 164 A.store.Bool(ptr + 16, "signRequestId" in x ? true : false); 165 A.store.Int32(ptr + 0, x["signRequestId"] === undefined ? 0 : (x["signRequestId"] as number)); 166 A.store.Enum(ptr + 4, ["PIN", "PUK"].indexOf(x["requestType"] as string)); 167 A.store.Enum( 168 ptr + 8, 169 ["INVALID_PIN", "INVALID_PUK", "MAX_ATTEMPTS_EXCEEDED", "UNKNOWN_ERROR"].indexOf(x["errorType"] as string) 170 ); 171 A.store.Bool(ptr + 17, "attemptsLeft" in x ? true : false); 172 A.store.Int32(ptr + 12, x["attemptsLeft"] === undefined ? 0 : (x["attemptsLeft"] as number)); 173 } 174 }, 175 "load_RequestPinDetails": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 176 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 177 178 if (A.load.Bool(ptr + 16)) { 179 x["signRequestId"] = A.load.Int32(ptr + 0); 180 } else { 181 delete x["signRequestId"]; 182 } 183 x["requestType"] = A.load.Enum(ptr + 4, ["PIN", "PUK"]); 184 x["errorType"] = A.load.Enum(ptr + 8, ["INVALID_PIN", "INVALID_PUK", "MAX_ATTEMPTS_EXCEEDED", "UNKNOWN_ERROR"]); 185 if (A.load.Bool(ptr + 17)) { 186 x["attemptsLeft"] = A.load.Int32(ptr + 12); 187 } else { 188 delete x["attemptsLeft"]; 189 } 190 return create === A.H.TRUE ? A.H.push(x) : ref; 191 }, 192 193 "store_SetCertificatesDetails": (ptr: Pointer, ref: heap.Ref<any>) => { 194 const x = A.H.get<any>(ref); 195 196 if (typeof x === "undefined") { 197 A.store.Bool(ptr + 13, false); 198 A.store.Bool(ptr + 12, false); 199 A.store.Int32(ptr + 0, 0); 200 A.store.Enum(ptr + 4, -1); 201 A.store.Ref(ptr + 8, undefined); 202 } else { 203 A.store.Bool(ptr + 13, true); 204 A.store.Bool(ptr + 12, "certificatesRequestId" in x ? true : false); 205 A.store.Int32(ptr + 0, x["certificatesRequestId"] === undefined ? 0 : (x["certificatesRequestId"] as number)); 206 A.store.Enum(ptr + 4, ["GENERAL_ERROR"].indexOf(x["error"] as string)); 207 A.store.Ref(ptr + 8, x["clientCertificates"]); 208 } 209 }, 210 "load_SetCertificatesDetails": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 211 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 212 213 if (A.load.Bool(ptr + 12)) { 214 x["certificatesRequestId"] = A.load.Int32(ptr + 0); 215 } else { 216 delete x["certificatesRequestId"]; 217 } 218 x["error"] = A.load.Enum(ptr + 4, ["GENERAL_ERROR"]); 219 x["clientCertificates"] = A.load.Ref(ptr + 8, undefined); 220 return create === A.H.TRUE ? A.H.push(x) : ref; 221 }, 222 223 "store_SignRequest": (ptr: Pointer, ref: heap.Ref<any>) => { 224 const x = A.H.get<any>(ref); 225 226 if (typeof x === "undefined") { 227 A.store.Bool(ptr + 17, false); 228 A.store.Bool(ptr + 16, false); 229 A.store.Int32(ptr + 0, 0); 230 A.store.Ref(ptr + 4, undefined); 231 A.store.Enum(ptr + 8, -1); 232 A.store.Ref(ptr + 12, undefined); 233 } else { 234 A.store.Bool(ptr + 17, true); 235 A.store.Bool(ptr + 16, "signRequestId" in x ? true : false); 236 A.store.Int32(ptr + 0, x["signRequestId"] === undefined ? 0 : (x["signRequestId"] as number)); 237 A.store.Ref(ptr + 4, x["digest"]); 238 A.store.Enum(ptr + 8, ["MD5_SHA1", "SHA1", "SHA256", "SHA384", "SHA512"].indexOf(x["hash"] as string)); 239 A.store.Ref(ptr + 12, x["certificate"]); 240 } 241 }, 242 "load_SignRequest": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 243 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 244 245 if (A.load.Bool(ptr + 16)) { 246 x["signRequestId"] = A.load.Int32(ptr + 0); 247 } else { 248 delete x["signRequestId"]; 249 } 250 x["digest"] = A.load.Ref(ptr + 4, undefined); 251 x["hash"] = A.load.Enum(ptr + 8, ["MD5_SHA1", "SHA1", "SHA256", "SHA384", "SHA512"]); 252 x["certificate"] = A.load.Ref(ptr + 12, undefined); 253 return create === A.H.TRUE ? A.H.push(x) : ref; 254 }, 255 256 "store_SignatureRequest": (ptr: Pointer, ref: heap.Ref<any>) => { 257 const x = A.H.get<any>(ref); 258 259 if (typeof x === "undefined") { 260 A.store.Bool(ptr + 17, false); 261 A.store.Bool(ptr + 16, false); 262 A.store.Int32(ptr + 0, 0); 263 A.store.Ref(ptr + 4, undefined); 264 A.store.Enum(ptr + 8, -1); 265 A.store.Ref(ptr + 12, undefined); 266 } else { 267 A.store.Bool(ptr + 17, true); 268 A.store.Bool(ptr + 16, "signRequestId" in x ? true : false); 269 A.store.Int32(ptr + 0, x["signRequestId"] === undefined ? 0 : (x["signRequestId"] as number)); 270 A.store.Ref(ptr + 4, x["input"]); 271 A.store.Enum( 272 ptr + 8, 273 [ 274 "RSASSA_PKCS1_v1_5_MD5_SHA1", 275 "RSASSA_PKCS1_v1_5_SHA1", 276 "RSASSA_PKCS1_v1_5_SHA256", 277 "RSASSA_PKCS1_v1_5_SHA384", 278 "RSASSA_PKCS1_v1_5_SHA512", 279 "RSASSA_PSS_SHA256", 280 "RSASSA_PSS_SHA384", 281 "RSASSA_PSS_SHA512", 282 ].indexOf(x["algorithm"] as string) 283 ); 284 A.store.Ref(ptr + 12, x["certificate"]); 285 } 286 }, 287 "load_SignatureRequest": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 288 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 289 290 if (A.load.Bool(ptr + 16)) { 291 x["signRequestId"] = A.load.Int32(ptr + 0); 292 } else { 293 delete x["signRequestId"]; 294 } 295 x["input"] = A.load.Ref(ptr + 4, undefined); 296 x["algorithm"] = A.load.Enum(ptr + 8, [ 297 "RSASSA_PKCS1_v1_5_MD5_SHA1", 298 "RSASSA_PKCS1_v1_5_SHA1", 299 "RSASSA_PKCS1_v1_5_SHA256", 300 "RSASSA_PKCS1_v1_5_SHA384", 301 "RSASSA_PKCS1_v1_5_SHA512", 302 "RSASSA_PSS_SHA256", 303 "RSASSA_PSS_SHA384", 304 "RSASSA_PSS_SHA512", 305 ]); 306 x["certificate"] = A.load.Ref(ptr + 12, undefined); 307 return create === A.H.TRUE ? A.H.push(x) : ref; 308 }, 309 310 "store_StopPinRequestDetails": (ptr: Pointer, ref: heap.Ref<any>) => { 311 const x = A.H.get<any>(ref); 312 313 if (typeof x === "undefined") { 314 A.store.Bool(ptr + 9, false); 315 A.store.Bool(ptr + 8, false); 316 A.store.Int32(ptr + 0, 0); 317 A.store.Enum(ptr + 4, -1); 318 } else { 319 A.store.Bool(ptr + 9, true); 320 A.store.Bool(ptr + 8, "signRequestId" in x ? true : false); 321 A.store.Int32(ptr + 0, x["signRequestId"] === undefined ? 0 : (x["signRequestId"] as number)); 322 A.store.Enum( 323 ptr + 4, 324 ["INVALID_PIN", "INVALID_PUK", "MAX_ATTEMPTS_EXCEEDED", "UNKNOWN_ERROR"].indexOf(x["errorType"] as string) 325 ); 326 } 327 }, 328 "load_StopPinRequestDetails": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 329 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 330 331 if (A.load.Bool(ptr + 8)) { 332 x["signRequestId"] = A.load.Int32(ptr + 0); 333 } else { 334 delete x["signRequestId"]; 335 } 336 x["errorType"] = A.load.Enum(ptr + 4, ["INVALID_PIN", "INVALID_PUK", "MAX_ATTEMPTS_EXCEEDED", "UNKNOWN_ERROR"]); 337 return create === A.H.TRUE ? A.H.push(x) : ref; 338 }, 339 "has_OnCertificatesRequested": (): heap.Ref<boolean> => { 340 if ( 341 WEBEXT?.certificateProvider?.onCertificatesRequested && 342 "addListener" in WEBEXT?.certificateProvider?.onCertificatesRequested 343 ) { 344 return A.H.TRUE; 345 } 346 return A.H.FALSE; 347 }, 348 "func_OnCertificatesRequested": (fn: Pointer): void => { 349 A.store.Ref(fn, WEBEXT.certificateProvider.onCertificatesRequested.addListener); 350 }, 351 "call_OnCertificatesRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 352 const _ret = WEBEXT.certificateProvider.onCertificatesRequested.addListener(A.H.get<object>(callback)); 353 }, 354 "try_OnCertificatesRequested": ( 355 retPtr: Pointer, 356 errPtr: Pointer, 357 callback: heap.Ref<object> 358 ): heap.Ref<boolean> => { 359 try { 360 const _ret = WEBEXT.certificateProvider.onCertificatesRequested.addListener(A.H.get<object>(callback)); 361 return A.H.TRUE; 362 } catch (err: any) { 363 A.store.Ref(errPtr, err); 364 return A.H.FALSE; 365 } 366 }, 367 "has_OffCertificatesRequested": (): heap.Ref<boolean> => { 368 if ( 369 WEBEXT?.certificateProvider?.onCertificatesRequested && 370 "removeListener" in WEBEXT?.certificateProvider?.onCertificatesRequested 371 ) { 372 return A.H.TRUE; 373 } 374 return A.H.FALSE; 375 }, 376 "func_OffCertificatesRequested": (fn: Pointer): void => { 377 A.store.Ref(fn, WEBEXT.certificateProvider.onCertificatesRequested.removeListener); 378 }, 379 "call_OffCertificatesRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 380 const _ret = WEBEXT.certificateProvider.onCertificatesRequested.removeListener(A.H.get<object>(callback)); 381 }, 382 "try_OffCertificatesRequested": ( 383 retPtr: Pointer, 384 errPtr: Pointer, 385 callback: heap.Ref<object> 386 ): heap.Ref<boolean> => { 387 try { 388 const _ret = WEBEXT.certificateProvider.onCertificatesRequested.removeListener(A.H.get<object>(callback)); 389 return A.H.TRUE; 390 } catch (err: any) { 391 A.store.Ref(errPtr, err); 392 return A.H.FALSE; 393 } 394 }, 395 "has_HasOnCertificatesRequested": (): heap.Ref<boolean> => { 396 if ( 397 WEBEXT?.certificateProvider?.onCertificatesRequested && 398 "hasListener" in WEBEXT?.certificateProvider?.onCertificatesRequested 399 ) { 400 return A.H.TRUE; 401 } 402 return A.H.FALSE; 403 }, 404 "func_HasOnCertificatesRequested": (fn: Pointer): void => { 405 A.store.Ref(fn, WEBEXT.certificateProvider.onCertificatesRequested.hasListener); 406 }, 407 "call_HasOnCertificatesRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 408 const _ret = WEBEXT.certificateProvider.onCertificatesRequested.hasListener(A.H.get<object>(callback)); 409 A.store.Bool(retPtr, _ret); 410 }, 411 "try_HasOnCertificatesRequested": ( 412 retPtr: Pointer, 413 errPtr: Pointer, 414 callback: heap.Ref<object> 415 ): heap.Ref<boolean> => { 416 try { 417 const _ret = WEBEXT.certificateProvider.onCertificatesRequested.hasListener(A.H.get<object>(callback)); 418 A.store.Bool(retPtr, _ret); 419 return A.H.TRUE; 420 } catch (err: any) { 421 A.store.Ref(errPtr, err); 422 return A.H.FALSE; 423 } 424 }, 425 "has_OnCertificatesUpdateRequested": (): heap.Ref<boolean> => { 426 if ( 427 WEBEXT?.certificateProvider?.onCertificatesUpdateRequested && 428 "addListener" in WEBEXT?.certificateProvider?.onCertificatesUpdateRequested 429 ) { 430 return A.H.TRUE; 431 } 432 return A.H.FALSE; 433 }, 434 "func_OnCertificatesUpdateRequested": (fn: Pointer): void => { 435 A.store.Ref(fn, WEBEXT.certificateProvider.onCertificatesUpdateRequested.addListener); 436 }, 437 "call_OnCertificatesUpdateRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 438 const _ret = WEBEXT.certificateProvider.onCertificatesUpdateRequested.addListener(A.H.get<object>(callback)); 439 }, 440 "try_OnCertificatesUpdateRequested": ( 441 retPtr: Pointer, 442 errPtr: Pointer, 443 callback: heap.Ref<object> 444 ): heap.Ref<boolean> => { 445 try { 446 const _ret = WEBEXT.certificateProvider.onCertificatesUpdateRequested.addListener(A.H.get<object>(callback)); 447 return A.H.TRUE; 448 } catch (err: any) { 449 A.store.Ref(errPtr, err); 450 return A.H.FALSE; 451 } 452 }, 453 "has_OffCertificatesUpdateRequested": (): heap.Ref<boolean> => { 454 if ( 455 WEBEXT?.certificateProvider?.onCertificatesUpdateRequested && 456 "removeListener" in WEBEXT?.certificateProvider?.onCertificatesUpdateRequested 457 ) { 458 return A.H.TRUE; 459 } 460 return A.H.FALSE; 461 }, 462 "func_OffCertificatesUpdateRequested": (fn: Pointer): void => { 463 A.store.Ref(fn, WEBEXT.certificateProvider.onCertificatesUpdateRequested.removeListener); 464 }, 465 "call_OffCertificatesUpdateRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 466 const _ret = WEBEXT.certificateProvider.onCertificatesUpdateRequested.removeListener(A.H.get<object>(callback)); 467 }, 468 "try_OffCertificatesUpdateRequested": ( 469 retPtr: Pointer, 470 errPtr: Pointer, 471 callback: heap.Ref<object> 472 ): heap.Ref<boolean> => { 473 try { 474 const _ret = WEBEXT.certificateProvider.onCertificatesUpdateRequested.removeListener(A.H.get<object>(callback)); 475 return A.H.TRUE; 476 } catch (err: any) { 477 A.store.Ref(errPtr, err); 478 return A.H.FALSE; 479 } 480 }, 481 "has_HasOnCertificatesUpdateRequested": (): heap.Ref<boolean> => { 482 if ( 483 WEBEXT?.certificateProvider?.onCertificatesUpdateRequested && 484 "hasListener" in WEBEXT?.certificateProvider?.onCertificatesUpdateRequested 485 ) { 486 return A.H.TRUE; 487 } 488 return A.H.FALSE; 489 }, 490 "func_HasOnCertificatesUpdateRequested": (fn: Pointer): void => { 491 A.store.Ref(fn, WEBEXT.certificateProvider.onCertificatesUpdateRequested.hasListener); 492 }, 493 "call_HasOnCertificatesUpdateRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 494 const _ret = WEBEXT.certificateProvider.onCertificatesUpdateRequested.hasListener(A.H.get<object>(callback)); 495 A.store.Bool(retPtr, _ret); 496 }, 497 "try_HasOnCertificatesUpdateRequested": ( 498 retPtr: Pointer, 499 errPtr: Pointer, 500 callback: heap.Ref<object> 501 ): heap.Ref<boolean> => { 502 try { 503 const _ret = WEBEXT.certificateProvider.onCertificatesUpdateRequested.hasListener(A.H.get<object>(callback)); 504 A.store.Bool(retPtr, _ret); 505 return A.H.TRUE; 506 } catch (err: any) { 507 A.store.Ref(errPtr, err); 508 return A.H.FALSE; 509 } 510 }, 511 "has_OnSignDigestRequested": (): heap.Ref<boolean> => { 512 if ( 513 WEBEXT?.certificateProvider?.onSignDigestRequested && 514 "addListener" in WEBEXT?.certificateProvider?.onSignDigestRequested 515 ) { 516 return A.H.TRUE; 517 } 518 return A.H.FALSE; 519 }, 520 "func_OnSignDigestRequested": (fn: Pointer): void => { 521 A.store.Ref(fn, WEBEXT.certificateProvider.onSignDigestRequested.addListener); 522 }, 523 "call_OnSignDigestRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 524 const _ret = WEBEXT.certificateProvider.onSignDigestRequested.addListener(A.H.get<object>(callback)); 525 }, 526 "try_OnSignDigestRequested": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 527 try { 528 const _ret = WEBEXT.certificateProvider.onSignDigestRequested.addListener(A.H.get<object>(callback)); 529 return A.H.TRUE; 530 } catch (err: any) { 531 A.store.Ref(errPtr, err); 532 return A.H.FALSE; 533 } 534 }, 535 "has_OffSignDigestRequested": (): heap.Ref<boolean> => { 536 if ( 537 WEBEXT?.certificateProvider?.onSignDigestRequested && 538 "removeListener" in WEBEXT?.certificateProvider?.onSignDigestRequested 539 ) { 540 return A.H.TRUE; 541 } 542 return A.H.FALSE; 543 }, 544 "func_OffSignDigestRequested": (fn: Pointer): void => { 545 A.store.Ref(fn, WEBEXT.certificateProvider.onSignDigestRequested.removeListener); 546 }, 547 "call_OffSignDigestRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 548 const _ret = WEBEXT.certificateProvider.onSignDigestRequested.removeListener(A.H.get<object>(callback)); 549 }, 550 "try_OffSignDigestRequested": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 551 try { 552 const _ret = WEBEXT.certificateProvider.onSignDigestRequested.removeListener(A.H.get<object>(callback)); 553 return A.H.TRUE; 554 } catch (err: any) { 555 A.store.Ref(errPtr, err); 556 return A.H.FALSE; 557 } 558 }, 559 "has_HasOnSignDigestRequested": (): heap.Ref<boolean> => { 560 if ( 561 WEBEXT?.certificateProvider?.onSignDigestRequested && 562 "hasListener" in WEBEXT?.certificateProvider?.onSignDigestRequested 563 ) { 564 return A.H.TRUE; 565 } 566 return A.H.FALSE; 567 }, 568 "func_HasOnSignDigestRequested": (fn: Pointer): void => { 569 A.store.Ref(fn, WEBEXT.certificateProvider.onSignDigestRequested.hasListener); 570 }, 571 "call_HasOnSignDigestRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 572 const _ret = WEBEXT.certificateProvider.onSignDigestRequested.hasListener(A.H.get<object>(callback)); 573 A.store.Bool(retPtr, _ret); 574 }, 575 "try_HasOnSignDigestRequested": ( 576 retPtr: Pointer, 577 errPtr: Pointer, 578 callback: heap.Ref<object> 579 ): heap.Ref<boolean> => { 580 try { 581 const _ret = WEBEXT.certificateProvider.onSignDigestRequested.hasListener(A.H.get<object>(callback)); 582 A.store.Bool(retPtr, _ret); 583 return A.H.TRUE; 584 } catch (err: any) { 585 A.store.Ref(errPtr, err); 586 return A.H.FALSE; 587 } 588 }, 589 "has_OnSignatureRequested": (): heap.Ref<boolean> => { 590 if ( 591 WEBEXT?.certificateProvider?.onSignatureRequested && 592 "addListener" in WEBEXT?.certificateProvider?.onSignatureRequested 593 ) { 594 return A.H.TRUE; 595 } 596 return A.H.FALSE; 597 }, 598 "func_OnSignatureRequested": (fn: Pointer): void => { 599 A.store.Ref(fn, WEBEXT.certificateProvider.onSignatureRequested.addListener); 600 }, 601 "call_OnSignatureRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 602 const _ret = WEBEXT.certificateProvider.onSignatureRequested.addListener(A.H.get<object>(callback)); 603 }, 604 "try_OnSignatureRequested": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 605 try { 606 const _ret = WEBEXT.certificateProvider.onSignatureRequested.addListener(A.H.get<object>(callback)); 607 return A.H.TRUE; 608 } catch (err: any) { 609 A.store.Ref(errPtr, err); 610 return A.H.FALSE; 611 } 612 }, 613 "has_OffSignatureRequested": (): heap.Ref<boolean> => { 614 if ( 615 WEBEXT?.certificateProvider?.onSignatureRequested && 616 "removeListener" in WEBEXT?.certificateProvider?.onSignatureRequested 617 ) { 618 return A.H.TRUE; 619 } 620 return A.H.FALSE; 621 }, 622 "func_OffSignatureRequested": (fn: Pointer): void => { 623 A.store.Ref(fn, WEBEXT.certificateProvider.onSignatureRequested.removeListener); 624 }, 625 "call_OffSignatureRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 626 const _ret = WEBEXT.certificateProvider.onSignatureRequested.removeListener(A.H.get<object>(callback)); 627 }, 628 "try_OffSignatureRequested": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 629 try { 630 const _ret = WEBEXT.certificateProvider.onSignatureRequested.removeListener(A.H.get<object>(callback)); 631 return A.H.TRUE; 632 } catch (err: any) { 633 A.store.Ref(errPtr, err); 634 return A.H.FALSE; 635 } 636 }, 637 "has_HasOnSignatureRequested": (): heap.Ref<boolean> => { 638 if ( 639 WEBEXT?.certificateProvider?.onSignatureRequested && 640 "hasListener" in WEBEXT?.certificateProvider?.onSignatureRequested 641 ) { 642 return A.H.TRUE; 643 } 644 return A.H.FALSE; 645 }, 646 "func_HasOnSignatureRequested": (fn: Pointer): void => { 647 A.store.Ref(fn, WEBEXT.certificateProvider.onSignatureRequested.hasListener); 648 }, 649 "call_HasOnSignatureRequested": (retPtr: Pointer, callback: heap.Ref<object>): void => { 650 const _ret = WEBEXT.certificateProvider.onSignatureRequested.hasListener(A.H.get<object>(callback)); 651 A.store.Bool(retPtr, _ret); 652 }, 653 "try_HasOnSignatureRequested": ( 654 retPtr: Pointer, 655 errPtr: Pointer, 656 callback: heap.Ref<object> 657 ): heap.Ref<boolean> => { 658 try { 659 const _ret = WEBEXT.certificateProvider.onSignatureRequested.hasListener(A.H.get<object>(callback)); 660 A.store.Bool(retPtr, _ret); 661 return A.H.TRUE; 662 } catch (err: any) { 663 A.store.Ref(errPtr, err); 664 return A.H.FALSE; 665 } 666 }, 667 "has_ReportSignature": (): heap.Ref<boolean> => { 668 if (WEBEXT?.certificateProvider && "reportSignature" in WEBEXT?.certificateProvider) { 669 return A.H.TRUE; 670 } 671 return A.H.FALSE; 672 }, 673 "func_ReportSignature": (fn: Pointer): void => { 674 A.store.Ref(fn, WEBEXT.certificateProvider.reportSignature); 675 }, 676 "call_ReportSignature": (retPtr: Pointer, details: Pointer): void => { 677 const details_ffi = {}; 678 679 if (A.load.Bool(details + 12)) { 680 details_ffi["signRequestId"] = A.load.Int32(details + 0); 681 } 682 details_ffi["error"] = A.load.Enum(details + 4, ["GENERAL_ERROR"]); 683 details_ffi["signature"] = A.load.Ref(details + 8, undefined); 684 685 const _ret = WEBEXT.certificateProvider.reportSignature(details_ffi); 686 A.store.Ref(retPtr, _ret); 687 }, 688 "try_ReportSignature": (retPtr: Pointer, errPtr: Pointer, details: Pointer): heap.Ref<boolean> => { 689 try { 690 const details_ffi = {}; 691 692 if (A.load.Bool(details + 12)) { 693 details_ffi["signRequestId"] = A.load.Int32(details + 0); 694 } 695 details_ffi["error"] = A.load.Enum(details + 4, ["GENERAL_ERROR"]); 696 details_ffi["signature"] = A.load.Ref(details + 8, undefined); 697 698 const _ret = WEBEXT.certificateProvider.reportSignature(details_ffi); 699 A.store.Ref(retPtr, _ret); 700 return A.H.TRUE; 701 } catch (err: any) { 702 A.store.Ref(errPtr, err); 703 return A.H.FALSE; 704 } 705 }, 706 "has_RequestPin": (): heap.Ref<boolean> => { 707 if (WEBEXT?.certificateProvider && "requestPin" in WEBEXT?.certificateProvider) { 708 return A.H.TRUE; 709 } 710 return A.H.FALSE; 711 }, 712 "func_RequestPin": (fn: Pointer): void => { 713 A.store.Ref(fn, WEBEXT.certificateProvider.requestPin); 714 }, 715 "call_RequestPin": (retPtr: Pointer, details: Pointer): void => { 716 const details_ffi = {}; 717 718 if (A.load.Bool(details + 16)) { 719 details_ffi["signRequestId"] = A.load.Int32(details + 0); 720 } 721 details_ffi["requestType"] = A.load.Enum(details + 4, ["PIN", "PUK"]); 722 details_ffi["errorType"] = A.load.Enum(details + 8, [ 723 "INVALID_PIN", 724 "INVALID_PUK", 725 "MAX_ATTEMPTS_EXCEEDED", 726 "UNKNOWN_ERROR", 727 ]); 728 if (A.load.Bool(details + 17)) { 729 details_ffi["attemptsLeft"] = A.load.Int32(details + 12); 730 } 731 732 const _ret = WEBEXT.certificateProvider.requestPin(details_ffi); 733 A.store.Ref(retPtr, _ret); 734 }, 735 "try_RequestPin": (retPtr: Pointer, errPtr: Pointer, details: Pointer): heap.Ref<boolean> => { 736 try { 737 const details_ffi = {}; 738 739 if (A.load.Bool(details + 16)) { 740 details_ffi["signRequestId"] = A.load.Int32(details + 0); 741 } 742 details_ffi["requestType"] = A.load.Enum(details + 4, ["PIN", "PUK"]); 743 details_ffi["errorType"] = A.load.Enum(details + 8, [ 744 "INVALID_PIN", 745 "INVALID_PUK", 746 "MAX_ATTEMPTS_EXCEEDED", 747 "UNKNOWN_ERROR", 748 ]); 749 if (A.load.Bool(details + 17)) { 750 details_ffi["attemptsLeft"] = A.load.Int32(details + 12); 751 } 752 753 const _ret = WEBEXT.certificateProvider.requestPin(details_ffi); 754 A.store.Ref(retPtr, _ret); 755 return A.H.TRUE; 756 } catch (err: any) { 757 A.store.Ref(errPtr, err); 758 return A.H.FALSE; 759 } 760 }, 761 "has_SetCertificates": (): heap.Ref<boolean> => { 762 if (WEBEXT?.certificateProvider && "setCertificates" in WEBEXT?.certificateProvider) { 763 return A.H.TRUE; 764 } 765 return A.H.FALSE; 766 }, 767 "func_SetCertificates": (fn: Pointer): void => { 768 A.store.Ref(fn, WEBEXT.certificateProvider.setCertificates); 769 }, 770 "call_SetCertificates": (retPtr: Pointer, details: Pointer): void => { 771 const details_ffi = {}; 772 773 if (A.load.Bool(details + 12)) { 774 details_ffi["certificatesRequestId"] = A.load.Int32(details + 0); 775 } 776 details_ffi["error"] = A.load.Enum(details + 4, ["GENERAL_ERROR"]); 777 details_ffi["clientCertificates"] = A.load.Ref(details + 8, undefined); 778 779 const _ret = WEBEXT.certificateProvider.setCertificates(details_ffi); 780 A.store.Ref(retPtr, _ret); 781 }, 782 "try_SetCertificates": (retPtr: Pointer, errPtr: Pointer, details: Pointer): heap.Ref<boolean> => { 783 try { 784 const details_ffi = {}; 785 786 if (A.load.Bool(details + 12)) { 787 details_ffi["certificatesRequestId"] = A.load.Int32(details + 0); 788 } 789 details_ffi["error"] = A.load.Enum(details + 4, ["GENERAL_ERROR"]); 790 details_ffi["clientCertificates"] = A.load.Ref(details + 8, undefined); 791 792 const _ret = WEBEXT.certificateProvider.setCertificates(details_ffi); 793 A.store.Ref(retPtr, _ret); 794 return A.H.TRUE; 795 } catch (err: any) { 796 A.store.Ref(errPtr, err); 797 return A.H.FALSE; 798 } 799 }, 800 "has_StopPinRequest": (): heap.Ref<boolean> => { 801 if (WEBEXT?.certificateProvider && "stopPinRequest" in WEBEXT?.certificateProvider) { 802 return A.H.TRUE; 803 } 804 return A.H.FALSE; 805 }, 806 "func_StopPinRequest": (fn: Pointer): void => { 807 A.store.Ref(fn, WEBEXT.certificateProvider.stopPinRequest); 808 }, 809 "call_StopPinRequest": (retPtr: Pointer, details: Pointer): void => { 810 const details_ffi = {}; 811 812 if (A.load.Bool(details + 8)) { 813 details_ffi["signRequestId"] = A.load.Int32(details + 0); 814 } 815 details_ffi["errorType"] = A.load.Enum(details + 4, [ 816 "INVALID_PIN", 817 "INVALID_PUK", 818 "MAX_ATTEMPTS_EXCEEDED", 819 "UNKNOWN_ERROR", 820 ]); 821 822 const _ret = WEBEXT.certificateProvider.stopPinRequest(details_ffi); 823 A.store.Ref(retPtr, _ret); 824 }, 825 "try_StopPinRequest": (retPtr: Pointer, errPtr: Pointer, details: Pointer): heap.Ref<boolean> => { 826 try { 827 const details_ffi = {}; 828 829 if (A.load.Bool(details + 8)) { 830 details_ffi["signRequestId"] = A.load.Int32(details + 0); 831 } 832 details_ffi["errorType"] = A.load.Enum(details + 4, [ 833 "INVALID_PIN", 834 "INVALID_PUK", 835 "MAX_ATTEMPTS_EXCEEDED", 836 "UNKNOWN_ERROR", 837 ]); 838 839 const _ret = WEBEXT.certificateProvider.stopPinRequest(details_ffi); 840 A.store.Ref(retPtr, _ret); 841 return A.H.TRUE; 842 } catch (err: any) { 843 A.store.Ref(errPtr, err); 844 return A.H.FALSE; 845 } 846 }, 847 }; 848 });