go-webauthn-js
Advanced tools
Comparing version 0.0.2 to 0.0.3
23
index.js
const path = require('path'); | ||
const fs = require('fs'); | ||
require(path.resolve(__dirname, './wasm_exec')); | ||
require(path.resolve(__dirname, './load')); | ||
/** Initialize WASM module and internal server */ | ||
/** Initialize JS module and internal server */ | ||
function initialize(configuration, callback) { | ||
const go = new Go(); | ||
WebAssembly.instantiate(fs.readFileSync(path.resolve(__dirname, './main.wasm')), go.importObject).then((result) => { | ||
go.run(result.instance); | ||
WebAuthnGoWASM.CreateContext(JSON.stringify(configuration), callback); | ||
}).catch((err) => { | ||
callback(err, null); | ||
}); | ||
return go; | ||
require(path.resolve(__dirname, './go-webauthn')); | ||
return WebAuthnGoJS.CreateContext(JSON.stringify(configuration), callback); | ||
} | ||
@@ -20,3 +13,3 @@ | ||
function beginRegistration(user, callback) { | ||
return WebAuthnGoWASM.BeginRegistration( | ||
return WebAuthnGoJS.BeginRegistration( | ||
JSON.stringify(user), | ||
@@ -29,3 +22,3 @@ (err, data) => callback(err, JSON.parse(data)) | ||
function finishRegistration(user, registrationSessionData, registrationBody, callback) { | ||
return WebAuthnGoWASM.FinishRegistration( | ||
return WebAuthnGoJS.FinishRegistration( | ||
JSON.stringify(user), | ||
@@ -40,3 +33,3 @@ JSON.stringify(registrationSessionData), | ||
function beginLogin(user, callback) { | ||
return WebAuthnGoWASM.BeginLogin( | ||
return WebAuthnGoJS.BeginLogin( | ||
JSON.stringify(user), | ||
@@ -49,3 +42,3 @@ (err, data) => callback(err, JSON.parse(data)) | ||
function finishLogin(user, authenticationSessionData, authenticationBody, callback) { | ||
return WebAuthnGoWASM.FinishLogin( | ||
return WebAuthnGoJS.FinishLogin( | ||
JSON.stringify(user), | ||
@@ -52,0 +45,0 @@ JSON.stringify(authenticationSessionData), |
{ | ||
"name": "go-webauthn-js", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "WebAuthn cross compiled from Go to WASM", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
��# G o - W e b A u t h n - J S | ||