github.com/0chain/gosdk@v1.17.11/core/sys/vars.go (about)

     1  // Package sys provides platform-independent interfaces to support webassembly runtime
     2  package sys
     3  
     4  import (
     5  	"time"
     6  )
     7  
     8  var (
     9  	//Files file system implementation on sdk. DiskFS doesn't work on webassembly. it should be initialized with common.NewMemFS()
    10  	Files FS = NewDiskFS()
    11  
    12  	//Sleep  pauses the current goroutine for at least the duration.
    13  	//  time.Sleep will stop webassembly main thread. it should be bridged to javascript method on webassembly sdk
    14  	Sleep = time.Sleep
    15  
    16  	// Sign sign method. it should be initialized on different platform.
    17  	Sign         SignFunc
    18  	SignWithAuth SignFunc
    19  
    20  	// Verify verify method. it should be initialized on different platform.
    21  	Verify VerifyFunc
    22  
    23  	// Verify verify method. it should be initialized on different platform.
    24  	VerifyWith VerifyWithFunc
    25  
    26  	Authorize AuthorizeFunc
    27  
    28  	AuthCommon AuthorizeFunc
    29  )
    30  
    31  // SetAuthorize sets the authorize callback function
    32  func SetAuthorize(auth AuthorizeFunc) {
    33  	Authorize = auth
    34  }
    35  
    36  func SetAuthCommon(auth AuthorizeFunc) {
    37  	AuthCommon = auth
    38  }