Login Solana users on React or Svelte or Vue or Vanilla TS

I finally found some time to give the ic-siws library the same treatment as ic-siwe received a while back.

In short, that means:

  • Making some general security upgrades (not Odin hack related)
  • Retiring the old frontend support library in favour of a new one that works, not only with React, but also with Svelte, Vue and Vanilla TS. Yaay.

Demos!

There are several demo applications available that showcase the integration of the ic_siws_provider canister with different frontend frameworks. These demos provide a practical example of how to use the canister to implement Solana wallet authentication in your ICP application.

Details

  • Library renamed to ic-siws-js and moved to the ic-siws monorepo.
  • SiwsIdentityProvider now requires only the canister id as a parameter.
  • React hook renamed from useSiwsIdentity to useSiws.
  • Project now uses xstate/store under the hood for state management instead of messy React Context.

Migration from v0.0.1

Frontend

Replace dependency in package.json:

- "ic-use-siws-identity": "^0.0.1",
+ "ic-siws-js": "^0.1.0",

Import new name React hook from new location:

- import { useSiwsIdentity } from "ic-use-siws-identity";
+ import { useSiws } from "ic-siws-js/react";

Import SiweIdentityProvider from new location:

- import { SiweIdentityProvider } from "ic-use-siwe-identity";
+ import { SiweIdentityProvider } from "ic-siwe-js/react";

Use new simplified config for SiwsIdentityProvider:

- <SiwsIdentityProvider<_SERVICE>
-   canisterId={canisterId}
-   idlFactory={idlFactory}
- >
+ <SiwsIdentityProvider canisterId={canisterId}>

Provider canister

Use the latest version of the provider canister.

"ic_siws_provider": {
-  "candid": "https://github.com/kristoferlund/ic-siws/releases/download/v0.0.2/ic_siws_provider.did",
+  "candid": "https://github.com/kristoferlund/ic-siws/releases/download/v0.1.0/ic_siws_provider.did",
-  "wasm": "https://github.com/kristoferlund/ic-siws/releases/download/v0.0.2/ic_siws_provider.wasm.gz"
+  "wasm": "https://github.com/kristoferlund/ic-siws/releases/download/v0.1.0/ic_siws_provider.wasm.gz"
  //...

Let’s build!

:seedling:

5 Likes

Can we now consider that SIWB, SIWE, and SIWS have all undergone your audit and security hardening?

SIWB is developed by AstroX. None of the packages should be considered to be formally audited.

2 Likes