Skip to content

Commit

Permalink
Merge pull request #309 from torusresearch/feat/add-passkeys
Browse files Browse the repository at this point in the history
Adds passkey handler + removes webauthn
  • Loading branch information
chaitanyapotti authored Mar 19, 2024
2 parents 1247dfc + e7b7a62 commit cbad09c
Show file tree
Hide file tree
Showing 23 changed files with 4,718 additions and 4,248 deletions.
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npx lint-staged
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{}
{
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
}
}
5,254 changes: 2,766 additions & 2,488 deletions examples/vue-app/package-lock.json

Large diffs are not rendered by default.

39 changes: 20 additions & 19 deletions examples/vue-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,35 @@
"dependencies": {
"@toruslabs/customauth": "file:../..",
"@toruslabs/openlogin-starkkey": "^3.2.0",
"@web3auth/ethereum-provider": "^7.1.2",
"core-js": "^3.33.3",
"daisyui": "^4.4.4",
"@web3auth/ethereum-provider": "^8.0.1",
"@toruslabs/broadcast-channel": "10.0.1",
"core-js": "^3.36.0",
"daisyui": "^4.7.3",
"enc-utils": "^3.0.0",
"vue": "^3.3.8",
"vue-router": "^4.2.5",
"web3": "^4.2.2"
"vue": "^3.4.21",
"vue-router": "^4.3.0",
"web3": "^4.6.0"
},
"devDependencies": {
"@types/elliptic": "^6.4.18",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-typescript": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"autoprefixer": "^10.4.16",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"autoprefixer": "^10.4.18",
"color": "^4.2.3",
"eslint": "^8.54.0",
"eslint-plugin-vue": "^9.18.1",
"postcss": "^8.4.31",
"prettier": "^3.1.0",
"source-map-loader": "^4.0.1",
"tailwindcss": "^3.3.5",
"typescript": "~5.3.2",
"vue-template-compiler": "^2.7.15"
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.23.0",
"postcss": "^8.4.36",
"prettier": "^3.2.5",
"source-map-loader": "^5.0.0",
"tailwindcss": "^3.4.1",
"typescript": "~5.4.2",
"vue-template-compiler": "^2.7.16"
},
"browserslist": [
"supports bigint",
Expand Down
4 changes: 2 additions & 2 deletions examples/vue-app/public/serviceworker/redirect.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
<h1 class="title content" id="closeText" style="display: none">You can close this window now</h1>
</div>
<script
src="https://scripts.toruswallet.io/broadcastChannel_9_0_1.js"
integrity="sha384-taBzlN8/+K08+avbr6royzsuqJU0Qoi9tUUnvdiKwHTQ5SV6uef5erTEdV4ojYS9"
src="https://cdn.jsdelivr.net/npm/@toruslabs/broadcast-channel@10.0.2/dist/broadcastChannel.umd.min.js"
integrity="sha256-q78HZzZl8u46uVK0a+t5vzPyAevMwEWHi43ok+P7/O8="
crossorigin="anonymous"
></script>
<script>
Expand Down
4 changes: 2 additions & 2 deletions examples/vue-app/public/serviceworker/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ self.addEventListener("fetch", function (event) {
<h1 class="title content" id="closeText" style="display: none;">You can close this window now</h1>
</div>
<script
src="https://scripts.toruswallet.io/broadcastChannel_9_0_1.js"
integrity="sha384-taBzlN8/+K08+avbr6royzsuqJU0Qoi9tUUnvdiKwHTQ5SV6uef5erTEdV4ojYS9"
src="https://cdn.jsdelivr.net/npm/@toruslabs/broadcast-channel@10.0.2/dist/broadcastChannel.umd.min.js"
integrity="sha256-q78HZzZl8u46uVK0a+t5vzPyAevMwEWHi43ok+P7/O8="
crossorigin="anonymous"
></script>
<script>
Expand Down
4 changes: 2 additions & 2 deletions examples/vue-app/src/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ export default defineComponent({
console(...args: unknown[]): void {
const el = document.querySelector("#console>p");
if (el) {
el.innerHTML = JSON.stringify(args || {}, null, 2);
el.innerHTML = JSON.stringify(args || {}, (_, v) => (typeof v === "bigint" ? v.toString() : v), 2);
}
},
_handleRedirectParameters(
hash: string,
queryParameters: Record<string, string | null>
queryParameters: Record<string, string | null>,
): {
error: string;
instanceParameters: Record<string, any>;
Expand Down
5 changes: 3 additions & 2 deletions examples/vue-app/src/views/PopupMode/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ export default defineComponent({
ticker: "matic",
tickerName: "matic",
displayName: "Polygon Mainnet",
blockExplorer: "https://polygonscan.com",
blockExplorerUrl: "https://polygonscan.com",
chainNamespace: "eip155",
},
privKey: privateKey,
});
Expand Down Expand Up @@ -354,7 +355,7 @@ export default defineComponent({
h1.innerHTML = args[0] as string;
}
if (el) {
el.innerHTML = JSON.stringify(args[1] || {}, null, 2);
el.innerHTML = JSON.stringify(args[1] || {}, (_, v) => (typeof v === "bigint" ? v.toString() : v), 2);
}
if (consoleBtn) {
consoleBtn.style.display = "block";
Expand Down
5 changes: 3 additions & 2 deletions examples/vue-app/src/views/RedirectMode/Auth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default defineComponent({
h1.innerHTML = args[0] as string;
}
if (el) {
el.innerHTML = JSON.stringify(args[1] || {}, null, 2);
el.innerHTML = JSON.stringify(args[1] || {}, (_, v) => (typeof v === "bigint" ? v.toString() : v), 2);
}
if (consoleBtn) {
consoleBtn.style.display = "block";
Expand Down Expand Up @@ -257,7 +257,8 @@ export default defineComponent({
ticker: "matic",
tickerName: "matic",
displayName: "Polygon Mainnet",
blockExplorer: "https://polygonscan.com",
blockExplorerUrl: "https://polygonscan.com",
chainNamespace: "eip155",
},
privKey: privKey.padStart(64, "0"),
});
Expand Down
7 changes: 1 addition & 6 deletions examples/vue-app/src/views/RedirectMode/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,17 @@ export default defineComponent({
if (!this.customAuthSdk) return;
const jwtParams = this.loginToConnectionMap[this.selectedVerifier] || {};
const { typeOfLogin, clientId, verifier, name } = verifierMap[this.selectedVerifier];
const webauthnRegister = name === "WebAuthn Register";
const registerOnly = webauthnRegister ? true : false;
const loginOnly = webauthnRegister ? "false" : "true";
const { typeOfLogin, clientId, verifier } = verifierMap[this.selectedVerifier];
return this.customAuthSdk.triggerLogin({
typeOfLogin,
verifier,
clientId,
jwtParams,
registerOnly,
customState: {
client: "great-company",
webauthnURL: "https://d1f8-115-66-172-125.ngrok.io/",
localhostAll: "true",
loginOnly,
webauthnTransports: "ble",
credTransports: "ble",
},
Expand Down
Loading

0 comments on commit cbad09c

Please sign in to comment.