+
-
Authenticating
+
Authenticating with Geo Connect
{state.step === 'fetching-app-identity' &&
Loading…
}
- {state.step === 'app-identity-does-not-exist' && (
- <>
-
Do you want accociate this app with your account and give access to all spaces?
-
- App Id: {state.appInfo.appId ?? 'unknown'}
-
- Redirect: {state.appInfo.redirect ?? 'unknown'}
-
-
Select spaces (not working yet)
- {spacesData?.spaces.map((space: { id: string; name: string }) => (
-
- {space.name} ({space.id})
-
- ))}
-
-
- >
- )}
- {state.step === 'selecting-spaces' && (
- <>
-
Do you want login with this app?
-
- App Id: {state.appInfo.appId ?? 'unknown'}
-
- Redirect: {state.appInfo.redirect ?? 'unknown'}
-
-
Select spaces (not working yet)
- {spacesData?.spaces.map((space) => (
-
- {space.name} ({space.id})
-
- ---------
-
- {space.appIdentities.map((appIdentity) => (
-
- {appIdentity.appId} ({appIdentity.address})
-
- ))}
-
- ))}
+ {state.step === 'error' &&
Error: {state.error}
}
+ {(state.step === 'selecting-spaces-existing-app-identity' ||
+ state.step === 'selecting-spaces-new-app-identity') && (
+
+
+
App Id
+
{state.appInfo.appId ?? 'unknown'}
+
Redirect:
+
{state.appInfo.redirect ?? 'unknown'}
+
+
Spaces
+
-
- >
+
+ {state.step === 'selecting-spaces-new-app-identity' ? (
+
+ ) : (
+
+ )}
+
+
)}
diff --git a/apps/connect/src/routes/index.tsx b/apps/connect/src/routes/index.tsx
index ddaf4d73..cfaf0399 100644
--- a/apps/connect/src/routes/index.tsx
+++ b/apps/connect/src/routes/index.tsx
@@ -15,7 +15,7 @@ function Index() {
return (
-
Welcome to Connect
+ Welcome to Geo Connect
diff --git a/packages/hypergraph/src/connect/create-auth-url.ts b/packages/hypergraph/src/connect/create-auth-url.ts
index f8745465..10909a30 100644
--- a/packages/hypergraph/src/connect/create-auth-url.ts
+++ b/packages/hypergraph/src/connect/create-auth-url.ts
@@ -18,8 +18,6 @@ export const createAuthUrl = (params: CreateAuthUrlParams) => {
} = params;
const { publicKey, secretKey } = generateKeypair();
- console.log('PUBLIC KEY (new)', publicKey);
-
const expiry = Date.now() + expiryMilliseconds;
const payload: ConnectAuthPayload = {
expiry,
@@ -34,8 +32,6 @@ export const createAuthUrl = (params: CreateAuthUrlParams) => {
url.searchParams.set('redirect', encodeURIComponent(redirectUrl));
url.searchParams.set('nonce', nonce);
- console.log('secretKey', secretKey);
-
return {
url,
nonce,
diff --git a/packages/hypergraph/src/connect/create-callback-params.ts b/packages/hypergraph/src/connect/create-callback-params.ts
index 3a619a93..02f17607 100644
--- a/packages/hypergraph/src/connect/create-callback-params.ts
+++ b/packages/hypergraph/src/connect/create-callback-params.ts
@@ -22,7 +22,6 @@ export const createCallbackParams = ({ nonce, ephemeralPublicKey, ...rest }: Cre
message: utf8ToBytes(JSON.stringify(rest)),
publicKey: hexToBytes(ephemeralPublicKey.replace(/^0x/, '')),
});
- console.log('encrypt publicKey', hexToBytes(ephemeralPublicKey.replace(/^0x/, '')));
return {
ciphertext: bytesToHex(ciphertext),
diff --git a/packages/hypergraph/src/connect/parse-callback-params.ts b/packages/hypergraph/src/connect/parse-callback-params.ts
index 47b1a5eb..2bad9c08 100644
--- a/packages/hypergraph/src/connect/parse-callback-params.ts
+++ b/packages/hypergraph/src/connect/parse-callback-params.ts
@@ -37,7 +37,9 @@ export const parseCallbackParams = ({
});
const decoded = decodeDecryptedResult(JSON.parse(bytesToUtf8(decryptionResult)));
if (Either.isLeft(decoded)) {
- return Effect.fail(new FailedToParseAuthCallbackUrl({ message: 'Failed to parse connect auth payload' }));
+ return Effect.fail(
+ new FailedToParseAuthCallbackUrl({ message: 'Failed to parse connect auth callback payload' }),
+ );
}
const data = decoded.right;
if (data.expiry !== storedExpiry) {
@@ -59,6 +61,7 @@ export const parseCallbackParams = ({
spaces: data.spaces,
});
} catch (error) {
- return Effect.fail(new FailedToParseAuthCallbackUrl({ message: 'Failed to parse connect auth payload' }));
+ console.error(error);
+ return Effect.fail(new FailedToParseAuthCallbackUrl({ message: 'Failed to parse connect auth callback payload' }));
}
};
diff --git a/packages/hypergraph/src/connect/types.ts b/packages/hypergraph/src/connect/types.ts
index 0c5c1b8c..abe3b174 100644
--- a/packages/hypergraph/src/connect/types.ts
+++ b/packages/hypergraph/src/connect/types.ts
@@ -29,6 +29,22 @@ export const KeysSchema = Schema.Struct({
export type KeysSchema = Schema.Schema.Type
;
+export const AppIdentityResponse = Schema.Struct({
+ accountAddress: Schema.String,
+ signaturePublicKey: Schema.String,
+ encryptionPublicKey: Schema.String,
+ accountProof: Schema.String,
+ keyProof: Schema.String,
+ ciphertext: Schema.String,
+ nonce: Schema.String,
+ sessionToken: Schema.String,
+ address: Schema.String,
+ appId: Schema.String,
+ sessionTokenExpires: Schema.String,
+});
+
+export type AppIdentityResponse = Schema.Schema.Type;
+
export type Identity = IdentityKeys & {
accountAddress: string;
};