Skip to content

Commit 5aa862a

Browse files
authored
setup signer for storage in toolshed (#541)
storage needs a signer now
1 parent 627a19b commit 5aa862a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

typescript/packages/toolshed/routes/integrations/google-oauth/google-oauth.utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
storage,
88
} from "@commontools/runner";
99
import { Context } from "@hono/hono";
10-
10+
import { Identity, Signer } from "@commontools/identity";
1111
// Types
1212
export interface TokenData {
1313
token?: string;
@@ -146,6 +146,8 @@ export async function fetchUserInfo(accessToken: string): Promise<UserInfo> {
146146
}
147147
}
148148

149+
let signer: Signer | undefined;
150+
149151
// Helper function to get auth cell and storage
150152
export async function getAuthCellAndStorage(docLink: DocLink | string) {
151153
try {
@@ -154,6 +156,11 @@ export async function getAuthCellAndStorage(docLink: DocLink | string) {
154156
? JSON.parse(docLink)
155157
: docLink;
156158

159+
if (!signer) {
160+
signer = await Identity.fromPassphrase("toolshed");
161+
storage.setSigner(signer);
162+
}
163+
157164
storage.setRemoteStorage(new URL("http://localhost:8000"));
158165

159166
// FIXME(ja): the space should be inferred from the doclink - but it isn't there yet

0 commit comments

Comments
 (0)