Skip to content

Commit 0231b4a

Browse files
committed
prettier
1 parent a97b12e commit 0231b4a

File tree

4 files changed

+62
-26
lines changed

4 files changed

+62
-26
lines changed

examples/react-components/src/app/dashboard/page.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export default function Dashboard() {
7474
const [emailInput, setEmailInput] = useState("");
7575
const [phoneInput, setPhoneInput] = useState("");
7676

77-
7877
const handleExportSuccess = async () => {
7978
toast.success("Wallet successfully exported");
8079
};

packages/sdk-react/src/components/auth/Auth.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ const Auth: React.FC<AuthProps> = ({
142142
}
143143
suborgId = getVerifiedSuborgsResponse?.organizationIds[0];
144144
} else {
145-
const getSuborgsResponse = await server.getSuborgs({ filterType, filterValue });
145+
const getSuborgsResponse = await server.getSuborgs({
146+
filterType,
147+
filterValue,
148+
});
146149
if (!getSuborgsResponse || !getSuborgsResponse.organizationIds) {
147150
onError(authErrors.suborg.fetchFailed);
148151
}

packages/sdk-server/src/actions.ts

+50-23
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
"use server";
22

33
import { TurnkeyServerSDK } from "./sdk-client";
4-
import { DEFAULT_ETHEREUM_ACCOUNTS, DEFAULT_SOLANA_ACCOUNTS, WalletAccount } from "./turnkey-helpers";
5-
4+
import {
5+
DEFAULT_ETHEREUM_ACCOUNTS,
6+
DEFAULT_SOLANA_ACCOUNTS,
7+
WalletAccount,
8+
} from "./turnkey-helpers";
69

710
type Session = {
811
sessionType: string;
912
userId: string;
1013
organizationId: string;
1114
expiry: number;
12-
token: string | undefined
13-
}
15+
token: string | undefined;
16+
};
1417

1518
type VerifyOtpRequest = {
1619
suborgID: string;
@@ -79,7 +82,7 @@ type Provider = {
7982

8083
type CreateSuborgResponse = {
8184
subOrganizationId: string;
82-
}
85+
};
8386

8487
const turnkeyClient = new TurnkeyServerSDK({
8588
apiBaseUrl: process.env.NEXT_PUBLIC_BASE_URL!,
@@ -88,7 +91,9 @@ const turnkeyClient = new TurnkeyServerSDK({
8891
apiPublicKey: process.env.TURNKEY_API_PUBLIC_KEY!,
8992
});
9093

91-
export async function sendCredential(request: InitEmailAuthRequest): Promise<void> {
94+
export async function sendCredential(
95+
request: InitEmailAuthRequest
96+
): Promise<void> {
9297
try {
9398
const response = await turnkeyClient.apiClient().emailAuth({
9499
email: request.email,
@@ -98,8 +103,10 @@ export async function sendCredential(request: InitEmailAuthRequest): Promise<voi
98103
...(request.sessionLengthSeconds !== undefined && {
99104
expirationSeconds: request.sessionLengthSeconds.toString(),
100105
}),
101-
...(request.invalidateExisting && { invalidateExisting: request.invalidateExisting }),
102-
})
106+
...(request.invalidateExisting && {
107+
invalidateExisting: request.invalidateExisting,
108+
}),
109+
});
103110
if (!response.userId) {
104111
throw new Error("Expected a non-null userId.");
105112
}
@@ -109,7 +116,9 @@ export async function sendCredential(request: InitEmailAuthRequest): Promise<voi
109116
}
110117
}
111118

112-
export async function sendOtp(request: SendOtpRequest): Promise<SendOtpResponse | undefined> {
119+
export async function sendOtp(
120+
request: SendOtpRequest
121+
): Promise<SendOtpResponse | undefined> {
113122
try {
114123
const response = await turnkeyClient.apiClient().initOtpAuth({
115124
contact: request.contact,
@@ -130,7 +139,9 @@ export async function sendOtp(request: SendOtpRequest): Promise<SendOtpResponse
130139
}
131140
}
132141

133-
export async function verifyOtp(request: VerifyOtpRequest): Promise<Session | undefined> {
142+
export async function verifyOtp(
143+
request: VerifyOtpRequest
144+
): Promise<Session | undefined> {
134145
try {
135146
const response = await turnkeyClient.apiClient().otpAuth({
136147
otpId: request.otpId,
@@ -144,23 +155,28 @@ export async function verifyOtp(request: VerifyOtpRequest): Promise<Session | un
144155

145156
const { credentialBundle, apiKeyId, userId } = response;
146157
if (!credentialBundle || !apiKeyId || !userId) {
147-
throw new Error("Expected non-null values for credentialBundle, apiKeyId, and userId.");
158+
throw new Error(
159+
"Expected non-null values for credentialBundle, apiKeyId, and userId."
160+
);
148161
}
149162
const session: Session = {
150163
sessionType: "rw",
151164
userId: userId,
152165
organizationId: request.suborgID,
153-
expiry: Math.floor(Date.now() / 1000) + (request.sessionLengthSeconds ?? 900), //TODO change this to the actual expiry time from the response,
154-
token: credentialBundle
155-
}
166+
expiry:
167+
Math.floor(Date.now() / 1000) + (request.sessionLengthSeconds ?? 900), //TODO change this to the actual expiry time from the response,
168+
token: credentialBundle,
169+
};
156170
return session;
157171
} catch (error) {
158172
console.error(error);
159173
return undefined;
160174
}
161175
}
162176

163-
export async function oauth(request: OauthRequest): Promise<Session | undefined> {
177+
export async function oauth(
178+
request: OauthRequest
179+
): Promise<Session | undefined> {
164180
try {
165181
const response = await turnkeyClient.apiClient().oauth({
166182
oidcToken: request.oidcToken,
@@ -173,23 +189,28 @@ export async function oauth(request: OauthRequest): Promise<Session | undefined>
173189

174190
const { credentialBundle, apiKeyId, userId } = response;
175191
if (!credentialBundle || !apiKeyId || !userId) {
176-
throw new Error("Expected non-null values for credentialBundle, apiKeyId, and userId.");
192+
throw new Error(
193+
"Expected non-null values for credentialBundle, apiKeyId, and userId."
194+
);
177195
}
178196
const session: Session = {
179197
sessionType: "rw",
180198
userId: userId,
181199
organizationId: request.suborgID,
182-
expiry: Math.floor(Date.now() / 1000) + (request.sessionLengthSeconds ?? 900), //TODO change this to the actual expiry time from the response,
183-
token: credentialBundle
184-
}
200+
expiry:
201+
Math.floor(Date.now() / 1000) + (request.sessionLengthSeconds ?? 900), //TODO change this to the actual expiry time from the response,
202+
token: credentialBundle,
203+
};
185204
return session;
186205
} catch (error) {
187206
console.error(error);
188207
return undefined;
189208
}
190209
}
191210

192-
export async function getSuborgs(request: GetSuborgsRequest): Promise<GetSuborgsResponse | undefined> {
211+
export async function getSuborgs(
212+
request: GetSuborgsRequest
213+
): Promise<GetSuborgsResponse | undefined> {
193214
try {
194215
const response = await turnkeyClient.apiClient().getSubOrgIds({
195216
organizationId: turnkeyClient.config.defaultOrganizationId,
@@ -207,7 +228,9 @@ export async function getSuborgs(request: GetSuborgsRequest): Promise<GetSuborgs
207228
}
208229
}
209230

210-
export async function getVerifiedSuborgs(request: GetSuborgsRequest): Promise<GetSuborgsResponse | undefined> {
231+
export async function getVerifiedSuborgs(
232+
request: GetSuborgsRequest
233+
): Promise<GetSuborgsResponse | undefined> {
211234
try {
212235
const response = await turnkeyClient.apiClient().getVerifiedSubOrgIds({
213236
organizationId: turnkeyClient.config.defaultOrganizationId,
@@ -225,7 +248,9 @@ export async function getVerifiedSuborgs(request: GetSuborgsRequest): Promise<Ge
225248
}
226249
}
227250

228-
export async function createSuborg(request: CreateSuborgRequest): Promise<CreateSuborgResponse | undefined> {
251+
export async function createSuborg(
252+
request: CreateSuborgRequest
253+
): Promise<CreateSuborgResponse | undefined> {
229254
try {
230255
const response = await turnkeyClient.apiClient().createSubOrganization({
231256
subOrganizationName: `suborg-${String(Date.now())}`,
@@ -234,7 +259,9 @@ export async function createSuborg(request: CreateSuborgRequest): Promise<Create
234259
{
235260
userName: request.email ?? "",
236261
userEmail: request.email ?? "",
237-
...(request.phoneNumber ? { userPhoneNumber: request.phoneNumber } : {}),
262+
...(request.phoneNumber
263+
? { userPhoneNumber: request.phoneNumber }
264+
: {}),
238265
apiKeys: [],
239266
authenticators: request.passkey ? [request.passkey] : [],
240267
oauthProviders: request.oauthProviders ?? [],

packages/sdk-server/src/index.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ import type {
3131
import type * as TurnkeySDKApiTypes from "./__generated__/sdk_api_types";
3232

3333
import { fetch } from "./universal";
34-
import { createSuborg, getSuborgs, getVerifiedSuborgs, sendOtp, oauth, verifyOtp } from "./actions";
34+
import {
35+
createSuborg,
36+
getSuborgs,
37+
getVerifiedSuborgs,
38+
sendOtp,
39+
oauth,
40+
verifyOtp,
41+
} from "./actions";
3542

3643
// Classes
3744
export {

0 commit comments

Comments
 (0)