Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[RN] Update naming for embeddedWallet jwt flow
  • Loading branch information
ikethirdweb committed Oct 24, 2023
commit 6042ab6cdd072335bb5f22f3a202c23dcfddcfcc
4 changes: 2 additions & 2 deletions .changeset/cold-dryers-dream.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const AppInner = () => {

const triggerConnect = async () => {
connect(embeddedWallet(), {
loginType: "custom_jwt_auth",
password: "strong-encryption-key",
loginType: "jwt",
password: "strong-password",
jwt: "your-jwt",
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
await this.validateEmailOtp({ otp: options.otp });
break;
}
case "custom_jwt_auth": {
case "jwt": {
await this.customJwt({
jwt: options.jwt,
password: options.password,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function postPaperAuth(
export async function postPaperAuthUserManaged(
storedToken: AuthStoredTokenWithCookieReturnType["storedToken"],
clientId: string,
encryptionKey: string,
password: string,
) {
if (storedToken.shouldStoreCookieString) {
await setAuthTokenClient(storedToken.cookieString, clientId);
Expand All @@ -79,7 +79,7 @@ export async function postPaperAuthUserManaged(

if (storedToken.isNewUser) {
console.log("========== New User ==========");
await setUpNewUserWallet(encryptionKey, clientId);
await setUpNewUserWallet(password, clientId);
} else {
try {
// existing device share
Expand All @@ -92,7 +92,7 @@ export async function postPaperAuthUserManaged(
try {
await setUpShareForNewDevice({
clientId,
recoveryCode: encryptionKey,
recoveryCode: password,
});
} catch (error) {
console.error("Error setting up wallet on device", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import type {
AuthProvider,
} from "@paperxyz/embedded-wallet-service-sdk";

export type CustomAuth = {
jwtToken: string;
encryptionKey: string;
};

export type OauthOptions = {
providers: AuthProvider[];
redirectUrl: string;
Expand Down Expand Up @@ -70,7 +65,7 @@ export type EmbeddedWalletConnectionArgs = {
otp: string;
}
| {
loginType: "custom_jwt_auth";
loginType: "jwt";
jwt: string;
password: string;
}
Expand Down