Announcing IC-SIWS: Use Solana wallets to login to ICP

Hi! I am happy to announce a follow up project to IC-SIWE: IC-SIWS.

IC-SIWS allows you to easily add Solana as an authentication method to you ICP project.

1.

Just as Internet Identity, IC-SIWS validates the authentication payload in an identity provider canister and then generates a delegate identity for the user. This provider canister comes pre built and can be added to your project dfx.json like this:

{
  "canisters": {
    "ic_siws_provider": {
      "type": "custom",
      "candid": "https://github.com/kristoferlund/ic-siws/releases/download/v0.0.1/ic_siws_provider.did",
      "wasm": "https://github.com/kristoferlund/ic-siws/releases/download/v0.0.1/ic_siws_provider.wasm.gz"
    },
    ...
  },
  ...
}

2.

Configure the canister with project specific settings during deployment:

dfx deploy ic_siws_provider --argument "( \
    record { \
        domain = \"127.0.0.1\"; \
        uri = \"http://127.0.0.1:5173\"; \
        salt = \"salt\"; \
        chain_id = opt \"mainnet\"; \
        scheme = opt \"http\"; \
        statement = opt \"Login to the app\"; \
        sign_in_expires_in = opt 300000000000; /* 5 minutes */ \
        session_expires_in = opt 604800000000000; /* 1 week */ \
        targets = opt vec { \
            \"$$(dfx canister id ic_siws_provider)\"; \
            \"$$(dfx canister id backend)\"; \
        }; \
    } \
)"

3.

Hook the support hook up to your React based frontend to interact with the provider canister to generate identities, etc.

import { useSiwsIdentity } from "ic-use-siws-identity";

function LoginButton() {
  const { login, clear, identity, ... } = useSiwsIdentity();
  // ...
}

Provider canister, Rust library and Reaxt hook: GitHub - kristoferlund/ic-siws: SIWS, Sign in with Solana for ICP, the Internet Computer. Build cross chain Solana apps on ICP!

Rust template and demo app: GitHub - kristoferlund/ic-siws-react-demo-rust: React demo and template for IC-SIWS, Sign in with Solana for ICP, the Internet Computer. Build cross chain Solana apps on ICP!

Live demo: https://guidq-3qaaa-aaaal-qiteq-cai.icp0.io/

6 Likes