github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/quickunlockprivate/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package quickunlockprivate 5 6 import ( 7 "github.com/primecitizens/pcz/std/core/abi" 8 "github.com/primecitizens/pcz/std/core/mark" 9 "github.com/primecitizens/pcz/std/ffi/js" 10 "github.com/primecitizens/pcz/std/plat/js/webext/quickunlockprivate/bindings" 11 ) 12 13 type BooleanResultCallbackFunc func(this js.Ref, value bool) js.Ref 14 15 func (fn BooleanResultCallbackFunc) Register() js.Func[func(value bool)] { 16 return js.RegisterCallback[func(value bool)]( 17 fn, abi.FuncPCABIInternal(fn), 18 ) 19 } 20 21 func (fn BooleanResultCallbackFunc) DispatchCallback( 22 targetPC uintptr, ctx *js.CallbackContext, 23 ) { 24 args := ctx.Args() 25 if len(args) != 1+1 /* js this */ || 26 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 27 js.ThrowInvalidCallbackInvocation() 28 } 29 30 if ctx.Return(fn( 31 args[0], 32 33 args[0+1] == js.True, 34 )) { 35 return 36 } 37 38 js.ThrowCallbackValueNotReturned() 39 } 40 41 type BooleanResultCallback[T any] struct { 42 Fn func(arg T, this js.Ref, value bool) js.Ref 43 Arg T 44 } 45 46 func (cb *BooleanResultCallback[T]) Register() js.Func[func(value bool)] { 47 return js.RegisterCallback[func(value bool)]( 48 cb, abi.FuncPCABIInternal(cb.Fn), 49 ) 50 } 51 52 func (cb *BooleanResultCallback[T]) DispatchCallback( 53 targetPC uintptr, ctx *js.CallbackContext, 54 ) { 55 args := ctx.Args() 56 if len(args) != 1+1 /* js this */ || 57 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 58 js.ThrowInvalidCallbackInvocation() 59 } 60 61 if ctx.Return(cb.Fn( 62 cb.Arg, 63 args[0], 64 65 args[0+1] == js.True, 66 )) { 67 return 68 } 69 70 js.ThrowCallbackValueNotReturned() 71 } 72 73 type CredentialProblem uint32 74 75 const ( 76 _ CredentialProblem = iota 77 78 CredentialProblem_TOO_SHORT 79 CredentialProblem_TOO_LONG 80 CredentialProblem_TOO_WEAK 81 CredentialProblem_CONTAINS_NONDIGIT 82 ) 83 84 func (CredentialProblem) FromRef(str js.Ref) CredentialProblem { 85 return CredentialProblem(bindings.ConstOfCredentialProblem(str)) 86 } 87 88 func (x CredentialProblem) String() (string, bool) { 89 switch x { 90 case CredentialProblem_TOO_SHORT: 91 return "TOO_SHORT", true 92 case CredentialProblem_TOO_LONG: 93 return "TOO_LONG", true 94 case CredentialProblem_TOO_WEAK: 95 return "TOO_WEAK", true 96 case CredentialProblem_CONTAINS_NONDIGIT: 97 return "CONTAINS_NONDIGIT", true 98 default: 99 return "", false 100 } 101 } 102 103 type CredentialCheck struct { 104 // Errors is "CredentialCheck.errors" 105 // 106 // Optional 107 Errors js.Array[CredentialProblem] 108 // Warnings is "CredentialCheck.warnings" 109 // 110 // Optional 111 Warnings js.Array[CredentialProblem] 112 113 FFI_USE bool 114 } 115 116 // FromRef calls UpdateFrom and returns a CredentialCheck with all fields set. 117 func (p CredentialCheck) FromRef(ref js.Ref) CredentialCheck { 118 p.UpdateFrom(ref) 119 return p 120 } 121 122 // New creates a new CredentialCheck in the application heap. 123 func (p CredentialCheck) New() js.Ref { 124 return bindings.CredentialCheckJSLoad( 125 js.Pointer(&p), js.True, 0, 126 ) 127 } 128 129 // UpdateFrom copies value of all fields of the heap object to p. 130 func (p *CredentialCheck) UpdateFrom(ref js.Ref) { 131 bindings.CredentialCheckJSStore( 132 js.Pointer(p), ref, 133 ) 134 } 135 136 // Update writes all fields of the p to the heap object referenced by ref. 137 func (p *CredentialCheck) Update(ref js.Ref) { 138 bindings.CredentialCheckJSLoad( 139 js.Pointer(p), js.False, ref, 140 ) 141 } 142 143 // FreeMembers frees fields with heap reference, if recursive is true 144 // free all heap references reachable from p. 145 func (p *CredentialCheck) FreeMembers(recursive bool) { 146 js.Free( 147 p.Errors.Ref(), 148 p.Warnings.Ref(), 149 ) 150 p.Errors = p.Errors.FromRef(js.Undefined) 151 p.Warnings = p.Warnings.FromRef(js.Undefined) 152 } 153 154 type CredentialCheckCallbackFunc func(this js.Ref, check *CredentialCheck) js.Ref 155 156 func (fn CredentialCheckCallbackFunc) Register() js.Func[func(check *CredentialCheck)] { 157 return js.RegisterCallback[func(check *CredentialCheck)]( 158 fn, abi.FuncPCABIInternal(fn), 159 ) 160 } 161 162 func (fn CredentialCheckCallbackFunc) DispatchCallback( 163 targetPC uintptr, ctx *js.CallbackContext, 164 ) { 165 args := ctx.Args() 166 if len(args) != 1+1 /* js this */ || 167 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 168 js.ThrowInvalidCallbackInvocation() 169 } 170 var arg0 CredentialCheck 171 arg0.UpdateFrom(args[0+1]) 172 defer arg0.FreeMembers(true) 173 174 if ctx.Return(fn( 175 args[0], 176 177 mark.NoEscape(&arg0), 178 )) { 179 return 180 } 181 182 js.ThrowCallbackValueNotReturned() 183 } 184 185 type CredentialCheckCallback[T any] struct { 186 Fn func(arg T, this js.Ref, check *CredentialCheck) js.Ref 187 Arg T 188 } 189 190 func (cb *CredentialCheckCallback[T]) Register() js.Func[func(check *CredentialCheck)] { 191 return js.RegisterCallback[func(check *CredentialCheck)]( 192 cb, abi.FuncPCABIInternal(cb.Fn), 193 ) 194 } 195 196 func (cb *CredentialCheckCallback[T]) DispatchCallback( 197 targetPC uintptr, ctx *js.CallbackContext, 198 ) { 199 args := ctx.Args() 200 if len(args) != 1+1 /* js this */ || 201 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 202 js.ThrowInvalidCallbackInvocation() 203 } 204 var arg0 CredentialCheck 205 arg0.UpdateFrom(args[0+1]) 206 defer arg0.FreeMembers(true) 207 208 if ctx.Return(cb.Fn( 209 cb.Arg, 210 args[0], 211 212 mark.NoEscape(&arg0), 213 )) { 214 return 215 } 216 217 js.ThrowCallbackValueNotReturned() 218 } 219 220 type CredentialRequirements struct { 221 // MinLength is "CredentialRequirements.minLength" 222 // 223 // Optional 224 // 225 // NOTE: FFI_USE_MinLength MUST be set to true to make this field effective. 226 MinLength int32 227 // MaxLength is "CredentialRequirements.maxLength" 228 // 229 // Optional 230 // 231 // NOTE: FFI_USE_MaxLength MUST be set to true to make this field effective. 232 MaxLength int32 233 234 FFI_USE_MinLength bool // for MinLength. 235 FFI_USE_MaxLength bool // for MaxLength. 236 237 FFI_USE bool 238 } 239 240 // FromRef calls UpdateFrom and returns a CredentialRequirements with all fields set. 241 func (p CredentialRequirements) FromRef(ref js.Ref) CredentialRequirements { 242 p.UpdateFrom(ref) 243 return p 244 } 245 246 // New creates a new CredentialRequirements in the application heap. 247 func (p CredentialRequirements) New() js.Ref { 248 return bindings.CredentialRequirementsJSLoad( 249 js.Pointer(&p), js.True, 0, 250 ) 251 } 252 253 // UpdateFrom copies value of all fields of the heap object to p. 254 func (p *CredentialRequirements) UpdateFrom(ref js.Ref) { 255 bindings.CredentialRequirementsJSStore( 256 js.Pointer(p), ref, 257 ) 258 } 259 260 // Update writes all fields of the p to the heap object referenced by ref. 261 func (p *CredentialRequirements) Update(ref js.Ref) { 262 bindings.CredentialRequirementsJSLoad( 263 js.Pointer(p), js.False, ref, 264 ) 265 } 266 267 // FreeMembers frees fields with heap reference, if recursive is true 268 // free all heap references reachable from p. 269 func (p *CredentialRequirements) FreeMembers(recursive bool) { 270 } 271 272 type CredentialRequirementsCallbackFunc func(this js.Ref, requirements *CredentialRequirements) js.Ref 273 274 func (fn CredentialRequirementsCallbackFunc) Register() js.Func[func(requirements *CredentialRequirements)] { 275 return js.RegisterCallback[func(requirements *CredentialRequirements)]( 276 fn, abi.FuncPCABIInternal(fn), 277 ) 278 } 279 280 func (fn CredentialRequirementsCallbackFunc) DispatchCallback( 281 targetPC uintptr, ctx *js.CallbackContext, 282 ) { 283 args := ctx.Args() 284 if len(args) != 1+1 /* js this */ || 285 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 286 js.ThrowInvalidCallbackInvocation() 287 } 288 var arg0 CredentialRequirements 289 arg0.UpdateFrom(args[0+1]) 290 defer arg0.FreeMembers(true) 291 292 if ctx.Return(fn( 293 args[0], 294 295 mark.NoEscape(&arg0), 296 )) { 297 return 298 } 299 300 js.ThrowCallbackValueNotReturned() 301 } 302 303 type CredentialRequirementsCallback[T any] struct { 304 Fn func(arg T, this js.Ref, requirements *CredentialRequirements) js.Ref 305 Arg T 306 } 307 308 func (cb *CredentialRequirementsCallback[T]) Register() js.Func[func(requirements *CredentialRequirements)] { 309 return js.RegisterCallback[func(requirements *CredentialRequirements)]( 310 cb, abi.FuncPCABIInternal(cb.Fn), 311 ) 312 } 313 314 func (cb *CredentialRequirementsCallback[T]) DispatchCallback( 315 targetPC uintptr, ctx *js.CallbackContext, 316 ) { 317 args := ctx.Args() 318 if len(args) != 1+1 /* js this */ || 319 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 320 js.ThrowInvalidCallbackInvocation() 321 } 322 var arg0 CredentialRequirements 323 arg0.UpdateFrom(args[0+1]) 324 defer arg0.FreeMembers(true) 325 326 if ctx.Return(cb.Fn( 327 cb.Arg, 328 args[0], 329 330 mark.NoEscape(&arg0), 331 )) { 332 return 333 } 334 335 js.ThrowCallbackValueNotReturned() 336 } 337 338 type ModesCallbackFunc func(this js.Ref, modes js.Array[QuickUnlockMode]) js.Ref 339 340 func (fn ModesCallbackFunc) Register() js.Func[func(modes js.Array[QuickUnlockMode])] { 341 return js.RegisterCallback[func(modes js.Array[QuickUnlockMode])]( 342 fn, abi.FuncPCABIInternal(fn), 343 ) 344 } 345 346 func (fn ModesCallbackFunc) DispatchCallback( 347 targetPC uintptr, ctx *js.CallbackContext, 348 ) { 349 args := ctx.Args() 350 if len(args) != 1+1 /* js this */ || 351 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 352 js.ThrowInvalidCallbackInvocation() 353 } 354 355 if ctx.Return(fn( 356 args[0], 357 358 js.Array[QuickUnlockMode]{}.FromRef(args[0+1]), 359 )) { 360 return 361 } 362 363 js.ThrowCallbackValueNotReturned() 364 } 365 366 type ModesCallback[T any] struct { 367 Fn func(arg T, this js.Ref, modes js.Array[QuickUnlockMode]) js.Ref 368 Arg T 369 } 370 371 func (cb *ModesCallback[T]) Register() js.Func[func(modes js.Array[QuickUnlockMode])] { 372 return js.RegisterCallback[func(modes js.Array[QuickUnlockMode])]( 373 cb, abi.FuncPCABIInternal(cb.Fn), 374 ) 375 } 376 377 func (cb *ModesCallback[T]) DispatchCallback( 378 targetPC uintptr, ctx *js.CallbackContext, 379 ) { 380 args := ctx.Args() 381 if len(args) != 1+1 /* js this */ || 382 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 383 js.ThrowInvalidCallbackInvocation() 384 } 385 386 if ctx.Return(cb.Fn( 387 cb.Arg, 388 args[0], 389 390 js.Array[QuickUnlockMode]{}.FromRef(args[0+1]), 391 )) { 392 return 393 } 394 395 js.ThrowCallbackValueNotReturned() 396 } 397 398 type QuickUnlockMode uint32 399 400 const ( 401 _ QuickUnlockMode = iota 402 403 QuickUnlockMode_PIN 404 ) 405 406 func (QuickUnlockMode) FromRef(str js.Ref) QuickUnlockMode { 407 return QuickUnlockMode(bindings.ConstOfQuickUnlockMode(str)) 408 } 409 410 func (x QuickUnlockMode) String() (string, bool) { 411 switch x { 412 case QuickUnlockMode_PIN: 413 return "PIN", true 414 default: 415 return "", false 416 } 417 } 418 419 type TokenInfo struct { 420 // Token is "TokenInfo.token" 421 // 422 // Optional 423 Token js.String 424 // LifetimeSeconds is "TokenInfo.lifetimeSeconds" 425 // 426 // Optional 427 // 428 // NOTE: FFI_USE_LifetimeSeconds MUST be set to true to make this field effective. 429 LifetimeSeconds int32 430 431 FFI_USE_LifetimeSeconds bool // for LifetimeSeconds. 432 433 FFI_USE bool 434 } 435 436 // FromRef calls UpdateFrom and returns a TokenInfo with all fields set. 437 func (p TokenInfo) FromRef(ref js.Ref) TokenInfo { 438 p.UpdateFrom(ref) 439 return p 440 } 441 442 // New creates a new TokenInfo in the application heap. 443 func (p TokenInfo) New() js.Ref { 444 return bindings.TokenInfoJSLoad( 445 js.Pointer(&p), js.True, 0, 446 ) 447 } 448 449 // UpdateFrom copies value of all fields of the heap object to p. 450 func (p *TokenInfo) UpdateFrom(ref js.Ref) { 451 bindings.TokenInfoJSStore( 452 js.Pointer(p), ref, 453 ) 454 } 455 456 // Update writes all fields of the p to the heap object referenced by ref. 457 func (p *TokenInfo) Update(ref js.Ref) { 458 bindings.TokenInfoJSLoad( 459 js.Pointer(p), js.False, ref, 460 ) 461 } 462 463 // FreeMembers frees fields with heap reference, if recursive is true 464 // free all heap references reachable from p. 465 func (p *TokenInfo) FreeMembers(recursive bool) { 466 js.Free( 467 p.Token.Ref(), 468 ) 469 p.Token = p.Token.FromRef(js.Undefined) 470 } 471 472 type TokenResultCallbackFunc func(this js.Ref, result *TokenInfo) js.Ref 473 474 func (fn TokenResultCallbackFunc) Register() js.Func[func(result *TokenInfo)] { 475 return js.RegisterCallback[func(result *TokenInfo)]( 476 fn, abi.FuncPCABIInternal(fn), 477 ) 478 } 479 480 func (fn TokenResultCallbackFunc) DispatchCallback( 481 targetPC uintptr, ctx *js.CallbackContext, 482 ) { 483 args := ctx.Args() 484 if len(args) != 1+1 /* js this */ || 485 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 486 js.ThrowInvalidCallbackInvocation() 487 } 488 var arg0 TokenInfo 489 arg0.UpdateFrom(args[0+1]) 490 defer arg0.FreeMembers(true) 491 492 if ctx.Return(fn( 493 args[0], 494 495 mark.NoEscape(&arg0), 496 )) { 497 return 498 } 499 500 js.ThrowCallbackValueNotReturned() 501 } 502 503 type TokenResultCallback[T any] struct { 504 Fn func(arg T, this js.Ref, result *TokenInfo) js.Ref 505 Arg T 506 } 507 508 func (cb *TokenResultCallback[T]) Register() js.Func[func(result *TokenInfo)] { 509 return js.RegisterCallback[func(result *TokenInfo)]( 510 cb, abi.FuncPCABIInternal(cb.Fn), 511 ) 512 } 513 514 func (cb *TokenResultCallback[T]) DispatchCallback( 515 targetPC uintptr, ctx *js.CallbackContext, 516 ) { 517 args := ctx.Args() 518 if len(args) != 1+1 /* js this */ || 519 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 520 js.ThrowInvalidCallbackInvocation() 521 } 522 var arg0 TokenInfo 523 arg0.UpdateFrom(args[0+1]) 524 defer arg0.FreeMembers(true) 525 526 if ctx.Return(cb.Fn( 527 cb.Arg, 528 args[0], 529 530 mark.NoEscape(&arg0), 531 )) { 532 return 533 } 534 535 js.ThrowCallbackValueNotReturned() 536 } 537 538 type VoidResultCallbackFunc func(this js.Ref) js.Ref 539 540 func (fn VoidResultCallbackFunc) Register() js.Func[func()] { 541 return js.RegisterCallback[func()]( 542 fn, abi.FuncPCABIInternal(fn), 543 ) 544 } 545 546 func (fn VoidResultCallbackFunc) DispatchCallback( 547 targetPC uintptr, ctx *js.CallbackContext, 548 ) { 549 args := ctx.Args() 550 if len(args) != 0+1 /* js this */ || 551 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 552 js.ThrowInvalidCallbackInvocation() 553 } 554 555 if ctx.Return(fn( 556 args[0], 557 )) { 558 return 559 } 560 561 js.ThrowCallbackValueNotReturned() 562 } 563 564 type VoidResultCallback[T any] struct { 565 Fn func(arg T, this js.Ref) js.Ref 566 Arg T 567 } 568 569 func (cb *VoidResultCallback[T]) Register() js.Func[func()] { 570 return js.RegisterCallback[func()]( 571 cb, abi.FuncPCABIInternal(cb.Fn), 572 ) 573 } 574 575 func (cb *VoidResultCallback[T]) DispatchCallback( 576 targetPC uintptr, ctx *js.CallbackContext, 577 ) { 578 args := ctx.Args() 579 if len(args) != 0+1 /* js this */ || 580 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 581 js.ThrowInvalidCallbackInvocation() 582 } 583 584 if ctx.Return(cb.Fn( 585 cb.Arg, 586 args[0], 587 )) { 588 return 589 } 590 591 js.ThrowCallbackValueNotReturned() 592 } 593 594 // HasFuncCanAuthenticatePin returns true if the function "WEBEXT.quickUnlockPrivate.canAuthenticatePin" exists. 595 func HasFuncCanAuthenticatePin() bool { 596 return js.True == bindings.HasFuncCanAuthenticatePin() 597 } 598 599 // FuncCanAuthenticatePin returns the function "WEBEXT.quickUnlockPrivate.canAuthenticatePin". 600 func FuncCanAuthenticatePin() (fn js.Func[func() js.Promise[js.Boolean]]) { 601 bindings.FuncCanAuthenticatePin( 602 js.Pointer(&fn), 603 ) 604 return 605 } 606 607 // CanAuthenticatePin calls the function "WEBEXT.quickUnlockPrivate.canAuthenticatePin" directly. 608 func CanAuthenticatePin() (ret js.Promise[js.Boolean]) { 609 bindings.CallCanAuthenticatePin( 610 js.Pointer(&ret), 611 ) 612 613 return 614 } 615 616 // TryCanAuthenticatePin calls the function "WEBEXT.quickUnlockPrivate.canAuthenticatePin" 617 // in a try/catch block and returns (_, err, ok = false) when it went through 618 // the catch clause. 619 func TryCanAuthenticatePin() (ret js.Promise[js.Boolean], exception js.Any, ok bool) { 620 ok = js.True == bindings.TryCanAuthenticatePin( 621 js.Pointer(&ret), js.Pointer(&exception), 622 ) 623 624 return 625 } 626 627 // HasFuncCheckCredential returns true if the function "WEBEXT.quickUnlockPrivate.checkCredential" exists. 628 func HasFuncCheckCredential() bool { 629 return js.True == bindings.HasFuncCheckCredential() 630 } 631 632 // FuncCheckCredential returns the function "WEBEXT.quickUnlockPrivate.checkCredential". 633 func FuncCheckCredential() (fn js.Func[func(mode QuickUnlockMode, credential js.String) js.Promise[CredentialCheck]]) { 634 bindings.FuncCheckCredential( 635 js.Pointer(&fn), 636 ) 637 return 638 } 639 640 // CheckCredential calls the function "WEBEXT.quickUnlockPrivate.checkCredential" directly. 641 func CheckCredential(mode QuickUnlockMode, credential js.String) (ret js.Promise[CredentialCheck]) { 642 bindings.CallCheckCredential( 643 js.Pointer(&ret), 644 uint32(mode), 645 credential.Ref(), 646 ) 647 648 return 649 } 650 651 // TryCheckCredential calls the function "WEBEXT.quickUnlockPrivate.checkCredential" 652 // in a try/catch block and returns (_, err, ok = false) when it went through 653 // the catch clause. 654 func TryCheckCredential(mode QuickUnlockMode, credential js.String) (ret js.Promise[CredentialCheck], exception js.Any, ok bool) { 655 ok = js.True == bindings.TryCheckCredential( 656 js.Pointer(&ret), js.Pointer(&exception), 657 uint32(mode), 658 credential.Ref(), 659 ) 660 661 return 662 } 663 664 // HasFuncGetActiveModes returns true if the function "WEBEXT.quickUnlockPrivate.getActiveModes" exists. 665 func HasFuncGetActiveModes() bool { 666 return js.True == bindings.HasFuncGetActiveModes() 667 } 668 669 // FuncGetActiveModes returns the function "WEBEXT.quickUnlockPrivate.getActiveModes". 670 func FuncGetActiveModes() (fn js.Func[func() js.Promise[js.Array[QuickUnlockMode]]]) { 671 bindings.FuncGetActiveModes( 672 js.Pointer(&fn), 673 ) 674 return 675 } 676 677 // GetActiveModes calls the function "WEBEXT.quickUnlockPrivate.getActiveModes" directly. 678 func GetActiveModes() (ret js.Promise[js.Array[QuickUnlockMode]]) { 679 bindings.CallGetActiveModes( 680 js.Pointer(&ret), 681 ) 682 683 return 684 } 685 686 // TryGetActiveModes calls the function "WEBEXT.quickUnlockPrivate.getActiveModes" 687 // in a try/catch block and returns (_, err, ok = false) when it went through 688 // the catch clause. 689 func TryGetActiveModes() (ret js.Promise[js.Array[QuickUnlockMode]], exception js.Any, ok bool) { 690 ok = js.True == bindings.TryGetActiveModes( 691 js.Pointer(&ret), js.Pointer(&exception), 692 ) 693 694 return 695 } 696 697 // HasFuncGetAuthToken returns true if the function "WEBEXT.quickUnlockPrivate.getAuthToken" exists. 698 func HasFuncGetAuthToken() bool { 699 return js.True == bindings.HasFuncGetAuthToken() 700 } 701 702 // FuncGetAuthToken returns the function "WEBEXT.quickUnlockPrivate.getAuthToken". 703 func FuncGetAuthToken() (fn js.Func[func(accountPassword js.String) js.Promise[TokenInfo]]) { 704 bindings.FuncGetAuthToken( 705 js.Pointer(&fn), 706 ) 707 return 708 } 709 710 // GetAuthToken calls the function "WEBEXT.quickUnlockPrivate.getAuthToken" directly. 711 func GetAuthToken(accountPassword js.String) (ret js.Promise[TokenInfo]) { 712 bindings.CallGetAuthToken( 713 js.Pointer(&ret), 714 accountPassword.Ref(), 715 ) 716 717 return 718 } 719 720 // TryGetAuthToken calls the function "WEBEXT.quickUnlockPrivate.getAuthToken" 721 // in a try/catch block and returns (_, err, ok = false) when it went through 722 // the catch clause. 723 func TryGetAuthToken(accountPassword js.String) (ret js.Promise[TokenInfo], exception js.Any, ok bool) { 724 ok = js.True == bindings.TryGetAuthToken( 725 js.Pointer(&ret), js.Pointer(&exception), 726 accountPassword.Ref(), 727 ) 728 729 return 730 } 731 732 // HasFuncGetAvailableModes returns true if the function "WEBEXT.quickUnlockPrivate.getAvailableModes" exists. 733 func HasFuncGetAvailableModes() bool { 734 return js.True == bindings.HasFuncGetAvailableModes() 735 } 736 737 // FuncGetAvailableModes returns the function "WEBEXT.quickUnlockPrivate.getAvailableModes". 738 func FuncGetAvailableModes() (fn js.Func[func() js.Promise[js.Array[QuickUnlockMode]]]) { 739 bindings.FuncGetAvailableModes( 740 js.Pointer(&fn), 741 ) 742 return 743 } 744 745 // GetAvailableModes calls the function "WEBEXT.quickUnlockPrivate.getAvailableModes" directly. 746 func GetAvailableModes() (ret js.Promise[js.Array[QuickUnlockMode]]) { 747 bindings.CallGetAvailableModes( 748 js.Pointer(&ret), 749 ) 750 751 return 752 } 753 754 // TryGetAvailableModes calls the function "WEBEXT.quickUnlockPrivate.getAvailableModes" 755 // in a try/catch block and returns (_, err, ok = false) when it went through 756 // the catch clause. 757 func TryGetAvailableModes() (ret js.Promise[js.Array[QuickUnlockMode]], exception js.Any, ok bool) { 758 ok = js.True == bindings.TryGetAvailableModes( 759 js.Pointer(&ret), js.Pointer(&exception), 760 ) 761 762 return 763 } 764 765 // HasFuncGetCredentialRequirements returns true if the function "WEBEXT.quickUnlockPrivate.getCredentialRequirements" exists. 766 func HasFuncGetCredentialRequirements() bool { 767 return js.True == bindings.HasFuncGetCredentialRequirements() 768 } 769 770 // FuncGetCredentialRequirements returns the function "WEBEXT.quickUnlockPrivate.getCredentialRequirements". 771 func FuncGetCredentialRequirements() (fn js.Func[func(mode QuickUnlockMode) js.Promise[CredentialRequirements]]) { 772 bindings.FuncGetCredentialRequirements( 773 js.Pointer(&fn), 774 ) 775 return 776 } 777 778 // GetCredentialRequirements calls the function "WEBEXT.quickUnlockPrivate.getCredentialRequirements" directly. 779 func GetCredentialRequirements(mode QuickUnlockMode) (ret js.Promise[CredentialRequirements]) { 780 bindings.CallGetCredentialRequirements( 781 js.Pointer(&ret), 782 uint32(mode), 783 ) 784 785 return 786 } 787 788 // TryGetCredentialRequirements calls the function "WEBEXT.quickUnlockPrivate.getCredentialRequirements" 789 // in a try/catch block and returns (_, err, ok = false) when it went through 790 // the catch clause. 791 func TryGetCredentialRequirements(mode QuickUnlockMode) (ret js.Promise[CredentialRequirements], exception js.Any, ok bool) { 792 ok = js.True == bindings.TryGetCredentialRequirements( 793 js.Pointer(&ret), js.Pointer(&exception), 794 uint32(mode), 795 ) 796 797 return 798 } 799 800 type OnActiveModesChangedEventCallbackFunc func(this js.Ref, activeModes js.Array[QuickUnlockMode]) js.Ref 801 802 func (fn OnActiveModesChangedEventCallbackFunc) Register() js.Func[func(activeModes js.Array[QuickUnlockMode])] { 803 return js.RegisterCallback[func(activeModes js.Array[QuickUnlockMode])]( 804 fn, abi.FuncPCABIInternal(fn), 805 ) 806 } 807 808 func (fn OnActiveModesChangedEventCallbackFunc) DispatchCallback( 809 targetPC uintptr, ctx *js.CallbackContext, 810 ) { 811 args := ctx.Args() 812 if len(args) != 1+1 /* js this */ || 813 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 814 js.ThrowInvalidCallbackInvocation() 815 } 816 817 if ctx.Return(fn( 818 args[0], 819 820 js.Array[QuickUnlockMode]{}.FromRef(args[0+1]), 821 )) { 822 return 823 } 824 825 js.ThrowCallbackValueNotReturned() 826 } 827 828 type OnActiveModesChangedEventCallback[T any] struct { 829 Fn func(arg T, this js.Ref, activeModes js.Array[QuickUnlockMode]) js.Ref 830 Arg T 831 } 832 833 func (cb *OnActiveModesChangedEventCallback[T]) Register() js.Func[func(activeModes js.Array[QuickUnlockMode])] { 834 return js.RegisterCallback[func(activeModes js.Array[QuickUnlockMode])]( 835 cb, abi.FuncPCABIInternal(cb.Fn), 836 ) 837 } 838 839 func (cb *OnActiveModesChangedEventCallback[T]) DispatchCallback( 840 targetPC uintptr, ctx *js.CallbackContext, 841 ) { 842 args := ctx.Args() 843 if len(args) != 1+1 /* js this */ || 844 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 845 js.ThrowInvalidCallbackInvocation() 846 } 847 848 if ctx.Return(cb.Fn( 849 cb.Arg, 850 args[0], 851 852 js.Array[QuickUnlockMode]{}.FromRef(args[0+1]), 853 )) { 854 return 855 } 856 857 js.ThrowCallbackValueNotReturned() 858 } 859 860 // HasFuncOnActiveModesChanged returns true if the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.addListener" exists. 861 func HasFuncOnActiveModesChanged() bool { 862 return js.True == bindings.HasFuncOnActiveModesChanged() 863 } 864 865 // FuncOnActiveModesChanged returns the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.addListener". 866 func FuncOnActiveModesChanged() (fn js.Func[func(callback js.Func[func(activeModes js.Array[QuickUnlockMode])])]) { 867 bindings.FuncOnActiveModesChanged( 868 js.Pointer(&fn), 869 ) 870 return 871 } 872 873 // OnActiveModesChanged calls the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.addListener" directly. 874 func OnActiveModesChanged(callback js.Func[func(activeModes js.Array[QuickUnlockMode])]) (ret js.Void) { 875 bindings.CallOnActiveModesChanged( 876 js.Pointer(&ret), 877 callback.Ref(), 878 ) 879 880 return 881 } 882 883 // TryOnActiveModesChanged calls the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.addListener" 884 // in a try/catch block and returns (_, err, ok = false) when it went through 885 // the catch clause. 886 func TryOnActiveModesChanged(callback js.Func[func(activeModes js.Array[QuickUnlockMode])]) (ret js.Void, exception js.Any, ok bool) { 887 ok = js.True == bindings.TryOnActiveModesChanged( 888 js.Pointer(&ret), js.Pointer(&exception), 889 callback.Ref(), 890 ) 891 892 return 893 } 894 895 // HasFuncOffActiveModesChanged returns true if the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.removeListener" exists. 896 func HasFuncOffActiveModesChanged() bool { 897 return js.True == bindings.HasFuncOffActiveModesChanged() 898 } 899 900 // FuncOffActiveModesChanged returns the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.removeListener". 901 func FuncOffActiveModesChanged() (fn js.Func[func(callback js.Func[func(activeModes js.Array[QuickUnlockMode])])]) { 902 bindings.FuncOffActiveModesChanged( 903 js.Pointer(&fn), 904 ) 905 return 906 } 907 908 // OffActiveModesChanged calls the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.removeListener" directly. 909 func OffActiveModesChanged(callback js.Func[func(activeModes js.Array[QuickUnlockMode])]) (ret js.Void) { 910 bindings.CallOffActiveModesChanged( 911 js.Pointer(&ret), 912 callback.Ref(), 913 ) 914 915 return 916 } 917 918 // TryOffActiveModesChanged calls the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.removeListener" 919 // in a try/catch block and returns (_, err, ok = false) when it went through 920 // the catch clause. 921 func TryOffActiveModesChanged(callback js.Func[func(activeModes js.Array[QuickUnlockMode])]) (ret js.Void, exception js.Any, ok bool) { 922 ok = js.True == bindings.TryOffActiveModesChanged( 923 js.Pointer(&ret), js.Pointer(&exception), 924 callback.Ref(), 925 ) 926 927 return 928 } 929 930 // HasFuncHasOnActiveModesChanged returns true if the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.hasListener" exists. 931 func HasFuncHasOnActiveModesChanged() bool { 932 return js.True == bindings.HasFuncHasOnActiveModesChanged() 933 } 934 935 // FuncHasOnActiveModesChanged returns the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.hasListener". 936 func FuncHasOnActiveModesChanged() (fn js.Func[func(callback js.Func[func(activeModes js.Array[QuickUnlockMode])]) bool]) { 937 bindings.FuncHasOnActiveModesChanged( 938 js.Pointer(&fn), 939 ) 940 return 941 } 942 943 // HasOnActiveModesChanged calls the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.hasListener" directly. 944 func HasOnActiveModesChanged(callback js.Func[func(activeModes js.Array[QuickUnlockMode])]) (ret bool) { 945 bindings.CallHasOnActiveModesChanged( 946 js.Pointer(&ret), 947 callback.Ref(), 948 ) 949 950 return 951 } 952 953 // TryHasOnActiveModesChanged calls the function "WEBEXT.quickUnlockPrivate.onActiveModesChanged.hasListener" 954 // in a try/catch block and returns (_, err, ok = false) when it went through 955 // the catch clause. 956 func TryHasOnActiveModesChanged(callback js.Func[func(activeModes js.Array[QuickUnlockMode])]) (ret bool, exception js.Any, ok bool) { 957 ok = js.True == bindings.TryHasOnActiveModesChanged( 958 js.Pointer(&ret), js.Pointer(&exception), 959 callback.Ref(), 960 ) 961 962 return 963 } 964 965 // HasFuncSetLockScreenEnabled returns true if the function "WEBEXT.quickUnlockPrivate.setLockScreenEnabled" exists. 966 func HasFuncSetLockScreenEnabled() bool { 967 return js.True == bindings.HasFuncSetLockScreenEnabled() 968 } 969 970 // FuncSetLockScreenEnabled returns the function "WEBEXT.quickUnlockPrivate.setLockScreenEnabled". 971 func FuncSetLockScreenEnabled() (fn js.Func[func(token js.String, enabled bool) js.Promise[js.Void]]) { 972 bindings.FuncSetLockScreenEnabled( 973 js.Pointer(&fn), 974 ) 975 return 976 } 977 978 // SetLockScreenEnabled calls the function "WEBEXT.quickUnlockPrivate.setLockScreenEnabled" directly. 979 func SetLockScreenEnabled(token js.String, enabled bool) (ret js.Promise[js.Void]) { 980 bindings.CallSetLockScreenEnabled( 981 js.Pointer(&ret), 982 token.Ref(), 983 js.Bool(bool(enabled)), 984 ) 985 986 return 987 } 988 989 // TrySetLockScreenEnabled calls the function "WEBEXT.quickUnlockPrivate.setLockScreenEnabled" 990 // in a try/catch block and returns (_, err, ok = false) when it went through 991 // the catch clause. 992 func TrySetLockScreenEnabled(token js.String, enabled bool) (ret js.Promise[js.Void], exception js.Any, ok bool) { 993 ok = js.True == bindings.TrySetLockScreenEnabled( 994 js.Pointer(&ret), js.Pointer(&exception), 995 token.Ref(), 996 js.Bool(bool(enabled)), 997 ) 998 999 return 1000 } 1001 1002 // HasFuncSetModes returns true if the function "WEBEXT.quickUnlockPrivate.setModes" exists. 1003 func HasFuncSetModes() bool { 1004 return js.True == bindings.HasFuncSetModes() 1005 } 1006 1007 // FuncSetModes returns the function "WEBEXT.quickUnlockPrivate.setModes". 1008 func FuncSetModes() (fn js.Func[func(token js.String, modes js.Array[QuickUnlockMode], credentials js.Array[js.String]) js.Promise[js.Void]]) { 1009 bindings.FuncSetModes( 1010 js.Pointer(&fn), 1011 ) 1012 return 1013 } 1014 1015 // SetModes calls the function "WEBEXT.quickUnlockPrivate.setModes" directly. 1016 func SetModes(token js.String, modes js.Array[QuickUnlockMode], credentials js.Array[js.String]) (ret js.Promise[js.Void]) { 1017 bindings.CallSetModes( 1018 js.Pointer(&ret), 1019 token.Ref(), 1020 modes.Ref(), 1021 credentials.Ref(), 1022 ) 1023 1024 return 1025 } 1026 1027 // TrySetModes calls the function "WEBEXT.quickUnlockPrivate.setModes" 1028 // in a try/catch block and returns (_, err, ok = false) when it went through 1029 // the catch clause. 1030 func TrySetModes(token js.String, modes js.Array[QuickUnlockMode], credentials js.Array[js.String]) (ret js.Promise[js.Void], exception js.Any, ok bool) { 1031 ok = js.True == bindings.TrySetModes( 1032 js.Pointer(&ret), js.Pointer(&exception), 1033 token.Ref(), 1034 modes.Ref(), 1035 credentials.Ref(), 1036 ) 1037 1038 return 1039 } 1040 1041 // HasFuncSetPinAutosubmitEnabled returns true if the function "WEBEXT.quickUnlockPrivate.setPinAutosubmitEnabled" exists. 1042 func HasFuncSetPinAutosubmitEnabled() bool { 1043 return js.True == bindings.HasFuncSetPinAutosubmitEnabled() 1044 } 1045 1046 // FuncSetPinAutosubmitEnabled returns the function "WEBEXT.quickUnlockPrivate.setPinAutosubmitEnabled". 1047 func FuncSetPinAutosubmitEnabled() (fn js.Func[func(token js.String, pin js.String, enabled bool) js.Promise[js.Boolean]]) { 1048 bindings.FuncSetPinAutosubmitEnabled( 1049 js.Pointer(&fn), 1050 ) 1051 return 1052 } 1053 1054 // SetPinAutosubmitEnabled calls the function "WEBEXT.quickUnlockPrivate.setPinAutosubmitEnabled" directly. 1055 func SetPinAutosubmitEnabled(token js.String, pin js.String, enabled bool) (ret js.Promise[js.Boolean]) { 1056 bindings.CallSetPinAutosubmitEnabled( 1057 js.Pointer(&ret), 1058 token.Ref(), 1059 pin.Ref(), 1060 js.Bool(bool(enabled)), 1061 ) 1062 1063 return 1064 } 1065 1066 // TrySetPinAutosubmitEnabled calls the function "WEBEXT.quickUnlockPrivate.setPinAutosubmitEnabled" 1067 // in a try/catch block and returns (_, err, ok = false) when it went through 1068 // the catch clause. 1069 func TrySetPinAutosubmitEnabled(token js.String, pin js.String, enabled bool) (ret js.Promise[js.Boolean], exception js.Any, ok bool) { 1070 ok = js.True == bindings.TrySetPinAutosubmitEnabled( 1071 js.Pointer(&ret), js.Pointer(&exception), 1072 token.Ref(), 1073 pin.Ref(), 1074 js.Bool(bool(enabled)), 1075 ) 1076 1077 return 1078 }