Skip to content

Commit cbb1ac9

Browse files
committed
Merge branch 'winston/tool-2884-backend-server-wallets' of https://github.com/thirdweb-dev/js into winston/tool-2884-backend-server-wallets
2 parents 8f5867c + 683bc91 commit cbb1ac9

File tree

8 files changed

+52
-16
lines changed

8 files changed

+52
-16
lines changed

.changeset/popular-ravens-reflect.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Add support for backend wallets.
66

7-
This is useful is you have a backend that is connected to an agent or what not that you want to have programmatic access to a wallet without managing private keys.
7+
This is useful is you have a backend that is connected to an that you want to have programmatic access to a wallet without managing private keys.
88

99
Here's how you'd do it:
1010

@@ -20,4 +20,4 @@ const account = await wallet.connect({
2020
console.log("account.address", account.address);
2121
```
2222

23-
Note that `walletSecret` would simply be something that you generate and store to uniquely identify the given wallet created under the particular `client`.
23+
Note that `walletSecret` should be generated by you and securely stored to uniquely authenticate to the given wallet.

apps/dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"react-dom": "19.0.0",
8686
"react-dropzone": "^14.3.5",
8787
"react-error-boundary": "^4.1.2",
88-
"react-hook-form": "7.53.2",
88+
"react-hook-form": "7.54.2",
8989
"react-markdown": "^9.0.1",
9090
"react-table": "^7.8.0",
9191
"recharts": "2.14.1",

apps/wallet-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"next-themes": "^0.4.4",
2626
"react": "19.0.0",
2727
"react-dom": "19.0.0",
28-
"react-hook-form": "7.53.2",
28+
"react-hook-form": "7.54.2",
2929
"server-only": "^0.0.1",
3030
"sonner": "^1.7.1",
3131
"tailwind-merge": "^2.6.0",

packages/thirdweb/src/wallets/in-app/core/authentication/backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getLoginUrl } from "./getLoginPath.js";
66
import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
77

88
/**
9-
* Does no real authentication, just issues a temporary token for the user.
9+
* Authenticates via the wallet secret
1010
* @internal
1111
*/
1212
export async function backendAuthenticate(args: {

packages/thirdweb/src/wallets/in-app/native/auth/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ export async function preAuthenticate(args: PreAuthArgsType) {
133133
* verificationCode: "123456",
134134
* });
135135
* ```
136+
*
137+
* Authenticate to a backend account (only do this on your backend):
138+
* ```ts
139+
* import { authenticate } from "thirdweb/wallets/in-app";
140+
*
141+
* const result = await authenticate({
142+
* client,
143+
* strategy: "backend",
144+
* walletSecret: "...", // Provided by your app
145+
* });
146+
* ```
136147
* @wallet
137148
*/
138149
export async function authenticate(args: AuthArgsType) {

packages/thirdweb/src/wallets/in-app/web/in-app.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
139139
* });
140140
* ```
141141
*
142+
* ### Connect to a backend account
143+
*
144+
* ```ts
145+
* import { inAppWallet } from "thirdweb/wallets";
146+
*
147+
* const wallet = inAppWallet();
148+
*
149+
* const account = await wallet.connect({
150+
* client,
151+
* strategy: "backend",
152+
* walletSecret: "...", // Provided by your app
153+
* });
154+
* ```
155+
*
142156
* ### Connect with custom JWT (any OIDC provider)
143157
*
144158
* You can use any OIDC provider to authenticate your users. Make sure to configure it in your dashboard under in-app wallet settings.

packages/thirdweb/src/wallets/in-app/web/lib/auth/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ export async function preAuthenticate(args: PreAuthArgsType) {
140140
* verificationCode: "123456",
141141
* });
142142
* ```
143+
*
144+
* Authenticate to a backend account (only do this on your backend):
145+
* ```ts
146+
* import { authenticate } from "thirdweb/wallets/in-app";
147+
*
148+
* const result = await authenticate({
149+
* client,
150+
* strategy: "backend",
151+
* walletSecret: "...", // Provided by your app
152+
* });
153+
* ```
143154
* @wallet
144155
*/
145156
export async function authenticate(args: AuthArgsType) {

pnpm-lock.yaml

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)