-
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.
- Loading branch information
Showing
137 changed files
with
10,158 additions
and
799 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@turnkey/sdk-browser": minor | ||
--- | ||
|
||
Fix readWrite session to use credentialBundle and add loginWithAuthBundle to create a session when you already have a credentialBundle |
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,7 @@ | ||
--- | ||
"@turnkey/sdk-browser": patch | ||
"@turnkey/sdk-server": patch | ||
"@turnkey/http": patch | ||
--- | ||
|
||
Update api endpoints - NEW: User verification, SMS customization params |
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,14 @@ | ||
## SERVER SIDE | ||
TURNKEY_API_PUBLIC_KEY="<Turnkey API Public Key (that starts with 02 or 03)>" | ||
TURNKEY_API_PRIVATE_KEY="<Turnkey API Private Key>" | ||
|
||
## CLIENT SIDE | ||
NEXT_PUBLIC_BASE_URL="https://api.turnkey.com" | ||
NEXT_PUBLIC_ORGANIZATION_ID="<Turnkey organization ID>" | ||
NEXT_PUBLIC_AUTH_IFRAME_URL="https://auth.turnkey.com" | ||
NEXT_PUBLIC_EXPORT_IFRAME_URL="https://export.turnkey.com" | ||
NEXT_PUBLIC_IMPORT_IFRAME_URL="https://import.turnkey.com" | ||
NEXT_PUBLIC_GOOGLE_CLIENT_ID="<Google OIDC client ID>" | ||
NEXT_PUBLIC_APPLE_CLIENT_ID="<Apple OIDC client ID>" | ||
NEXT_PUBLIC_FACEBOOK_CLIENT_ID="<Facebook OIDC client ID>" | ||
NEXT_PUBLIC_OAUTH_REDIRECT_URI="http://localhost:3000/" # Where your login page is - make sure to have a trailing "/" NOTE: Sign in with Apple and Google does not support localhost redirects! You can use ngrok to test locally |
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,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
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,35 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts |
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,66 @@ | ||
# Example: `react-components` | ||
|
||
This example shows an example app created using our react components from @turnkey/sdk-react. For more information [check out our documentation](https://docs.turnkey.com/features/TODO). #TODO docs for react components and is also hosted [here](TODO) #TODO add hosted URL - e.g demo.turnkey.com | ||
|
||
## Getting started | ||
|
||
### 1/ Cloning the example | ||
|
||
Make sure you have `node` installed locally; we recommend using Node v18+. You will also need NextJS v13+ (for use-server/use-client directives and /app directory structure). Our components leverage use-server to make server side calls using private API keys without requiring developers to setup their own backend for Turnkey authentication | ||
|
||
```bash | ||
$ git clone https://github.com/tkhq/sdk | ||
$ cd sdk/ | ||
$ corepack enable # Install `pnpm` | ||
$ pnpm install -r # Install dependencies | ||
$ pnpm run build-all # Compile source code | ||
$ cd examples/react-components/ | ||
``` | ||
|
||
### 2/ Setting up Turnkey | ||
|
||
The first step is to set up your Turnkey organization and account. By following the [Quickstart](https://docs.turnkey.com/getting-started/quickstart) guide, you should have: | ||
|
||
- A public/private API key pair for Turnkey | ||
- An organization ID | ||
|
||
Once you've gathered these values, add them to a new `.env.local` file. Notice that your API private key should be securely managed and **_never_** be committed to git. | ||
|
||
```bash | ||
$ cp .env.local.example .env.local | ||
``` | ||
|
||
Now open `.env.local` and add the missing environment variables: | ||
|
||
- `TURNKEY_API_PUBLIC_KEY` | ||
- `TURNKEY_API_PRIVATE_KEY` | ||
- `NEXT_PUBLIC_BASE_URL` (the `NEXT_PUBLIC` prefix makes the env variable accessible to the frontend app) | ||
- `NEXT_PUBLIC_ORGANIZATION_ID` | ||
- `NEXT_PUBLIC_GOOGLE_CLIENT_ID` | ||
- `NEXT_PUBLIC_FACEBOOK_CLIENT_ID` | ||
- `NEXT_PUBLIC_APPLE_CLIENT_ID` | ||
- `NEXT_PUBLIC_AUTH_IFRAME_URL` | ||
- `NEXT_PUBLIC_IMPORT_IFRAME_URL` | ||
- `NEXT_PUBLIC_EXPORT_IFRAME_URL` | ||
- `NEXT_PUBLIC_OAUTH_REDIRECT_URI` | ||
|
||
### 3/ Running the app | ||
|
||
```bash | ||
$ pnpm run dev | ||
``` | ||
|
||
This command will run a NextJS app on port 3000. If you navigate to http://localhost:3000 in your browser, the example app using auth components should be ready to use! | ||
|
||
### 4/ Using ngrok for OAuth | ||
|
||
To enable OAuth flows like Google, Facebook, or Apple on your local environment, you’ll need to use [ngrok](https://ngrok.com) to expose your localhost server to the internet. This is necessary because OIDC providers require a publicly accessible redirect URI during the authentication process. | ||
|
||
#### Steps: | ||
|
||
1. **Install ngrok**: Follow the [ngrok installation guide](https://ngrok.com/download) to install ngrok on your machine. | ||
2. **Run ngrok**: Start ngrok and point it to port 3000 (the port your app runs on): | ||
|
||
```bash | ||
$ ngrok http 3000 | ||
``` |
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,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. |
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,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
|
||
module.exports = nextConfig; |
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,43 @@ | ||
{ | ||
"name": "@turnkey/example-react-components", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"@emotion/react": "^11.13.3", | ||
"@emotion/styled": "^11.13.0", | ||
"@hello-pangea/dnd": "^17.0.0", | ||
"@mui/icons-material": "^6.1.5", | ||
"@mui/material": "^6.1.5", | ||
"@noble/hashes": "1.4.0", | ||
"@solana/web3.js": "^1.95.8", | ||
"@turnkey/sdk-browser": "workspace:*", | ||
"@turnkey/sdk-react": "workspace:*", | ||
"@turnkey/sdk-server": "workspace:*", | ||
"@types/node": "20.3.1", | ||
"@types/react": "18.2.14", | ||
"@types/react-dom": "18.2.6", | ||
"axios": "^1.7.4", | ||
"buffer": "^6.0.3", | ||
"encoding": "^0.1.13", | ||
"eslint": "8.43.0", | ||
"eslint-config-next": "14.2.10", | ||
"esm": "^3.2.25", | ||
"ethers": "^6.10.0", | ||
"install": "^0.13.0", | ||
"next": "^14.2.10", | ||
"npm": "^9.7.2", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"react-international-phone": "^4.3.0", | ||
"sonner": "^1.4.41", | ||
"tweetnacl": "^1.0.3", | ||
"typescript": "5.1.3" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.