github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/enterprise/platformkeysprivate/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package platformkeysprivate 5 6 import ( 7 "github.com/primecitizens/pcz/std/ffi/js" 8 "github.com/primecitizens/pcz/std/plat/js/webext/enterprise/platformkeysprivate/bindings" 9 ) 10 11 // HasFuncChallengeMachineKey returns true if the function "WEBEXT.enterprise.platformKeysPrivate.challengeMachineKey" exists. 12 func HasFuncChallengeMachineKey() bool { 13 return js.True == bindings.HasFuncChallengeMachineKey() 14 } 15 16 // FuncChallengeMachineKey returns the function "WEBEXT.enterprise.platformKeysPrivate.challengeMachineKey". 17 func FuncChallengeMachineKey() (fn js.Func[func(challenge js.String) js.Promise[js.String]]) { 18 bindings.FuncChallengeMachineKey( 19 js.Pointer(&fn), 20 ) 21 return 22 } 23 24 // ChallengeMachineKey calls the function "WEBEXT.enterprise.platformKeysPrivate.challengeMachineKey" directly. 25 func ChallengeMachineKey(challenge js.String) (ret js.Promise[js.String]) { 26 bindings.CallChallengeMachineKey( 27 js.Pointer(&ret), 28 challenge.Ref(), 29 ) 30 31 return 32 } 33 34 // TryChallengeMachineKey calls the function "WEBEXT.enterprise.platformKeysPrivate.challengeMachineKey" 35 // in a try/catch block and returns (_, err, ok = false) when it went through 36 // the catch clause. 37 func TryChallengeMachineKey(challenge js.String) (ret js.Promise[js.String], exception js.Any, ok bool) { 38 ok = js.True == bindings.TryChallengeMachineKey( 39 js.Pointer(&ret), js.Pointer(&exception), 40 challenge.Ref(), 41 ) 42 43 return 44 } 45 46 // HasFuncChallengeUserKey returns true if the function "WEBEXT.enterprise.platformKeysPrivate.challengeUserKey" exists. 47 func HasFuncChallengeUserKey() bool { 48 return js.True == bindings.HasFuncChallengeUserKey() 49 } 50 51 // FuncChallengeUserKey returns the function "WEBEXT.enterprise.platformKeysPrivate.challengeUserKey". 52 func FuncChallengeUserKey() (fn js.Func[func(challenge js.String, registerKey bool) js.Promise[js.String]]) { 53 bindings.FuncChallengeUserKey( 54 js.Pointer(&fn), 55 ) 56 return 57 } 58 59 // ChallengeUserKey calls the function "WEBEXT.enterprise.platformKeysPrivate.challengeUserKey" directly. 60 func ChallengeUserKey(challenge js.String, registerKey bool) (ret js.Promise[js.String]) { 61 bindings.CallChallengeUserKey( 62 js.Pointer(&ret), 63 challenge.Ref(), 64 js.Bool(bool(registerKey)), 65 ) 66 67 return 68 } 69 70 // TryChallengeUserKey calls the function "WEBEXT.enterprise.platformKeysPrivate.challengeUserKey" 71 // in a try/catch block and returns (_, err, ok = false) when it went through 72 // the catch clause. 73 func TryChallengeUserKey(challenge js.String, registerKey bool) (ret js.Promise[js.String], exception js.Any, ok bool) { 74 ok = js.True == bindings.TryChallengeUserKey( 75 js.Pointer(&ret), js.Pointer(&exception), 76 challenge.Ref(), 77 js.Bool(bool(registerKey)), 78 ) 79 80 return 81 }