The past days I've worked on the Colyseus v0.10 framework and the Haxe externs from Serjek. It is not as strong as the crypto generator but at least it works.Ĭonfirmed v0.10 & Serjek Externs with Simple Stencyl Extension (Kind of like the NyanCat demo) Str += charactersToUse.charAt( Math.floor((Math.random() * (Date.now().getTime() % (charactersToUse.length) ) ))) GetRandomString: public static function getRandomString(length:Int, ?charactersToUse = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"):String Return haxe.io.Bytes.ofString(getRandomString(16)) I opted for another approach for the windows build from in Stencyl: #if windows There is a define done that is going to add a build.xml file to the publication method and Stencyl does not handle that. When I tried to incorporate the trandom library into Stencyl it gave me problems. This worked when I did a lime build & test for windows. Var input = sys.io.File.read("\\Device\\KsecDD") Notepad \HaxeToolkit\haxe\lib\haxe-ws\git\src\haxe\net\Crypto.hx
STENCYL MULTIPLAYER INSTALL
So I tried another crypto number generator: haxelib install trandomĮdit the project.xml to include this haxelib
"but reading the special file \Device\KsecDD does not work as in UNIX" The wikipedia linked in the sourcecode of Crypto.hx mentioned : Windows and Android publication worked out of the box. This.key = Base64.encode(haxe.io.Bytes.ofString("ABCDEFGHIJKLMNOP")) Īfter this ofString-"16-bytes" the error was gone and hand-shake was made!!! this.key = Base64.encode(Crypto.getSecureRandomBytes(16)) // This generates the secure source of random bytes Reason: ĭebugging leads me to this part trace("WebSocketGeneric.hx. Now to build / test it again: cd \HaxeToolkit\colyseus-hx\example\openflĮrror: Can't find a secure source of random bytes. Library haxe-ws current version is now git Endel you are a true Master! C:\HaxeToolkit\haxe\lib>haxelib git haxe-ws