Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for wallet_key #281

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions examples/vue-example/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,7 @@ body,
margin-bottom: -16px;
}

.mpc {
display: flex;
align-items: center;
column-gap: 16px;
margin-top: 24px;
margin-bottom: -16px;
}

.mfa {
.mpc, .wallet-key, .mfa {
display: flex;
align-items: center;
column-gap: 16px;
Expand Down
17 changes: 11 additions & 6 deletions examples/vue-example/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<label for="mfa">Enable All MFA Factors</label>
<input type="checkbox" id="mfa" name="mfa" v-model="enableAllFactors" />
</div>
<div class="wallet-key">
<label for="mpc">Enable Wallet Key</label>
<input type="checkbox" id="walletKey" name="walletKey" v-model="useWalletKey" />
</div>
<select v-model="selectedBuildEnv" class="select">
<option :key="login" v-for="login in Object.values(BUILD_ENV)" :value="login">{{ login }}</option>
</select>
Expand Down Expand Up @@ -176,6 +180,7 @@ const vueapp = defineComponent({
BUILD_ENV: BUILD_ENV,
selectedOpenloginNetwork: OPENLOGIN_NETWORK.SAPPHIRE_DEVNET as OPENLOGIN_NETWORK_TYPE,
useMpc: false,
useWalletKey: false,
selectedBuildEnv: BUILD_ENV.PRODUCTION,
emailFlowType: EMAIL_FLOW.code,
EMAIL_FLOW: EMAIL_FLOW,
Expand Down Expand Up @@ -205,8 +210,8 @@ const vueapp = defineComponent({
this.openloginInstance.options.useMpc = true;
await this.openloginInstance.init();
}
if (this.openloginInstance.privKey || this.openloginInstance.state.factorKey) {
this.privKey = this.openloginInstance.privKey || (this.openloginInstance.state.factorKey as string);
if (this.openloginInstance.privKey || this.openloginInstance.state.factorKey || this.openloginInstance.state.walletKey) {
this.privKey = this.openloginInstance.privKey || (this.openloginInstance.state.factorKey as string) || (this.openloginInstance.state.walletKey as string);
await this.setProvider(this.privKey);
}
this.loading = false;
Expand Down Expand Up @@ -291,7 +296,7 @@ const vueapp = defineComponent({
const openLoginObj: LoginParams = {
loginProvider: this.selectedLoginProvider,
mfaLevel: "optional",

getWalletKey: this.useWalletKey,
// pass empty string '' as loginProvider to open default torus modal
// with all default supported login providers or you can pass specific
// login provider from available list to set as default.
Expand Down Expand Up @@ -321,9 +326,9 @@ const vueapp = defineComponent({
}

console.log(openLoginObj, "OPENLOGIN");
const data = await this.openloginInstance.login(openLoginObj);
if (data && data.privKey) {
this.privKey = data.privKey;
await this.openloginInstance.login(openLoginObj);
if (this.openloginInstance.privKey || this.openloginInstance.state.walletKey) {
this.privKey = this.openloginInstance.privKey || (this.openloginInstance.state.walletKey || "");
await this.setProvider(this.privKey);
}
} catch (error) {
Expand Down