-
-
+
+
+
+
+ {publicKey && secretKey && (
+
+
Your Key Pair
+
Public Key: {publicKey}
+
Secret Key: {secretKey}
+
+ setPincode(e.target.value)}
+ />
+
+
+
+ )}
>
)
}
-export default Home
+export default Index
diff --git a/pages/walletStore.ts b/pages/walletStore.ts
new file mode 100644
index 00000000..1912e1f2
--- /dev/null
+++ b/pages/walletStore.ts
@@ -0,0 +1,96 @@
+// import { persisted } from "svelte-local-storage-store";
+// import { KeyManager, KeyManagerPlugins, KeyType } from "@stellar/wallet-sdk";
+// import { error } from "@sveltejs/kit";
+// import { get } from "svelte/store";
+
+// function createWalletStore() {
+// const { subscribe, set } = persisted("walletStore", {
+// keyId: "",
+// publicKey: "",
+// devInfo: {
+// secretKey: "",
+// },
+// });
+
+// return {
+// subscribe,
+
+// register: async ({ publicKey, secretKey, pincode } : {publicKey: any, secretKey: any, pincode: any}) => {
+// try {
+// const keyManager = setupKeyManager();
+
+// let keyMetadata = await keyManager.storeKey({
+// key: {
+// type: KeyType.plaintextKey,
+// publicKey: publicKey,
+// privateKey: secretKey,
+// },
+// password: pincode,
+// encrypterName: KeyManagerPlugins.ScryptEncrypter.name,
+// });
+
+// set({
+// keyId: keyMetadata.id,
+// publicKey: publicKey,
+// devInfo: {
+// secretKey: secretKey,
+// },
+// });
+// } catch (err: any) {
+// console.error("Error saving key", err);
+// throw error(400, { message: err.toString() });
+// }
+// },
+
+// confirmCorrectPincode: async ({ pincode, firstPincode = "", signup = false }: {pincode: any, firstPincode: any, signup: boolean}) => {
+// if (!signup) {
+// try {
+// const keyManager = setupKeyManager();
+// let { keyId } = get(walletStore);
+// await keyManager.loadKey(keyId, pincode);
+// } catch (err) {
+// throw error(400, { message: "Invalid pincode" });
+// }
+// } else {
+// if (pincode !== firstPincode) {
+// throw error(400, { message: "Pincode mismatch" });
+// }
+// }
+// },
+
+// sign: async ({ transactionXDR, network, pincode } : {transactionXDR: any, network: any, pincode: any}) => {
+// try {
+// const keyManager = setupKeyManager();
+
+// let signedTransaction = await keyManager.signTransaction({
+// transaction: TransactionBuilder.fromXDR(transactionXDR, network),
+// id: get(walletStore).keyId,
+// password: pincode,
+// });
+// return signedTransaction;
+// } catch (err: any) {
+// console.error("Error signing transaction", err);
+// throw error(400, { message: err.toString() });
+// }
+// },
+// };
+// }
+
+// export const walletStore = createWalletStore();
+
+// const setupKeyManager = () => {
+// const localKeyStore = new KeyManagerPlugins.LocalStorageKeyStore();
+
+// localKeyStore.configure({
+// prefix: "walletApp",
+// storage: localStorage,
+// });
+
+// const keyManager = new KeyManager({
+// keyStore: localKeyStore,
+// });
+
+// keyManager.registerEncrypter(KeyManagerPlugins.ScryptEncrypter);
+
+// return keyManager;
+// };
\ No newline at end of file
diff --git a/styles/Home.module.css b/styles/Home.module.css
index 12e7323a..54f45121 100644
--- a/styles/Home.module.css
+++ b/styles/Home.module.css
@@ -109,3 +109,28 @@
flex-direction: column;
}
}
+
+
+.login{
+ display: flex;
+ flex-direction: column;
+ gap: 1rem;
+ justify-content: center;
+ align-items: center;
+ margin-top: 15%;
+}
+
+.login button{
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ justify-content: center;
+ padding: 0.5rem 1rem;
+ border-radius: 5px;
+ background-color: #001f3f;
+ height: 58px;
+ width: 180px;
+ color: white;
+ border: none;
+ cursor: pointer;
+}