From eaa69df11b58b161fe87f066081aaf4d64ce991d Mon Sep 17 00:00:00 2001 From: Matej Vukosav Date: Fri, 18 Oct 2024 22:54:40 +0200 Subject: [PATCH] chore: format integrations (#42) --- .../02-starknet-integration.mdx | 87 +++++++++++++------ .../02-blockchains/03-icp-integration.mdx | 50 ++++++++--- 2 files changed, 97 insertions(+), 40 deletions(-) diff --git a/docs/07-integrations/02-blockchains/02-starknet-integration.mdx b/docs/07-integrations/02-blockchains/02-starknet-integration.mdx index e3b20e33..257d7173 100644 --- a/docs/07-integrations/02-blockchains/02-starknet-integration.mdx +++ b/docs/07-integrations/02-blockchains/02-starknet-integration.mdx @@ -5,15 +5,21 @@ title: Starknet Integration # Starknet Integration -Calimero offers integration with Starknet, allowing users to authenticate using their Starknet accounts. Currently, this integration supports login functionality through ArgentX wallet and Metamask Snap, providing a secure and user-friendly way to access the Admin Dashboard. +Calimero offers integration with Starknet, allowing users to authenticate using +their Starknet accounts. Currently, this integration supports login +functionality through ArgentX wallet and Metamask Snap, providing a secure and +user-friendly way to access the Admin Dashboard. ## Logging in with Starknet -Calimero allows users to authenticate via their Starknet wallet, ensuring secure access to the Admin Dashboard. The process of logging in with a Starknet wallet involves the following steps: +Calimero allows users to authenticate via their Starknet wallet, ensuring secure +access to the Admin Dashboard. The process of logging in with a Starknet wallet +involves the following steps: ### 1. User Initiates Login -- The user navigates to the Admin Dashboard and selects the option to "Login with Starknet." +- The user navigates to the Admin Dashboard and selects the option to "Login + with Starknet." - They are presented with two wallet options: ArgentX and Metamask Snap. ### 2. Wallet Selection @@ -23,74 +29,101 @@ Calimero allows users to authenticate via their Starknet wallet, ensuring secure ### 3. Wallet Connection #### For ArgentX: + - If ArgentX is installed, the user is prompted to connect their wallet. -- If not installed, the user is directed to install the ArgentX browser extension. +- If not installed, the user is directed to install the ArgentX browser + extension. #### For Metamask Snap: + - If Metamask with Starknet Snap is installed, the user is prompted to connect. -- If not installed, the user is guided to install Metamask and the Starknet Snap. +- If not installed, the user is guided to install Metamask and the Starknet + Snap. ### 4. Server Issues Challenge -- Upon selecting the wallet, the server generates a challenge. This challenge is then presented to the user for signing. +- Upon selecting the wallet, the server generates a challenge. This challenge is + then presented to the user for signing. ### 5. User Signs Challenge -- The user is prompted to sign the server-issued challenge using their selected Starknet wallet. +- The user is prompted to sign the server-issued challenge using their selected + Starknet wallet. ### 6. Signature Sent to Backend -- After the user signs the challenge, the signature is sent back to the server for verification. +- After the user signs the challenge, the signature is sent back to the server + for verification. ### 7. Signature Verification -The backend verifies the signature to ensure its authenticity using a process tailored to Starknet's cryptographic standards. This verification process differs depending on whether the user is using ArgentX or Metamask Snap. +The backend verifies the signature to ensure its authenticity using a process +tailored to Starknet's cryptographic standards. This verification process +differs depending on whether the user is using ArgentX or Metamask Snap. #### For ArgentX Wallets: 1. **On-Chain Verification**: + - The signature is initially verified on-chain using the Starknet network. - - A JSON-RPC call is made to the Starknet node, invoking the `isValidSignature` function on the user's wallet contract. - - This on-chain verification ensures the signature's validity according to the wallet's implementation. + - A JSON-RPC call is made to the Starknet node, invoking the + `isValidSignature` function on the user's wallet contract. + - This on-chain verification ensures the signature's validity according to + the wallet's implementation. 2. **Message Hash Verification**: - - If the on-chain verification succeeds, an additional verification of the message hash is performed off-chain. - - This step ensures the integrity of the signed message and prevents any tampering. + - If the on-chain verification succeeds, an additional verification of the + message hash is performed off-chain. + - This step ensures the integrity of the signed message and prevents any + tampering. #### For Metamask Snap: 1. **Off-Chain Verification**: - - The signature is verified off-chain using Starknet's cryptographic libraries. - - This involves using the `verify` function from the `starknet_crypto` library to check the signature against the provided public key. + + - The signature is verified off-chain using Starknet's cryptographic + libraries. + - This involves using the `verify` function from the `starknet_crypto` + library to check the signature against the provided public key. 2. **Message Hash Verification**: - - If the signature is valid, an additional verification of the message hash is performed. - - This ensures the integrity of the signed message, similar to the ArgentX process. + - If the signature is valid, an additional verification of the message hash + is performed. + - This ensures the integrity of the signed message, similar to the ArgentX + process. #### Final Steps: -- If the signature and hash are valid, the user's Starknet address is extracted from the wallet address used in the verification process. -- This address serves as the user's Decentralized Identifier (DID), enabling decentralized authentication across different contexts and applications. +- If the signature and hash are valid, the user's Starknet address is extracted + from the wallet address used in the verification process. +- This address serves as the user's Decentralized Identifier (DID), enabling + decentralized authentication across different contexts and applications. ### 8. Successful Login -- Once verified, the user is successfully logged into the Admin Dashboard, with their Starknet address (DID) serving as their user ID for future interactions. +- Once verified, the user is successfully logged into the Admin Dashboard, with + their Starknet address (DID) serving as their user ID for future interactions. -This login flow ensures a secure and seamless authentication process leveraging Starknet's robust blockchain-based security. +This login flow ensures a secure and seamless authentication process leveraging +Starknet's robust blockchain-based security. ## Current Limitations ### Read-Only Functionality -- At present, the Starknet integration is limited to authentication and login functionality. -- Read and write operations on the Starknet blockchain are not yet implemented in this version of the integration. +- At present, the Starknet integration is limited to authentication and login + functionality. +- Read and write operations on the Starknet blockchain are not yet implemented + in this version of the integration. ### Future Developments We are actively working on expanding the Starknet integration to include: -1. **Read Operations**: Implementing secure methods to read data from the Starknet blockchain. -2. **Write Operations**: Developing functionality for users to perform write operations on the Starknet blockchain. - -Stay tuned for updates as we continue to enhance our Starknet integration capabilities. +1. **Read Operations**: Implementing secure methods to read data from the + Starknet blockchain. +2. **Write Operations**: Developing functionality for users to perform write + operations on the Starknet blockchain. +Stay tuned for updates as we continue to enhance our Starknet integration +capabilities. diff --git a/docs/07-integrations/02-blockchains/03-icp-integration.mdx b/docs/07-integrations/02-blockchains/03-icp-integration.mdx index d6b8fb5c..78da160c 100644 --- a/docs/07-integrations/02-blockchains/03-icp-integration.mdx +++ b/docs/07-integrations/02-blockchains/03-icp-integration.mdx @@ -5,57 +5,81 @@ title: ICP Integration # Internet Computer Protocol (ICP) Integration -Calimero offers integration with the Internet Computer Protocol (ICP), allowing users to authenticate using their Internet Identity (II). This integration provides a secure and user-friendly way to access the Admin Dashboard using ICP's robust authentication system. +Calimero offers integration with the Internet Computer Protocol (ICP), allowing +users to authenticate using their Internet Identity (II). This integration +provides a secure and user-friendly way to access the Admin Dashboard using +ICP's robust authentication system. ## Logging in with Internet Identity The login process with Internet Identity involves these key steps: ### 1. User Initiates Login -- The user navigates to the Admin Dashboard and selects the option to "Login with Internet Identity." + +- The user navigates to the Admin Dashboard and selects the option to "Login + with Internet Identity." ### 2. Challenge Preparation -- The system prepares a challenge (encoded as a session public key) before initiating the authentication process. + +- The system prepares a challenge (encoded as a session public key) before + initiating the authentication process. ### 3. Internet Identity Authentication + - A popup window opens, connecting to the Internet Identity service. - The user authenticates through this popup. - The challenge (session public key) is sent to the II service. ### 4. Delegation Chain Retrieval -- Upon successful authentication, the II service creates and returns a delegation chain. -- This delegation chain includes cryptographic proofs of the user's authentication. + +- Upon successful authentication, the II service creates and returns a + delegation chain. +- This delegation chain includes cryptographic proofs of the user's + authentication. ### 5. Processing the Authentication Result + - The application receives the delegation chain from the II service. -- It processes this data, extracting necessary information like the user's public key. +- It processes this data, extracting necessary information like the user's + public key. ### 6. Login Request Preparation + - The application prepares a login request including: - The serialized delegation chain - The original challenge payload - Wallet metadata (ICP canister ID and wallet name) ### 7. Server-side Verification + - The login request is sent to the Calimero server. - The server verifies the delegation chain and challenge. ### 8. Successful Login -- Upon successful verification, the user is logged in and directed to the identity page. -- The user's Internet Identity becomes their unique identifier for future interactions within the Calimero ecosystem. -This process leverages ICP's delegation chain mechanism for secure, decentralized authentication. +- Upon successful verification, the user is logged in and directed to the + identity page. +- The user's Internet Identity becomes their unique identifier for future + interactions within the Calimero ecosystem. + +This process leverages ICP's delegation chain mechanism for secure, +decentralized authentication. ## Current Limitations ### Authentication-Only Functionality -- At present, the ICP integration is primarily focused on authentication and login functionality. + +- At present, the ICP integration is primarily focused on authentication and + login functionality. ## Future Developments We are actively working on expanding the ICP integration to include: -1. **Read Operations**: Implementing secure methods to read data from the Internet Computer. -2. **Write Operations**: Developing functionality for users to perform write operations on ICP canisters. +1. **Read Operations**: Implementing secure methods to read data from the + Internet Computer. +2. **Write Operations**: Developing functionality for users to perform write + operations on ICP canisters. -Stay tuned for updates as we continue to enhance our ICP integration capabilities. +Stay tuned for updates as we continue to enhance our ICP integration +capabilities.