Skip to content

Commit

Permalink
Merge branch 'main' into descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
apotdevin authored Jul 23, 2024
2 parents 0863567 + 0c57250 commit 471dbb6
Show file tree
Hide file tree
Showing 19 changed files with 725 additions and 34 deletions.
5 changes: 5 additions & 0 deletions src/app/(app)/(layout)/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Settings } from '@/views/settings/Settings';

export default function Page() {
return <Settings />;
}
19 changes: 17 additions & 2 deletions src/components/form/SignUpForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,23 @@ export function SignUpForm() {
</FormControl>
<div className="flex flex-col gap-2">
<FormLabel>
By checking this box you agree to the Terms of Service and
the Privacy Policy.
By checking this box you agree to the{' '}
<Link
href={ROUTES.docs.termsOfService}
target="_blank"
className="text-primary"
>
Terms of Service
</Link>{' '}
and the{' '}
<Link
href={ROUTES.docs.privacyPolicy}
target="_blank"
className="text-primary"
>
Privacy Policy
</Link>
.
</FormLabel>

<FormMessage />
Expand Down
31 changes: 31 additions & 0 deletions src/components/layout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Menu,
MessageCircle,
Settings,
Settings2,
Vault,
} from 'lucide-react';
import Link from 'next/link';
Expand Down Expand Up @@ -79,6 +80,24 @@ export const AppLayout: FC<{ children: ReactNode }> = ({ children }) => {
</Tooltip>
</nav>
<nav className="mt-auto grid gap-1 p-2">
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="icon"
className="mt-auto rounded-lg"
aria-label="Settings"
asChild
>
<Link href={ROUTES.settings}>
<Settings2 className="size-5" />
</Link>
</Button>
</TooltipTrigger>
<TooltipContent side="right" sideOffset={5}>
Settings
</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Button
Expand Down Expand Up @@ -135,6 +154,18 @@ export const AppLayout: FC<{ children: ReactNode }> = ({ children }) => {
</Link>
</nav>
<div className="mt-auto space-y-2">
<Button
asChild
variant="outline"
className="mt-auto w-full rounded-lg"
aria-label="Settings"
onClick={() => setMobileMenuOpen(false)}
>
<Link href={ROUTES.settings}>
<Settings2 className="mr-2 h-5 w-5" />
Settings
</Link>
</Button>
<Button
asChild
variant="outline"
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const DialogContent = React.forwardRef<
<DialogPrimitive.Content
ref={ref}
className={cn(
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
'fixed left-[50%] top-[50%] z-50 grid max-h-dvh w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
className
)}
{...props}
Expand Down
67 changes: 67 additions & 0 deletions src/graphql/mutations/__generated__/changePassword.generated.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/graphql/mutations/changePassword.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { gql } from '@apollo/client';

export const ChangePassword = gql`
mutation ChangePassword($input: ChangePasswordInput!) {
password {
change(input: $input)
}
}
`;
6 changes: 4 additions & 2 deletions src/graphql/mutations/checkPassword.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { gql } from '@apollo/client';

export const Login = gql`
export const CheckPassword = gql`
mutation CheckPassword($password: String!) {
checkPassword(password: $password)
password {
check(password: $password)
}
}
`;
27 changes: 22 additions & 5 deletions src/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ export type BroadcastLiquidTransactionInput = {
wallet_account_id: Scalars['String']['input'];
};

export type ChangePasswordInput = {
current_master_password_hash: Scalars['String']['input'];
new_master_password_hash: Scalars['String']['input'];
new_password_hint?: InputMaybe<Scalars['String']['input']>;
new_protected_symmetric_key: Scalars['String']['input'];
};

export type ContactMessage = {
__typename?: 'ContactMessage';
contact_is_sender: Scalars['Boolean']['output'];
Expand Down Expand Up @@ -211,20 +218,16 @@ export type MoneyAddress = {

export type Mutation = {
__typename?: 'Mutation';
checkPassword: Scalars['Boolean']['output'];
contacts: ContactMutations;
login: NewAccount;
logout: Scalars['Boolean']['output'];
password: PasswordMutations;
pay: PayMutations;
refreshToken: RefreshToken;
signUp: NewAccount;
wallets: WalletMutations;
};

export type MutationCheckPasswordArgs = {
password: Scalars['String']['input'];
};

export type MutationLoginArgs = {
input: LoginInput;
};
Expand All @@ -244,6 +247,20 @@ export type NewAccount = {
refresh_token: Scalars['String']['output'];
};

export type PasswordMutations = {
__typename?: 'PasswordMutations';
change: Scalars['Boolean']['output'];
check: Scalars['Boolean']['output'];
};

export type PasswordMutationsChangeArgs = {
input: ChangePasswordInput;
};

export type PasswordMutationsCheckArgs = {
password: Scalars['String']['input'];
};

export type PayInput = {
account_id?: InputMaybe<Scalars['String']['input']>;
wallet_id?: InputMaybe<Scalars['String']['input']>;
Expand Down
15 changes: 15 additions & 0 deletions src/utils/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,18 @@ export const decryptSymmetricKey = (keys: KeysType): string => {
hexToBytes(keys.masterKey)
);
};

export const changeProtectedSymmetricKey = ({
symmetricKey,
newMasterKey,
}: {
symmetricKey: string;
newMasterKey: string;
}) => {
const protectedSymmetricKey = nip44.v2.encrypt(
symmetricKey,
hexToBytes(newMasterKey)
);

return protectedSymmetricKey;
};
5 changes: 5 additions & 0 deletions src/utils/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const ROUTES = {
signup: '/sign-up',
login: '/login',
dashboard: '/dashboard',
settings: '/settings',
wallet: {
home: '/wallet',
settings: (id: string) => `/wallet/${id}/settings`,
Expand All @@ -27,6 +28,10 @@ export const ROUTES = {
restore: '/setup/wallet/restore',
},
},
docs: {
privacyPolicy: '/docs/privacy-policy',
termsOfService: '/docs/terms-of-service',
},
external: {
github: 'https://github.com/AmbossTech/amboss-banco',
x: 'https://x.com/ambosstech',
Expand Down
3 changes: 2 additions & 1 deletion src/views/landing/OpenSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const OpenSource = () => {
<div className="flex w-full flex-col justify-between">
<div>
<h3 className="mb-10 text-5xl font-bold text-black/85">
Join our open source community
Want to build on Banco? <br />
<br /> Join our open source community
</h3>

<a
Expand Down
2 changes: 1 addition & 1 deletion src/views/landing/Why.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const Why = () => {
image={why2}
/>
<Card
title="Total Control"
title="Self Custody"
subtitle="No third parties can access or control your funds without your explicit permission."
image={why1}
/>
Expand Down
Loading

0 comments on commit 471dbb6

Please sign in to comment.