-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working verification, custom sms params, need to fix delete suborgs p…
…atch
- Loading branch information
Showing
6 changed files
with
113 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"use server"; | ||
|
||
import { Turnkey } from "@turnkey/sdk-server"; | ||
|
||
type GetSuborgsRequest = { | ||
filterValue: string; | ||
filterType: string; | ||
}; | ||
|
||
type GetSuborgsResponse = { | ||
organizationIds: string[]; | ||
}; | ||
|
||
export async function getVerifiedSuborgs( | ||
request: GetSuborgsRequest | ||
): Promise<GetSuborgsResponse | undefined> { | ||
const turnkeyClient = new Turnkey({ | ||
apiBaseUrl: process.env.NEXT_PUBLIC_BASE_URL!, | ||
defaultOrganizationId: process.env.NEXT_PUBLIC_ORGANIZATION_ID!, | ||
apiPrivateKey: process.env.TURNKEY_API_PRIVATE_KEY!, // DO NOT EXPOSE THESE TO YOUR CLIENT SIDE CODE | ||
apiPublicKey: process.env.TURNKEY_API_PUBLIC_KEY!, // DO NOT EXPOSE THESE TO YOUR CLIENT SIDE CODE | ||
}); | ||
try { | ||
const response = await turnkeyClient.apiClient().getVerifiedSubOrgIds({ | ||
organizationId: turnkeyClient.config.defaultOrganizationId, | ||
filterType: request.filterType, | ||
filterValue: request.filterValue, | ||
}); | ||
if (!response || !response.organizationIds) { | ||
throw new Error("Expected a non-null response with organizationIds."); | ||
} | ||
|
||
return { organizationIds: response.organizationIds }; | ||
} catch (e) { | ||
console.error(e); | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters