Skip to content

Commit

Permalink
Switch fido2-lib to @hexagon/webauthn
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Apr 10, 2022
1 parent 43fa5e9 commit 8223ff2
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 46 deletions.
105 changes: 63 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"license": "MIT",
"dependencies": {
"@hexagon/base64": "^1.0.11",
"@hexagon/webauthn": "^0.0.9",
"@koa/router": "^10.1.1",
"fido2-lib": "^2.8.2",
"koa": "^2.13.4",
Expand Down
5 changes: 4 additions & 1 deletion routes/webauthn.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ const

router = require("@koa/router")({ prefix: "/webauthn" }),

f2l = new Fido2(config.rpId, config.rpName, undefined, config.challengeTimeoutMs),
f2l = new Fido2(),

userNameMaxLenght = 25;


f2l.init(config.rpId, config.rpName, undefined, config.challengeTimeoutMs);

/**
* Returns base64url encoded buffer of the given length
* @param {Number} len - length of the buffer
Expand Down
8 changes: 5 additions & 3 deletions utils/fido2.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const
{ Fido2Lib } = require("fido2-lib"),
const
base64 = require("@hexagon/base64");

class Fido2 {
constructor(rpId, rpName, rpIcon, timeout) {
this.f2l = new Fido2Lib({
}
async init(rpId, rpName, rpIcon, timeout) {
const { Webauthn } = await import("@hexagon/webauthn");
this.f2l = new Webauthn({
timeout,
rpId,
rpName,
Expand Down

0 comments on commit 8223ff2

Please sign in to comment.