github.com/influx6/npkg@v0.8.8/nxid/hostid_js.go (about)

     1  // +build js
     2  
     3  package nxid
     4  
     5  import (
     6  	"crypto/md5"
     7  
     8  	"github.com/gopherjs/gopherjs/js"
     9  )
    10  
    11  func readPlatformMachineID() (string, error) {
    12  	var platform = js.Global.Get("navigator").Get("platform").String()
    13  	var buildID = js.Global.Get("navigator").Get("buildID").String()
    14  	var summation = md5.Sum([]byte(platform + buildID))
    15  	return string(summation), nil
    16  }