github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/platformkeys/apis_js_wasm.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package platformkeys
     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/platformkeys/bindings"
    11  )
    12  
    13  type ClientCertificateType uint32
    14  
    15  const (
    16  	_ ClientCertificateType = iota
    17  
    18  	ClientCertificateType_RSA_SIGN
    19  	ClientCertificateType_ECDSA_SIGN
    20  )
    21  
    22  func (ClientCertificateType) FromRef(str js.Ref) ClientCertificateType {
    23  	return ClientCertificateType(bindings.ConstOfClientCertificateType(str))
    24  }
    25  
    26  func (x ClientCertificateType) String() (string, bool) {
    27  	switch x {
    28  	case ClientCertificateType_RSA_SIGN:
    29  		return "rsaSign", true
    30  	case ClientCertificateType_ECDSA_SIGN:
    31  		return "ecdsaSign", true
    32  	default:
    33  		return "", false
    34  	}
    35  }
    36  
    37  type ClientCertificateRequest struct {
    38  	// CertificateTypes is "ClientCertificateRequest.certificateTypes"
    39  	//
    40  	// Optional
    41  	CertificateTypes js.Array[ClientCertificateType]
    42  	// CertificateAuthorities is "ClientCertificateRequest.certificateAuthorities"
    43  	//
    44  	// Optional
    45  	CertificateAuthorities js.Array[js.ArrayBuffer]
    46  
    47  	FFI_USE bool
    48  }
    49  
    50  // FromRef calls UpdateFrom and returns a ClientCertificateRequest with all fields set.
    51  func (p ClientCertificateRequest) FromRef(ref js.Ref) ClientCertificateRequest {
    52  	p.UpdateFrom(ref)
    53  	return p
    54  }
    55  
    56  // New creates a new ClientCertificateRequest in the application heap.
    57  func (p ClientCertificateRequest) New() js.Ref {
    58  	return bindings.ClientCertificateRequestJSLoad(
    59  		js.Pointer(&p), js.True, 0,
    60  	)
    61  }
    62  
    63  // UpdateFrom copies value of all fields of the heap object to p.
    64  func (p *ClientCertificateRequest) UpdateFrom(ref js.Ref) {
    65  	bindings.ClientCertificateRequestJSStore(
    66  		js.Pointer(p), ref,
    67  	)
    68  }
    69  
    70  // Update writes all fields of the p to the heap object referenced by ref.
    71  func (p *ClientCertificateRequest) Update(ref js.Ref) {
    72  	bindings.ClientCertificateRequestJSLoad(
    73  		js.Pointer(p), js.False, ref,
    74  	)
    75  }
    76  
    77  // FreeMembers frees fields with heap reference, if recursive is true
    78  // free all heap references reachable from p.
    79  func (p *ClientCertificateRequest) FreeMembers(recursive bool) {
    80  	js.Free(
    81  		p.CertificateTypes.Ref(),
    82  		p.CertificateAuthorities.Ref(),
    83  	)
    84  	p.CertificateTypes = p.CertificateTypes.FromRef(js.Undefined)
    85  	p.CertificateAuthorities = p.CertificateAuthorities.FromRef(js.Undefined)
    86  }
    87  
    88  type GetKeyPairCallbackFunc func(this js.Ref, publicKey js.Object, privateKey js.Object) js.Ref
    89  
    90  func (fn GetKeyPairCallbackFunc) Register() js.Func[func(publicKey js.Object, privateKey js.Object)] {
    91  	return js.RegisterCallback[func(publicKey js.Object, privateKey js.Object)](
    92  		fn, abi.FuncPCABIInternal(fn),
    93  	)
    94  }
    95  
    96  func (fn GetKeyPairCallbackFunc) DispatchCallback(
    97  	targetPC uintptr, ctx *js.CallbackContext,
    98  ) {
    99  	args := ctx.Args()
   100  	if len(args) != 2+1 /* js this */ ||
   101  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   102  		js.ThrowInvalidCallbackInvocation()
   103  	}
   104  
   105  	if ctx.Return(fn(
   106  		args[0],
   107  
   108  		js.Object{}.FromRef(args[0+1]),
   109  		js.Object{}.FromRef(args[1+1]),
   110  	)) {
   111  		return
   112  	}
   113  
   114  	js.ThrowCallbackValueNotReturned()
   115  }
   116  
   117  type GetKeyPairCallback[T any] struct {
   118  	Fn  func(arg T, this js.Ref, publicKey js.Object, privateKey js.Object) js.Ref
   119  	Arg T
   120  }
   121  
   122  func (cb *GetKeyPairCallback[T]) Register() js.Func[func(publicKey js.Object, privateKey js.Object)] {
   123  	return js.RegisterCallback[func(publicKey js.Object, privateKey js.Object)](
   124  		cb, abi.FuncPCABIInternal(cb.Fn),
   125  	)
   126  }
   127  
   128  func (cb *GetKeyPairCallback[T]) DispatchCallback(
   129  	targetPC uintptr, ctx *js.CallbackContext,
   130  ) {
   131  	args := ctx.Args()
   132  	if len(args) != 2+1 /* js this */ ||
   133  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   134  		js.ThrowInvalidCallbackInvocation()
   135  	}
   136  
   137  	if ctx.Return(cb.Fn(
   138  		cb.Arg,
   139  		args[0],
   140  
   141  		js.Object{}.FromRef(args[0+1]),
   142  		js.Object{}.FromRef(args[1+1]),
   143  	)) {
   144  		return
   145  	}
   146  
   147  	js.ThrowCallbackValueNotReturned()
   148  }
   149  
   150  type Match struct {
   151  	// Certificate is "Match.certificate"
   152  	//
   153  	// Optional
   154  	Certificate js.ArrayBuffer
   155  	// KeyAlgorithm is "Match.keyAlgorithm"
   156  	//
   157  	// Optional
   158  	KeyAlgorithm js.Object
   159  
   160  	FFI_USE bool
   161  }
   162  
   163  // FromRef calls UpdateFrom and returns a Match with all fields set.
   164  func (p Match) FromRef(ref js.Ref) Match {
   165  	p.UpdateFrom(ref)
   166  	return p
   167  }
   168  
   169  // New creates a new Match in the application heap.
   170  func (p Match) New() js.Ref {
   171  	return bindings.MatchJSLoad(
   172  		js.Pointer(&p), js.True, 0,
   173  	)
   174  }
   175  
   176  // UpdateFrom copies value of all fields of the heap object to p.
   177  func (p *Match) UpdateFrom(ref js.Ref) {
   178  	bindings.MatchJSStore(
   179  		js.Pointer(p), ref,
   180  	)
   181  }
   182  
   183  // Update writes all fields of the p to the heap object referenced by ref.
   184  func (p *Match) Update(ref js.Ref) {
   185  	bindings.MatchJSLoad(
   186  		js.Pointer(p), js.False, ref,
   187  	)
   188  }
   189  
   190  // FreeMembers frees fields with heap reference, if recursive is true
   191  // free all heap references reachable from p.
   192  func (p *Match) FreeMembers(recursive bool) {
   193  	js.Free(
   194  		p.Certificate.Ref(),
   195  		p.KeyAlgorithm.Ref(),
   196  	)
   197  	p.Certificate = p.Certificate.FromRef(js.Undefined)
   198  	p.KeyAlgorithm = p.KeyAlgorithm.FromRef(js.Undefined)
   199  }
   200  
   201  type SelectCallbackFunc func(this js.Ref, matches js.Array[Match]) js.Ref
   202  
   203  func (fn SelectCallbackFunc) Register() js.Func[func(matches js.Array[Match])] {
   204  	return js.RegisterCallback[func(matches js.Array[Match])](
   205  		fn, abi.FuncPCABIInternal(fn),
   206  	)
   207  }
   208  
   209  func (fn SelectCallbackFunc) DispatchCallback(
   210  	targetPC uintptr, ctx *js.CallbackContext,
   211  ) {
   212  	args := ctx.Args()
   213  	if len(args) != 1+1 /* js this */ ||
   214  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   215  		js.ThrowInvalidCallbackInvocation()
   216  	}
   217  
   218  	if ctx.Return(fn(
   219  		args[0],
   220  
   221  		js.Array[Match]{}.FromRef(args[0+1]),
   222  	)) {
   223  		return
   224  	}
   225  
   226  	js.ThrowCallbackValueNotReturned()
   227  }
   228  
   229  type SelectCallback[T any] struct {
   230  	Fn  func(arg T, this js.Ref, matches js.Array[Match]) js.Ref
   231  	Arg T
   232  }
   233  
   234  func (cb *SelectCallback[T]) Register() js.Func[func(matches js.Array[Match])] {
   235  	return js.RegisterCallback[func(matches js.Array[Match])](
   236  		cb, abi.FuncPCABIInternal(cb.Fn),
   237  	)
   238  }
   239  
   240  func (cb *SelectCallback[T]) DispatchCallback(
   241  	targetPC uintptr, ctx *js.CallbackContext,
   242  ) {
   243  	args := ctx.Args()
   244  	if len(args) != 1+1 /* js this */ ||
   245  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   246  		js.ThrowInvalidCallbackInvocation()
   247  	}
   248  
   249  	if ctx.Return(cb.Fn(
   250  		cb.Arg,
   251  		args[0],
   252  
   253  		js.Array[Match]{}.FromRef(args[0+1]),
   254  	)) {
   255  		return
   256  	}
   257  
   258  	js.ThrowCallbackValueNotReturned()
   259  }
   260  
   261  type SelectDetails struct {
   262  	// Request is "SelectDetails.request"
   263  	//
   264  	// Optional
   265  	//
   266  	// NOTE: Request.FFI_USE MUST be set to true to get Request used.
   267  	Request ClientCertificateRequest
   268  	// ClientCerts is "SelectDetails.clientCerts"
   269  	//
   270  	// Optional
   271  	ClientCerts js.Array[js.ArrayBuffer]
   272  	// Interactive is "SelectDetails.interactive"
   273  	//
   274  	// Optional
   275  	//
   276  	// NOTE: FFI_USE_Interactive MUST be set to true to make this field effective.
   277  	Interactive bool
   278  
   279  	FFI_USE_Interactive bool // for Interactive.
   280  
   281  	FFI_USE bool
   282  }
   283  
   284  // FromRef calls UpdateFrom and returns a SelectDetails with all fields set.
   285  func (p SelectDetails) FromRef(ref js.Ref) SelectDetails {
   286  	p.UpdateFrom(ref)
   287  	return p
   288  }
   289  
   290  // New creates a new SelectDetails in the application heap.
   291  func (p SelectDetails) New() js.Ref {
   292  	return bindings.SelectDetailsJSLoad(
   293  		js.Pointer(&p), js.True, 0,
   294  	)
   295  }
   296  
   297  // UpdateFrom copies value of all fields of the heap object to p.
   298  func (p *SelectDetails) UpdateFrom(ref js.Ref) {
   299  	bindings.SelectDetailsJSStore(
   300  		js.Pointer(p), ref,
   301  	)
   302  }
   303  
   304  // Update writes all fields of the p to the heap object referenced by ref.
   305  func (p *SelectDetails) Update(ref js.Ref) {
   306  	bindings.SelectDetailsJSLoad(
   307  		js.Pointer(p), js.False, ref,
   308  	)
   309  }
   310  
   311  // FreeMembers frees fields with heap reference, if recursive is true
   312  // free all heap references reachable from p.
   313  func (p *SelectDetails) FreeMembers(recursive bool) {
   314  	js.Free(
   315  		p.ClientCerts.Ref(),
   316  	)
   317  	p.ClientCerts = p.ClientCerts.FromRef(js.Undefined)
   318  	if recursive {
   319  		p.Request.FreeMembers(true)
   320  	}
   321  }
   322  
   323  type VerificationCallbackFunc func(this js.Ref, result *VerificationResult) js.Ref
   324  
   325  func (fn VerificationCallbackFunc) Register() js.Func[func(result *VerificationResult)] {
   326  	return js.RegisterCallback[func(result *VerificationResult)](
   327  		fn, abi.FuncPCABIInternal(fn),
   328  	)
   329  }
   330  
   331  func (fn VerificationCallbackFunc) DispatchCallback(
   332  	targetPC uintptr, ctx *js.CallbackContext,
   333  ) {
   334  	args := ctx.Args()
   335  	if len(args) != 1+1 /* js this */ ||
   336  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   337  		js.ThrowInvalidCallbackInvocation()
   338  	}
   339  	var arg0 VerificationResult
   340  	arg0.UpdateFrom(args[0+1])
   341  	defer arg0.FreeMembers(true)
   342  
   343  	if ctx.Return(fn(
   344  		args[0],
   345  
   346  		mark.NoEscape(&arg0),
   347  	)) {
   348  		return
   349  	}
   350  
   351  	js.ThrowCallbackValueNotReturned()
   352  }
   353  
   354  type VerificationCallback[T any] struct {
   355  	Fn  func(arg T, this js.Ref, result *VerificationResult) js.Ref
   356  	Arg T
   357  }
   358  
   359  func (cb *VerificationCallback[T]) Register() js.Func[func(result *VerificationResult)] {
   360  	return js.RegisterCallback[func(result *VerificationResult)](
   361  		cb, abi.FuncPCABIInternal(cb.Fn),
   362  	)
   363  }
   364  
   365  func (cb *VerificationCallback[T]) DispatchCallback(
   366  	targetPC uintptr, ctx *js.CallbackContext,
   367  ) {
   368  	args := ctx.Args()
   369  	if len(args) != 1+1 /* js this */ ||
   370  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   371  		js.ThrowInvalidCallbackInvocation()
   372  	}
   373  	var arg0 VerificationResult
   374  	arg0.UpdateFrom(args[0+1])
   375  	defer arg0.FreeMembers(true)
   376  
   377  	if ctx.Return(cb.Fn(
   378  		cb.Arg,
   379  		args[0],
   380  
   381  		mark.NoEscape(&arg0),
   382  	)) {
   383  		return
   384  	}
   385  
   386  	js.ThrowCallbackValueNotReturned()
   387  }
   388  
   389  type VerificationResult struct {
   390  	// Trusted is "VerificationResult.trusted"
   391  	//
   392  	// Optional
   393  	//
   394  	// NOTE: FFI_USE_Trusted MUST be set to true to make this field effective.
   395  	Trusted bool
   396  	// DebugErrors is "VerificationResult.debug_errors"
   397  	//
   398  	// Optional
   399  	DebugErrors js.Array[js.String]
   400  
   401  	FFI_USE_Trusted bool // for Trusted.
   402  
   403  	FFI_USE bool
   404  }
   405  
   406  // FromRef calls UpdateFrom and returns a VerificationResult with all fields set.
   407  func (p VerificationResult) FromRef(ref js.Ref) VerificationResult {
   408  	p.UpdateFrom(ref)
   409  	return p
   410  }
   411  
   412  // New creates a new VerificationResult in the application heap.
   413  func (p VerificationResult) New() js.Ref {
   414  	return bindings.VerificationResultJSLoad(
   415  		js.Pointer(&p), js.True, 0,
   416  	)
   417  }
   418  
   419  // UpdateFrom copies value of all fields of the heap object to p.
   420  func (p *VerificationResult) UpdateFrom(ref js.Ref) {
   421  	bindings.VerificationResultJSStore(
   422  		js.Pointer(p), ref,
   423  	)
   424  }
   425  
   426  // Update writes all fields of the p to the heap object referenced by ref.
   427  func (p *VerificationResult) Update(ref js.Ref) {
   428  	bindings.VerificationResultJSLoad(
   429  		js.Pointer(p), js.False, ref,
   430  	)
   431  }
   432  
   433  // FreeMembers frees fields with heap reference, if recursive is true
   434  // free all heap references reachable from p.
   435  func (p *VerificationResult) FreeMembers(recursive bool) {
   436  	js.Free(
   437  		p.DebugErrors.Ref(),
   438  	)
   439  	p.DebugErrors = p.DebugErrors.FromRef(js.Undefined)
   440  }
   441  
   442  type VerificationDetails struct {
   443  	// ServerCertificateChain is "VerificationDetails.serverCertificateChain"
   444  	//
   445  	// Optional
   446  	ServerCertificateChain js.Array[js.ArrayBuffer]
   447  	// Hostname is "VerificationDetails.hostname"
   448  	//
   449  	// Optional
   450  	Hostname js.String
   451  
   452  	FFI_USE bool
   453  }
   454  
   455  // FromRef calls UpdateFrom and returns a VerificationDetails with all fields set.
   456  func (p VerificationDetails) FromRef(ref js.Ref) VerificationDetails {
   457  	p.UpdateFrom(ref)
   458  	return p
   459  }
   460  
   461  // New creates a new VerificationDetails in the application heap.
   462  func (p VerificationDetails) New() js.Ref {
   463  	return bindings.VerificationDetailsJSLoad(
   464  		js.Pointer(&p), js.True, 0,
   465  	)
   466  }
   467  
   468  // UpdateFrom copies value of all fields of the heap object to p.
   469  func (p *VerificationDetails) UpdateFrom(ref js.Ref) {
   470  	bindings.VerificationDetailsJSStore(
   471  		js.Pointer(p), ref,
   472  	)
   473  }
   474  
   475  // Update writes all fields of the p to the heap object referenced by ref.
   476  func (p *VerificationDetails) Update(ref js.Ref) {
   477  	bindings.VerificationDetailsJSLoad(
   478  		js.Pointer(p), js.False, ref,
   479  	)
   480  }
   481  
   482  // FreeMembers frees fields with heap reference, if recursive is true
   483  // free all heap references reachable from p.
   484  func (p *VerificationDetails) FreeMembers(recursive bool) {
   485  	js.Free(
   486  		p.ServerCertificateChain.Ref(),
   487  		p.Hostname.Ref(),
   488  	)
   489  	p.ServerCertificateChain = p.ServerCertificateChain.FromRef(js.Undefined)
   490  	p.Hostname = p.Hostname.FromRef(js.Undefined)
   491  }
   492  
   493  // HasFuncGetKeyPair returns true if the function "WEBEXT.platformKeys.getKeyPair" exists.
   494  func HasFuncGetKeyPair() bool {
   495  	return js.True == bindings.HasFuncGetKeyPair()
   496  }
   497  
   498  // FuncGetKeyPair returns the function "WEBEXT.platformKeys.getKeyPair".
   499  func FuncGetKeyPair() (fn js.Func[func(certificate js.ArrayBuffer, parameters js.Object, callback js.Func[func(publicKey js.Object, privateKey js.Object)])]) {
   500  	bindings.FuncGetKeyPair(
   501  		js.Pointer(&fn),
   502  	)
   503  	return
   504  }
   505  
   506  // GetKeyPair calls the function "WEBEXT.platformKeys.getKeyPair" directly.
   507  func GetKeyPair(certificate js.ArrayBuffer, parameters js.Object, callback js.Func[func(publicKey js.Object, privateKey js.Object)]) (ret js.Void) {
   508  	bindings.CallGetKeyPair(
   509  		js.Pointer(&ret),
   510  		certificate.Ref(),
   511  		parameters.Ref(),
   512  		callback.Ref(),
   513  	)
   514  
   515  	return
   516  }
   517  
   518  // TryGetKeyPair calls the function "WEBEXT.platformKeys.getKeyPair"
   519  // in a try/catch block and returns (_, err, ok = false) when it went through
   520  // the catch clause.
   521  func TryGetKeyPair(certificate js.ArrayBuffer, parameters js.Object, callback js.Func[func(publicKey js.Object, privateKey js.Object)]) (ret js.Void, exception js.Any, ok bool) {
   522  	ok = js.True == bindings.TryGetKeyPair(
   523  		js.Pointer(&ret), js.Pointer(&exception),
   524  		certificate.Ref(),
   525  		parameters.Ref(),
   526  		callback.Ref(),
   527  	)
   528  
   529  	return
   530  }
   531  
   532  // HasFuncGetKeyPairBySpki returns true if the function "WEBEXT.platformKeys.getKeyPairBySpki" exists.
   533  func HasFuncGetKeyPairBySpki() bool {
   534  	return js.True == bindings.HasFuncGetKeyPairBySpki()
   535  }
   536  
   537  // FuncGetKeyPairBySpki returns the function "WEBEXT.platformKeys.getKeyPairBySpki".
   538  func FuncGetKeyPairBySpki() (fn js.Func[func(publicKeySpkiDer js.ArrayBuffer, parameters js.Object, callback js.Func[func(publicKey js.Object, privateKey js.Object)])]) {
   539  	bindings.FuncGetKeyPairBySpki(
   540  		js.Pointer(&fn),
   541  	)
   542  	return
   543  }
   544  
   545  // GetKeyPairBySpki calls the function "WEBEXT.platformKeys.getKeyPairBySpki" directly.
   546  func GetKeyPairBySpki(publicKeySpkiDer js.ArrayBuffer, parameters js.Object, callback js.Func[func(publicKey js.Object, privateKey js.Object)]) (ret js.Void) {
   547  	bindings.CallGetKeyPairBySpki(
   548  		js.Pointer(&ret),
   549  		publicKeySpkiDer.Ref(),
   550  		parameters.Ref(),
   551  		callback.Ref(),
   552  	)
   553  
   554  	return
   555  }
   556  
   557  // TryGetKeyPairBySpki calls the function "WEBEXT.platformKeys.getKeyPairBySpki"
   558  // in a try/catch block and returns (_, err, ok = false) when it went through
   559  // the catch clause.
   560  func TryGetKeyPairBySpki(publicKeySpkiDer js.ArrayBuffer, parameters js.Object, callback js.Func[func(publicKey js.Object, privateKey js.Object)]) (ret js.Void, exception js.Any, ok bool) {
   561  	ok = js.True == bindings.TryGetKeyPairBySpki(
   562  		js.Pointer(&ret), js.Pointer(&exception),
   563  		publicKeySpkiDer.Ref(),
   564  		parameters.Ref(),
   565  		callback.Ref(),
   566  	)
   567  
   568  	return
   569  }
   570  
   571  // HasFuncSelectClientCertificates returns true if the function "WEBEXT.platformKeys.selectClientCertificates" exists.
   572  func HasFuncSelectClientCertificates() bool {
   573  	return js.True == bindings.HasFuncSelectClientCertificates()
   574  }
   575  
   576  // FuncSelectClientCertificates returns the function "WEBEXT.platformKeys.selectClientCertificates".
   577  func FuncSelectClientCertificates() (fn js.Func[func(details SelectDetails, callback js.Func[func(matches js.Array[Match])])]) {
   578  	bindings.FuncSelectClientCertificates(
   579  		js.Pointer(&fn),
   580  	)
   581  	return
   582  }
   583  
   584  // SelectClientCertificates calls the function "WEBEXT.platformKeys.selectClientCertificates" directly.
   585  func SelectClientCertificates(details SelectDetails, callback js.Func[func(matches js.Array[Match])]) (ret js.Void) {
   586  	bindings.CallSelectClientCertificates(
   587  		js.Pointer(&ret),
   588  		js.Pointer(&details),
   589  		callback.Ref(),
   590  	)
   591  
   592  	return
   593  }
   594  
   595  // TrySelectClientCertificates calls the function "WEBEXT.platformKeys.selectClientCertificates"
   596  // in a try/catch block and returns (_, err, ok = false) when it went through
   597  // the catch clause.
   598  func TrySelectClientCertificates(details SelectDetails, callback js.Func[func(matches js.Array[Match])]) (ret js.Void, exception js.Any, ok bool) {
   599  	ok = js.True == bindings.TrySelectClientCertificates(
   600  		js.Pointer(&ret), js.Pointer(&exception),
   601  		js.Pointer(&details),
   602  		callback.Ref(),
   603  	)
   604  
   605  	return
   606  }
   607  
   608  // HasFuncSubtleCrypto returns true if the function "WEBEXT.platformKeys.subtleCrypto" exists.
   609  func HasFuncSubtleCrypto() bool {
   610  	return js.True == bindings.HasFuncSubtleCrypto()
   611  }
   612  
   613  // FuncSubtleCrypto returns the function "WEBEXT.platformKeys.subtleCrypto".
   614  func FuncSubtleCrypto() (fn js.Func[func() js.Object]) {
   615  	bindings.FuncSubtleCrypto(
   616  		js.Pointer(&fn),
   617  	)
   618  	return
   619  }
   620  
   621  // SubtleCrypto calls the function "WEBEXT.platformKeys.subtleCrypto" directly.
   622  func SubtleCrypto() (ret js.Object) {
   623  	bindings.CallSubtleCrypto(
   624  		js.Pointer(&ret),
   625  	)
   626  
   627  	return
   628  }
   629  
   630  // TrySubtleCrypto calls the function "WEBEXT.platformKeys.subtleCrypto"
   631  // in a try/catch block and returns (_, err, ok = false) when it went through
   632  // the catch clause.
   633  func TrySubtleCrypto() (ret js.Object, exception js.Any, ok bool) {
   634  	ok = js.True == bindings.TrySubtleCrypto(
   635  		js.Pointer(&ret), js.Pointer(&exception),
   636  	)
   637  
   638  	return
   639  }
   640  
   641  // HasFuncVerifyTLSServerCertificate returns true if the function "WEBEXT.platformKeys.verifyTLSServerCertificate" exists.
   642  func HasFuncVerifyTLSServerCertificate() bool {
   643  	return js.True == bindings.HasFuncVerifyTLSServerCertificate()
   644  }
   645  
   646  // FuncVerifyTLSServerCertificate returns the function "WEBEXT.platformKeys.verifyTLSServerCertificate".
   647  func FuncVerifyTLSServerCertificate() (fn js.Func[func(details VerificationDetails, callback js.Func[func(result *VerificationResult)])]) {
   648  	bindings.FuncVerifyTLSServerCertificate(
   649  		js.Pointer(&fn),
   650  	)
   651  	return
   652  }
   653  
   654  // VerifyTLSServerCertificate calls the function "WEBEXT.platformKeys.verifyTLSServerCertificate" directly.
   655  func VerifyTLSServerCertificate(details VerificationDetails, callback js.Func[func(result *VerificationResult)]) (ret js.Void) {
   656  	bindings.CallVerifyTLSServerCertificate(
   657  		js.Pointer(&ret),
   658  		js.Pointer(&details),
   659  		callback.Ref(),
   660  	)
   661  
   662  	return
   663  }
   664  
   665  // TryVerifyTLSServerCertificate calls the function "WEBEXT.platformKeys.verifyTLSServerCertificate"
   666  // in a try/catch block and returns (_, err, ok = false) when it went through
   667  // the catch clause.
   668  func TryVerifyTLSServerCertificate(details VerificationDetails, callback js.Func[func(result *VerificationResult)]) (ret js.Void, exception js.Any, ok bool) {
   669  	ok = js.True == bindings.TryVerifyTLSServerCertificate(
   670  		js.Pointer(&ret), js.Pointer(&exception),
   671  		js.Pointer(&details),
   672  		callback.Ref(),
   673  	)
   674  
   675  	return
   676  }