Skip to content

Commit d5879a3

Browse files
committed
fixed issue with createSubOrg for otp
1 parent 19c1632 commit d5879a3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Examples/swift-demo-wallet/example-server/src/handler.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export async function verifyOtp(
103103
export async function createSubOrg(
104104
req: Request<{}, {}, CreateSubOrgParams>
105105
): Promise<CreateSubOrgResponse> {
106-
const { passkey, apiKeys } = req.body;
106+
const { email, phone, passkey, apiKeys } = req.body;
107107

108108
const authenticators = passkey
109109
? [
@@ -115,14 +115,19 @@ export async function createSubOrg(
115115
]
116116
: [];
117117

118+
let userEmail = email;
119+
const userPhoneNumber = phone;
120+
118121
const subOrganizationName = `Sub Org - ${new Date().toISOString()}`;
119122

120123
const result = await turnkey.createSubOrganization({
121124
organizationId: turnkeyConfig.defaultOrganizationId,
122125
subOrganizationName,
123126
rootUsers: [
124127
{
125-
userName: "Passkey User",
128+
userName: "User",
129+
userEmail,
130+
userPhoneNumber,
126131
authenticators,
127132
apiKeys: apiKeys ?? [],
128133
oauthProviders: [],

Examples/swift-demo-wallet/example-server/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export type SendOtpResponse = {
3737
};
3838

3939
export type CreateSubOrgParams = {
40+
email: string;
41+
phone?: string;
4042
passkey?: {
4143
name?: string;
4244
challenge: string;

0 commit comments

Comments
 (0)