-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c350be
commit ade3611
Showing
7 changed files
with
721 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const request = require("supertest"); | ||
const express = require("express"); | ||
|
||
let { middleware, errorHandler } = require("../../../framework/express"); | ||
|
||
const createRegisterOptions = async (email = `${Math.random().toString().slice(2)}@supertokens.com`) => { | ||
const app = express(); | ||
app.use(middleware()); | ||
app.use(errorHandler()); | ||
|
||
let registerOptionsResponse = await new Promise((resolve, reject) => | ||
request(app) | ||
.post("/auth/webauthn/options/register") | ||
.send({ | ||
email, | ||
}) | ||
.expect(200) | ||
.end((err, res) => { | ||
if (err) { | ||
console.log(err); | ||
reject(err); | ||
} else { | ||
resolve(JSON.parse(res.text)); | ||
} | ||
}) | ||
); | ||
|
||
return registerOptionsResponse; | ||
}; | ||
|
||
module.exports = createRegisterOptions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const request = require("supertest"); | ||
const express = require("express"); | ||
|
||
let { middleware, errorHandler } = require("../../../framework/express"); | ||
|
||
const createSignInOptions = async () => { | ||
const app = express(); | ||
app.use(middleware()); | ||
app.use(errorHandler()); | ||
|
||
let signInOptionsResponse = await new Promise((resolve, reject) => | ||
request(app) | ||
.post("/auth/webauthn/options/signin") | ||
.send({}) | ||
.expect(200) | ||
.end((err, res) => { | ||
if (err) { | ||
console.log(err); | ||
reject(err); | ||
} else { | ||
resolve(JSON.parse(res.text)); | ||
} | ||
}) | ||
); | ||
|
||
return signInOptionsResponse; | ||
}; | ||
|
||
module.exports = createSignInOptions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
let SuperTokens = require("../../../lib/build/supertokens").default; | ||
const WebAuthnRecipe = require("../../../lib/build/recipe/webauthn/recipe").default; | ||
|
||
const getWebAuthnRecipe = () => { | ||
return SuperTokens.getInstanceOrThrowError().recipeModules.find((rm) => rm.getRecipeId() === "webauthn"); | ||
const recipe = WebAuthnRecipe.getInstanceOrThrowError(); | ||
return recipe; | ||
}; | ||
|
||
module.exports = getWebAuthnRecipe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.