kandi background
Explore Kits

keygen | OverOps Key Generator | Encryption library

 by   takipi Java Version: Current License: No License

 by   takipi Java Version: Current License: No License

Download this library from

kandi X-RAY | keygen Summary

keygen is a Java library typically used in Security, Encryption applications. keygen has no bugs, it has no vulnerabilities, it has build file available and it has low support. You can download it from GitHub.
OverOps Key Generator creates a secret key and installation scripts to be used when installing Takipi (https://app.overops.com)<br/>; You will need to Use it when you install OverOps on a new machine or you can update the key (usually located in /opt/takipi/work/secret.key).
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • keygen has a low active ecosystem.
  • It has 12 star(s) with 5 fork(s). There are 9 watchers for this library.
  • It had no major release in the last 12 months.
  • keygen has no issues reported. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of keygen is current.
keygen Support
Best in #Encryption
Average in #Encryption
keygen Support
Best in #Encryption
Average in #Encryption

quality kandi Quality

  • keygen has 0 bugs and 0 code smells.
keygen Quality
Best in #Encryption
Average in #Encryption
keygen Quality
Best in #Encryption
Average in #Encryption

securitySecurity

  • keygen has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • keygen code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
keygen Security
Best in #Encryption
Average in #Encryption
keygen Security
Best in #Encryption
Average in #Encryption

license License

  • keygen does not have a standard license declared.
  • Check the repository for any license declaration and review the terms closely.
  • Without a license, all rights are reserved, and you cannot use the library in your applications.
keygen License
Best in #Encryption
Average in #Encryption
keygen License
Best in #Encryption
Average in #Encryption

buildReuse

  • keygen releases are not available. You will need to build from source code and install.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • keygen saves you 138 person hours of effort in developing the same functionality from scratch.
  • It has 345 lines of code, 12 functions and 8 files.
  • It has low code complexity. Code complexity directly impacts maintainability of the code.
keygen Reuse
Best in #Encryption
Average in #Encryption
keygen Reuse
Best in #Encryption
Average in #Encryption
Top functions reviewed by kandi - BETA

kandi has reviewed keygen and discovered the below as its top functions. This is intended to give you an instant insight into keygen implemented functionality, and help decide if they suit your requirements.

  • Command - line tool .
    • Generates a key prefix .
      • Generate install instructions file .
        • Converts a byte array to a hex string .
          • Generates the text of a URI and returns it .
            • Build the default properties .
              • Gets the filename for download .
                • Generate AES encryption key .
                  • Generate the checksum for a given key
                    • Generates a secure key .

                      Get all kandi verified functions for this library.

                      Get all kandi verified functions for this library.

                      keygen Key Features

                      OverOps Key Generator

                      Installation

                      copy iconCopydownload iconDownload
                      b. Download the latest release&lt;br/&gt;
                      https://s3.amazonaws.com/app-takipi-com/keygen/keygen-1.2.0-jar-with-dependencies.jar
                      
                      Usage
                      ======
                      USERNAME and PASSWORD are the ones you use to login to OverOps app (https://app.overops.com)&lt;br/&gt;
                      
                      ```java -jar keygen-1.2.0-jar-with-dependencies.jar USERNAME PASSWORD```
                      
                      ----------

                      How to access two different private repositories created by me

                      copy iconCopydownload iconDownload
                      Host dbreader
                         Hostname github.com
                         User git
                         IdentityFile=/Users/raj/.ssh/id_rsa
                      
                      Host trading-engine
                         Hostname github.com
                         User git
                         IdentityFile=/Users/raj/.ssh/id_rsa_docker
                      
                      git clone dbreader:moonresearch/dbreader.git
                      git clone trading-engine:moonresearch/trading-engine.git
                      
                      Host dbreader
                         Hostname github.com
                         User git
                         IdentityFile=/Users/raj/.ssh/id_rsa
                      
                      Host trading-engine
                         Hostname github.com
                         User git
                         IdentityFile=/Users/raj/.ssh/id_rsa_docker
                      
                      git clone dbreader:moonresearch/dbreader.git
                      git clone trading-engine:moonresearch/trading-engine.git
                      

                      Eclipse/Git: &quot;You're using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type.&quot;

                      copy iconCopydownload iconDownload
                      ssh-keygen -t ecdsa -b 256 -m PEM
                      

                      How to transfer (using Program instructions) custom SPL token from my own account to another user's wallet?

                      copy iconCopydownload iconDownload
                      spl-token authorize <WALLET_2_ADDRESS> owner <PROGRAM_DERIVED_ADDRESS>
                      
                      let transfer_instruction = spl_token::instruction::transfer(
                          &token_program.key,
                          &wallet_a_token_account.key,
                          &alice_token_account.key,
                          &program_derived_account.key,
                          &[],
                          transfer_amount,
                      )?;
                      
                      let required_accounts_for_transfer = [
                          wallet_a_token_account.clone(),
                          alice_token_account.clone(),
                          program_derived_account.clone(),
                      ];
                      
                      invoke_signed(
                          &transfer_instruction,
                          &required_accounts_for_transfer,
                          &[
                              &[b"your", b"seeds", b"here",]
                          ]
                      )?;
                      
                      spl-token authorize <WALLET_2_ADDRESS> owner <PROGRAM_DERIVED_ADDRESS>
                      
                      let transfer_instruction = spl_token::instruction::transfer(
                          &token_program.key,
                          &wallet_a_token_account.key,
                          &alice_token_account.key,
                          &program_derived_account.key,
                          &[],
                          transfer_amount,
                      )?;
                      
                      let required_accounts_for_transfer = [
                          wallet_a_token_account.clone(),
                          alice_token_account.clone(),
                          program_derived_account.clone(),
                      ];
                      
                      invoke_signed(
                          &transfer_instruction,
                          &required_accounts_for_transfer,
                          &[
                              &[b"your", b"seeds", b"here",]
                          ]
                      )?;
                      

                      Replace mock credentials in S3Client with redux async thunk

                      copy iconCopydownload iconDownload
                      export const s3Client = new S3Client({
                        region: 'default',
                        credentials: {
                          accessKeyId: 'initAccessKey',
                          secretAccessKey: 'initSecretKey'
                        }
                      });
                      
                      export const useS3Client = () => {
                        const { accessKey, secretKey, keysCreated } = useSelector(
                          (state) => state.authReducer
                        );
                      
                        const client = useMemo(() => {
                          if (keysCreated) {
                            return new S3Client({
                              region: 'default',
                              credentials: {
                                accessKeyId: accessKey,
                                secretAccessKey: secretKey
                              }
                            });
                          }
                      
                          return s3Client;
                        }, [accessKey, secretKey, keysCreated]);
                      
                        return [client, keysCreated];
                      };
                      
                      // i added client as 1st argument
                      export const getUrl = async (client, object, expirationSec = 300) => {
                          const { name, absolutePath, parentBucket } = object;
                      
                          const params = {
                            Bucket: parentBucket,
                            Key: absolutePath
                          };
                      
                          return await getSignedUrl(client, new GetObjectCommand(params), {
                            expiresIn: expirationSec
                          }).catch((error) => setError(error, 'SIGNED URL GETTING FAILED'));
                        }
                      
                      const MainPageContainer = () => {
                        const dispatch = useDispatch();
                        const [, keysCreated] = useS3Client();
                      
                        useEffect(() => {
                          dispatch(fetchKeys());
                        }, [dispatch]);
                      
                        if (!keysCreated) return <Loader />;
                      
                        return <MainPage />;
                      };
                      
                      const SignUrlForm = () => {
                        const [client] = useS3Client();
                      
                        const onGetSignedUrlClick = (object) => {
                          getUrl(client, object, intevalSec).then((url) => {
                            // some actions
                          });
                        };
                      
                        return <Button onClick={onGetSignedUrlClick}>Sign URL</Button>;
                      };
                      
                      export const s3Client = new S3Client({
                        region: 'default',
                        credentials: {
                          accessKeyId: 'initAccessKey',
                          secretAccessKey: 'initSecretKey'
                        }
                      });
                      
                      export const useS3Client = () => {
                        const { accessKey, secretKey, keysCreated } = useSelector(
                          (state) => state.authReducer
                        );
                      
                        const client = useMemo(() => {
                          if (keysCreated) {
                            return new S3Client({
                              region: 'default',
                              credentials: {
                                accessKeyId: accessKey,
                                secretAccessKey: secretKey
                              }
                            });
                          }
                      
                          return s3Client;
                        }, [accessKey, secretKey, keysCreated]);
                      
                        return [client, keysCreated];
                      };
                      
                      // i added client as 1st argument
                      export const getUrl = async (client, object, expirationSec = 300) => {
                          const { name, absolutePath, parentBucket } = object;
                      
                          const params = {
                            Bucket: parentBucket,
                            Key: absolutePath
                          };
                      
                          return await getSignedUrl(client, new GetObjectCommand(params), {
                            expiresIn: expirationSec
                          }).catch((error) => setError(error, 'SIGNED URL GETTING FAILED'));
                        }
                      
                      const MainPageContainer = () => {
                        const dispatch = useDispatch();
                        const [, keysCreated] = useS3Client();
                      
                        useEffect(() => {
                          dispatch(fetchKeys());
                        }, [dispatch]);
                      
                        if (!keysCreated) return <Loader />;
                      
                        return <MainPage />;
                      };
                      
                      const SignUrlForm = () => {
                        const [client] = useS3Client();
                      
                        const onGetSignedUrlClick = (object) => {
                          getUrl(client, object, intevalSec).then((url) => {
                            // some actions
                          });
                        };
                      
                        return <Button onClick={onGetSignedUrlClick}>Sign URL</Button>;
                      };
                      
                      export const s3Client = new S3Client({
                        region: 'default',
                        credentials: {
                          accessKeyId: 'initAccessKey',
                          secretAccessKey: 'initSecretKey'
                        }
                      });
                      
                      export const useS3Client = () => {
                        const { accessKey, secretKey, keysCreated } = useSelector(
                          (state) => state.authReducer
                        );
                      
                        const client = useMemo(() => {
                          if (keysCreated) {
                            return new S3Client({
                              region: 'default',
                              credentials: {
                                accessKeyId: accessKey,
                                secretAccessKey: secretKey
                              }
                            });
                          }
                      
                          return s3Client;
                        }, [accessKey, secretKey, keysCreated]);
                      
                        return [client, keysCreated];
                      };
                      
                      // i added client as 1st argument
                      export const getUrl = async (client, object, expirationSec = 300) => {
                          const { name, absolutePath, parentBucket } = object;
                      
                          const params = {
                            Bucket: parentBucket,
                            Key: absolutePath
                          };
                      
                          return await getSignedUrl(client, new GetObjectCommand(params), {
                            expiresIn: expirationSec
                          }).catch((error) => setError(error, 'SIGNED URL GETTING FAILED'));
                        }
                      
                      const MainPageContainer = () => {
                        const dispatch = useDispatch();
                        const [, keysCreated] = useS3Client();
                      
                        useEffect(() => {
                          dispatch(fetchKeys());
                        }, [dispatch]);
                      
                        if (!keysCreated) return <Loader />;
                      
                        return <MainPage />;
                      };
                      
                      const SignUrlForm = () => {
                        const [client] = useS3Client();
                      
                        const onGetSignedUrlClick = (object) => {
                          getUrl(client, object, intevalSec).then((url) => {
                            // some actions
                          });
                        };
                      
                        return <Button onClick={onGetSignedUrlClick}>Sign URL</Button>;
                      };
                      
                      export const s3Client = new S3Client({
                        region: 'default',
                        credentials: {
                          accessKeyId: 'initAccessKey',
                          secretAccessKey: 'initSecretKey'
                        }
                      });
                      
                      export const useS3Client = () => {
                        const { accessKey, secretKey, keysCreated } = useSelector(
                          (state) => state.authReducer
                        );
                      
                        const client = useMemo(() => {
                          if (keysCreated) {
                            return new S3Client({
                              region: 'default',
                              credentials: {
                                accessKeyId: accessKey,
                                secretAccessKey: secretKey
                              }
                            });
                          }
                      
                          return s3Client;
                        }, [accessKey, secretKey, keysCreated]);
                      
                        return [client, keysCreated];
                      };
                      
                      // i added client as 1st argument
                      export const getUrl = async (client, object, expirationSec = 300) => {
                          const { name, absolutePath, parentBucket } = object;
                      
                          const params = {
                            Bucket: parentBucket,
                            Key: absolutePath
                          };
                      
                          return await getSignedUrl(client, new GetObjectCommand(params), {
                            expiresIn: expirationSec
                          }).catch((error) => setError(error, 'SIGNED URL GETTING FAILED'));
                        }
                      
                      const MainPageContainer = () => {
                        const dispatch = useDispatch();
                        const [, keysCreated] = useS3Client();
                      
                        useEffect(() => {
                          dispatch(fetchKeys());
                        }, [dispatch]);
                      
                        if (!keysCreated) return <Loader />;
                      
                        return <MainPage />;
                      };
                      
                      const SignUrlForm = () => {
                        const [client] = useS3Client();
                      
                        const onGetSignedUrlClick = (object) => {
                          getUrl(client, object, intevalSec).then((url) => {
                            // some actions
                          });
                        };
                      
                        return <Button onClick={onGetSignedUrlClick}>Sign URL</Button>;
                      };
                      

                      git@github.com: Permission denied (publickey) when using yarn to install github js package

                      copy iconCopydownload iconDownload
                      git config --global url.https://github.com/.insteadOf git@github.com:
                      

                      npm install: avoid GitHub login popup and use SSH private key

                      copy iconCopydownload iconDownload
                      [user]
                          email = myemail@example.com
                          name = My Name John Doe
                      [color]
                          ui = true
                      [push]
                          default = simple
                      [alias]
                          co = checkout
                      
                      [url "ssh://git@github.com/"]
                          insteadOf = https://github.com/
                      
                      
                      [core]
                          sshcommand=ssh -i ~/.ssh/my_ssh_key_name
                      
                      [pull]
                          rebase = false
                      
                      ssh-add ~\.ssh\my_ssh_key_filename
                      
                      [user]
                          email = myemail@example.com
                          name = My Name John Doe
                      [color]
                          ui = true
                      [push]
                          default = simple
                      [alias]
                          co = checkout
                      
                      [url "ssh://git@github.com/"]
                          insteadOf = https://github.com/
                      
                      
                      [core]
                          sshcommand=ssh -i ~/.ssh/my_ssh_key_name
                      
                      [pull]
                          rebase = false
                      
                      ssh-add ~\.ssh\my_ssh_key_filename
                      

                      Having difficulty to get SSH with a Yubikey working with macOS monterey

                      copy iconCopydownload iconDownload
                      $ brew install openssh
                      
                      $ export PATH=$(brew --prefix openssh)/bin:$PATH
                      
                      $ brew install openssh
                      
                      $ export PATH=$(brew --prefix openssh)/bin:$PATH
                      

                      Multiple users in DVC

                      copy iconCopydownload iconDownload
                      dvc remote modify --local storage_server user username
                      

                      Trouble using CryptoJS parsing from decrypted format to string with most padding

                      copy iconCopydownload iconDownload
                      var keygenKey = keygen.randomPassword({length: 64, characters: '0123456789abcdef' }); // 32 bytes key
                      var keygenIV = keygen.randomPassword({length: 32, characters: '0123456789abcdef' }); // 16 bytes IV
                      
                      var key = CryptoJS.enc.Hex.parse(keygenKey);
                      var iv = CryptoJS.enc.Hex.parse(keygenIV);
                      
                      var key = CryptoJS.lib.WordArray.random(32);
                      var iv = CryptoJS.lib.WordArray.random(16);
                      
                      var plainText = CryptoJS.enc.Utf8.parse("Hello world");
                      
                      var decrypted =  CryptoJS.AES.decrypt({ciphertext: CryptoJS.enc.Hex.parse(encrypted)},...
                      
                      console.log({
                          "keygenKey": keygenKey,
                          "keygenIV": keygenIV,
                          "encrypted": encrypted,
                          "decrypted": decrypted.toString(CryptoJS.enc.Utf8),
                      });
                      
                      {
                        keygenKey: '10b361a633bfbc163d312d9fd52730d36d19f4db08a7a14481637eaeb662d175',
                        keygenIV: 'bbfd9b4361a1d6f2bd2a81db1dd7e81b',
                        encrypted: 'c0771e1f8146ddaf82ea2198e6a2749e',
                        decrypted: 'Hello world'
                      }
                      
                      var keygenKey = keygen.randomPassword({length: 64, characters: '0123456789abcdef' }); // 32 bytes key
                      var keygenIV = keygen.randomPassword({length: 32, characters: '0123456789abcdef' }); // 16 bytes IV
                      
                      var key = CryptoJS.enc.Hex.parse(keygenKey);
                      var iv = CryptoJS.enc.Hex.parse(keygenIV);
                      
                      var key = CryptoJS.lib.WordArray.random(32);
                      var iv = CryptoJS.lib.WordArray.random(16);
                      
                      var plainText = CryptoJS.enc.Utf8.parse("Hello world");
                      
                      var decrypted =  CryptoJS.AES.decrypt({ciphertext: CryptoJS.enc.Hex.parse(encrypted)},...
                      
                      console.log({
                          "keygenKey": keygenKey,
                          "keygenIV": keygenIV,
                          "encrypted": encrypted,
                          "decrypted": decrypted.toString(CryptoJS.enc.Utf8),
                      });
                      
                      {
                        keygenKey: '10b361a633bfbc163d312d9fd52730d36d19f4db08a7a14481637eaeb662d175',
                        keygenIV: 'bbfd9b4361a1d6f2bd2a81db1dd7e81b',
                        encrypted: 'c0771e1f8146ddaf82ea2198e6a2749e',
                        decrypted: 'Hello world'
                      }
                      
                      var keygenKey = keygen.randomPassword({length: 64, characters: '0123456789abcdef' }); // 32 bytes key
                      var keygenIV = keygen.randomPassword({length: 32, characters: '0123456789abcdef' }); // 16 bytes IV
                      
                      var key = CryptoJS.enc.Hex.parse(keygenKey);
                      var iv = CryptoJS.enc.Hex.parse(keygenIV);
                      
                      var key = CryptoJS.lib.WordArray.random(32);
                      var iv = CryptoJS.lib.WordArray.random(16);
                      
                      var plainText = CryptoJS.enc.Utf8.parse("Hello world");
                      
                      var decrypted =  CryptoJS.AES.decrypt({ciphertext: CryptoJS.enc.Hex.parse(encrypted)},...
                      
                      console.log({
                          "keygenKey": keygenKey,
                          "keygenIV": keygenIV,
                          "encrypted": encrypted,
                          "decrypted": decrypted.toString(CryptoJS.enc.Utf8),
                      });
                      
                      {
                        keygenKey: '10b361a633bfbc163d312d9fd52730d36d19f4db08a7a14481637eaeb662d175',
                        keygenIV: 'bbfd9b4361a1d6f2bd2a81db1dd7e81b',
                        encrypted: 'c0771e1f8146ddaf82ea2198e6a2749e',
                        decrypted: 'Hello world'
                      }
                      
                      var keygenKey = keygen.randomPassword({length: 64, characters: '0123456789abcdef' }); // 32 bytes key
                      var keygenIV = keygen.randomPassword({length: 32, characters: '0123456789abcdef' }); // 16 bytes IV
                      
                      var key = CryptoJS.enc.Hex.parse(keygenKey);
                      var iv = CryptoJS.enc.Hex.parse(keygenIV);
                      
                      var key = CryptoJS.lib.WordArray.random(32);
                      var iv = CryptoJS.lib.WordArray.random(16);
                      
                      var plainText = CryptoJS.enc.Utf8.parse("Hello world");
                      
                      var decrypted =  CryptoJS.AES.decrypt({ciphertext: CryptoJS.enc.Hex.parse(encrypted)},...
                      
                      console.log({
                          "keygenKey": keygenKey,
                          "keygenIV": keygenIV,
                          "encrypted": encrypted,
                          "decrypted": decrypted.toString(CryptoJS.enc.Utf8),
                      });
                      
                      {
                        keygenKey: '10b361a633bfbc163d312d9fd52730d36d19f4db08a7a14481637eaeb662d175',
                        keygenIV: 'bbfd9b4361a1d6f2bd2a81db1dd7e81b',
                        encrypted: 'c0771e1f8146ddaf82ea2198e6a2749e',
                        decrypted: 'Hello world'
                      }
                      
                      var keygenKey = keygen.randomPassword({length: 64, characters: '0123456789abcdef' }); // 32 bytes key
                      var keygenIV = keygen.randomPassword({length: 32, characters: '0123456789abcdef' }); // 16 bytes IV
                      
                      var key = CryptoJS.enc.Hex.parse(keygenKey);
                      var iv = CryptoJS.enc.Hex.parse(keygenIV);
                      
                      var key = CryptoJS.lib.WordArray.random(32);
                      var iv = CryptoJS.lib.WordArray.random(16);
                      
                      var plainText = CryptoJS.enc.Utf8.parse("Hello world");
                      
                      var decrypted =  CryptoJS.AES.decrypt({ciphertext: CryptoJS.enc.Hex.parse(encrypted)},...
                      
                      console.log({
                          "keygenKey": keygenKey,
                          "keygenIV": keygenIV,
                          "encrypted": encrypted,
                          "decrypted": decrypted.toString(CryptoJS.enc.Utf8),
                      });
                      
                      {
                        keygenKey: '10b361a633bfbc163d312d9fd52730d36d19f4db08a7a14481637eaeb662d175',
                        keygenIV: 'bbfd9b4361a1d6f2bd2a81db1dd7e81b',
                        encrypted: 'c0771e1f8146ddaf82ea2198e6a2749e',
                        decrypted: 'Hello world'
                      }
                      
                      var keygenKey = keygen.randomPassword({length: 64, characters: '0123456789abcdef' }); // 32 bytes key
                      var keygenIV = keygen.randomPassword({length: 32, characters: '0123456789abcdef' }); // 16 bytes IV
                      
                      var key = CryptoJS.enc.Hex.parse(keygenKey);
                      var iv = CryptoJS.enc.Hex.parse(keygenIV);
                      
                      var key = CryptoJS.lib.WordArray.random(32);
                      var iv = CryptoJS.lib.WordArray.random(16);
                      
                      var plainText = CryptoJS.enc.Utf8.parse("Hello world");
                      
                      var decrypted =  CryptoJS.AES.decrypt({ciphertext: CryptoJS.enc.Hex.parse(encrypted)},...
                      
                      console.log({
                          "keygenKey": keygenKey,
                          "keygenIV": keygenIV,
                          "encrypted": encrypted,
                          "decrypted": decrypted.toString(CryptoJS.enc.Utf8),
                      });
                      
                      {
                        keygenKey: '10b361a633bfbc163d312d9fd52730d36d19f4db08a7a14481637eaeb662d175',
                        keygenIV: 'bbfd9b4361a1d6f2bd2a81db1dd7e81b',
                        encrypted: 'c0771e1f8146ddaf82ea2198e6a2749e',
                        decrypted: 'Hello world'
                      }
                      
                      var keygenKey = keygen.randomPassword({length: 64, characters: '0123456789abcdef' }); // 32 bytes key
                      var keygenIV = keygen.randomPassword({length: 32, characters: '0123456789abcdef' }); // 16 bytes IV
                      
                      var key = CryptoJS.enc.Hex.parse(keygenKey);
                      var iv = CryptoJS.enc.Hex.parse(keygenIV);
                      
                      var key = CryptoJS.lib.WordArray.random(32);
                      var iv = CryptoJS.lib.WordArray.random(16);
                      
                      var plainText = CryptoJS.enc.Utf8.parse("Hello world");
                      
                      var decrypted =  CryptoJS.AES.decrypt({ciphertext: CryptoJS.enc.Hex.parse(encrypted)},...
                      
                      console.log({
                          "keygenKey": keygenKey,
                          "keygenIV": keygenIV,
                          "encrypted": encrypted,
                          "decrypted": decrypted.toString(CryptoJS.enc.Utf8),
                      });
                      
                      {
                        keygenKey: '10b361a633bfbc163d312d9fd52730d36d19f4db08a7a14481637eaeb662d175',
                        keygenIV: 'bbfd9b4361a1d6f2bd2a81db1dd7e81b',
                        encrypted: 'c0771e1f8146ddaf82ea2198e6a2749e',
                        decrypted: 'Hello world'
                      }
                      

                      Avoid rerendering every component in list while updating only one in React

                      copy iconCopydownload iconDownload
                      import { useState } from "react";
                      import ChatLine from "./ChatLine";
                      import useChatService from "../hooks/useChatService";
                      
                      function areEqual(prevProps, nextProps) {
                        /*
                        return true if passing nextProps to render would return
                        the same result as passing prevProps to render,
                        otherwise return false
                        */
                        return prevProps.line === nextProps.line;
                      }
                      const ChatLineMemo = React.memo(ChatLine, areEqual);
                      
                      const Chat = ({ messages }) => {
                        const [editValue, setEditValue] = useState("");
                        const [editingId, setEditingId] = useState(null);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLineMemo
                                key={line.id}
                                line={line}
                                editValue={line.id === editingId ? editValue : ""}
                                setEditValue={setEditValue}
                                editingId={line.id === editingId ? editingId : null}
                                setEditingId={setEditingId}
                                updateMessage={updateMessage}
                                deleteMessage={deleteMessage}
                              />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      
                      const Child = memo(({ id }) => {
                        useEffect(() => {
                          console.log('Child rendered', id); // <-- doesn't log when messages updates
                        })
                        return <>Child: {id}</>;
                      });
                      
                      const ChatLine = (props) => {
                        ...
                      
                        useEffect(() => {
                          console.log("Chatline rendered", line.id); // <-- logs when messages updates
                        });
                      
                        return (
                          <div>
                            ...
                                <Child id={line.id} />
                            ...
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine);
                      
                      export const ChatServiceContext = createContext({
                        messages: [],
                        updateMessage: () => {},
                        addMessage: () => {},
                        deleteMessage: () => {}
                      });
                      
                      const ChatServiceProvider = ({ children }) => {
                        const [messages, setMessages] = useState([]);
                      
                        const getChatAndUnsub = () => {
                          const q = query(collection(db, "messages"), orderBy("createdAt"));
                      
                          const unsubscribe = onSnapshot(q, (snapshot) => {
                            const data = snapshot.docs.map((doc, index) => {
                              const entry = doc.data();
                      
                              return { .... };
                            });
                      
                            setMessages(data);
                          });
                      
                          return unsubscribe;
                        };
                      
                        useEffect(() => {
                          const unsubscribe = getChatAndUnsub();
                      
                          return () => {
                            unsubscribe();
                          };
                        }, []);
                      
                        const updateMessage = useCallback(async (message, id) => {
                          try {
                            await updateDoc(doc(db, "messages", id), {
                              message,
                              updatedAt: serverTimestamp()
                            });
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const addMessage = useCallback(async (message) => {
                          if (!message) {
                            return;
                          }
                      
                          const messageData = { .... };
                      
                          try {
                            await addDoc(collection(db, "messages"), messageData);
                          } catch (e) {
                            console.log(e);
                          }
                        }, []);
                      
                        const deleteMessage = useCallback(async (idToDelete) => {
                          if (!idToDelete) {
                            return;
                          }
                          try {
                            await deleteDoc(doc(db, "messages", idToDelete));
                          } catch (err) {
                            console.log(err);
                          }
                        }, []);
                      
                        const keyGen = () => { .... };
                      
                        return (
                          <ChatServiceContext.Provider
                            value={{
                              messages,
                              updateMessage,
                              addMessage,
                              deleteMessage
                            }}
                          >
                            {children}
                          </ChatServiceContext.Provider>
                        );
                      };
                      
                      export default ChatServiceProvider;
                      
                      export const useChatService = () => useContext(ChatServiceContext);
                      
                      import ChatServiceProvider from "./hooks/useChatService";
                      
                      ReactDOM.render(
                        <React.StrictMode>
                          <ChatServiceProvider>
                            <App />
                          </ChatServiceProvider>
                        </React.StrictMode>,
                        document.getElementById("root")
                      );
                      
                      const ChatSection = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            {messages.length ? <Chat /> : <NoChat />}
                            <p>ADD A MESSAGE</p>
                            <ChatInput />
                          </div>
                        );
                      };
                      
                      export default ChatSection;
                      
                      const Chat = () => {
                        const { messages } = useChatService();
                      
                        return (
                          <div>
                            <p>MESSAGES :</p>
                            {messages.map((line) => (
                              <ChatLine key={line.id} line={line} />
                            ))}
                          </div>
                        );
                      };
                      
                      export default Chat;
                      
                      const ChatLine = ({ line }) => {
                        const [editValue, setEditValue] = useState("");
                        const [isEditing, setIsEditing] = useState(false);
                      
                        const { updateMessage, deleteMessage } = useChatService();
                      
                        return (
                          <div>
                            {!isEditing ? (
                              <>
                                <span style={{ marginRight: "20px" }}>{line.id}: </span>
                                <span style={{ marginRight: "20px" }}>[{line.displayName}]</span>
                                <span style={{ marginRight: "20px" }}>{line.message}</span>
                                <button
                                  onClick={() => {
                                    setIsEditing(true);
                                    setEditValue(line.message);
                                  }}
                                >
                                  EDIT
                                </button>
                                <button
                                  onClick={() => {
                                    deleteMessage(line.id);
                                  }}
                                >
                                  DELETE
                                </button>
                              </>
                            ) : (
                              <EditMessage
                                value={editValue}
                                onChange={setEditValue}
                                onSave={() => {
                                  // updating message in DB
                                  updateMessage(editValue, line.id);
                                  setEditValue("");
                                  setIsEditing(false);
                                }}
                                onCancel={() => setIsEditing(false)}
                              />
                            )}
                          </div>
                        );
                      };
                      
                      export default memo(ChatLine, (prev, next) => {
                        return prev.line.id === next.line.id;
                      });
                      
                      const EditMessage = ({ value, onChange, onSave, onCancel }) => {
                        return (
                          <div>
                            <textarea
                              onKeyPress={(e) => {
                                if (e.key === "Enter") {
                                  // prevent textarea default behaviour (line break on Enter)
                                  e.preventDefault();
                                  onSave();
                                }
                              }}
                              onChange={(e) => onChange(e.target.value)}
                              value={value}
                              autoFocus
                            />
                            <button type="button" onClick={onCancel}>
                              CANCEL
                            </button>
                          </div>
                        );
                      };
                      
                      export default EditMessage;
                      
                      const ChatInput = () => {
                        const [inputValue, setInputValue] = useState("");
                        const { addMessage } = useChatService();
                      
                        return (
                          <textarea
                            onKeyPress={(e) => {
                              if (e.key === "Enter") {
                                e.preventDefault();
                                addMessage(inputValue);
                                setInputValue("");
                              }
                            }}
                            placeholder="new message..."
                            onChange={(e) => {
                              setInputValue(e.target.value);
                            }}
                            value={inputValue}
                            autoFocus
                          />
                        );
                      };
                      
                      export default ChatInput;
                      

                      Community Discussions

                      Trending Discussions on keygen
                      • How to access two different private repositories created by me
                      • how to communicate 2 instances inside the same VPC but different subnets (regions) using internal IP
                      • Eclipse/Git: &quot;You're using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type.&quot;
                      • How to transfer (using Program instructions) custom SPL token from my own account to another user's wallet?
                      • Replace mock credentials in S3Client with redux async thunk
                      • git@github.com: Permission denied (publickey) when using yarn to install github js package
                      • npm install: avoid GitHub login popup and use SSH private key
                      • Having difficulty to get SSH with a Yubikey working with macOS monterey
                      • Multiple users in DVC
                      • Trouble using CryptoJS parsing from decrypted format to string with most padding
                      Trending Discussions on keygen

                      QUESTION

                      How to access two different private repositories created by me

                      Asked 2022-Apr-03 at 00:47

                      i am having trouble pulling from two different private repos. I followed the instructions around here and created a deploy key in my github private repo. I have two private repos of the form:

                      https://github.com/moonresearch/trading-engine
                      https://github.com/moonresearch/dbreader
                      

                      Now, when i went to my dbreader repo, i went to the settings section and added deploy keys from following the following steps:

                      ssh-keygen -t rsa -b 4096 -C "me@github.com"
                      eval "$(ssh-agent -s)”
                      ssh-add ~/.ssh/id_rsa
                      

                      I then went to my id_rsa.pub file located in ./ssh/id_rsa.pub and copied the contents and pasted into my deploy keys for the repo dbreader. After the above steps, i can successfully do the following:

                      git clone git+ssh://git@github.com/moonresearch/dbreader.git  
                      

                      Now, when i do the same for the first repo, i am seeing a message "key already in use". Then i created a new key called id_rsa_docker and pasted into the deployment key section for the first repo.

                      From my understanding here, i am supposed to create a config file in order to manage multiple deploy keys. So i went ahead and created one in ./ssh directory:

                      Host https://github.com/moonresearch/dbreader
                         Hostname github.com
                         IdentityFile=/Users/raj/.ssh/id_rsa
                      
                      Host https://github.com/moonresearch/trading-engine
                         Hostname github.com
                         IdentityFile=/Users/raj/.ssh/id_rsa_docker
                      

                      After the above steps, i tried a

                      git clone git+ssh://git@github.com/moonresearch/trading-engine.git
                      

                      I am still not able to get it to clone properly. Error i am getting is: remote repository not found.

                      ANSWER

                      Answered 2022-Apr-03 at 00:47

                      Your ~/.ssh/config file should be:

                      Host dbreader
                         Hostname github.com
                         User git
                         IdentityFile=/Users/raj/.ssh/id_rsa
                      
                      Host trading-engine
                         Hostname github.com
                         User git
                         IdentityFile=/Users/raj/.ssh/id_rsa_docker
                      

                      And your URLs:

                      git clone dbreader:moonresearch/dbreader.git
                      git clone trading-engine:moonresearch/trading-engine.git
                      

                      Source https://stackoverflow.com/questions/71722144

                      Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                      Vulnerabilities

                      No vulnerabilities reported

                      Install keygen

                      Fork / Get the code and run<br/>.
                      Fork / Get the code and run<br/>

                      Support

                      For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

                      DOWNLOAD this Library from

                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 430 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      Explore Related Topics

                      Share this Page

                      share link
                      Consider Popular Encryption Libraries
                      Try Top Libraries by takipi
                      Compare Encryption Libraries with Highest Support
                      Compare Encryption Libraries with Highest Quality
                      Compare Encryption Libraries with Highest Security
                      Compare Encryption Libraries with Permissive License
                      Compare Encryption Libraries with Highest Reuse
                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 430 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      • © 2022 Open Weaver Inc.