@toruslabs/openlogin-starkkey
    TypeScript icon, indicating that this package has built-in type declarations

    2.1.0 • Public • Published

    OpenLogin Starkkey

    OpenLogin is a plug & play authentication suite that combines the simplicity of passwordless authentication with the security of non-custodial public key infrastructure (PKI).

    OpenLogin Starkkey helps developers generate stark curve friendly key

    Installation:-

    • npm i @toruslabs/openlogin-starkkey
    • npm i openlogin

    Usage

    import { getStarkHDAccount, STARKNET_NETWORKS, starkEc } from "@toruslabs/openlogin-starkkey";
    import OpenLogin from "openlogin";
    
    const openloginSdk = new OpenLogin({
        clientId: "YOUR_PROJECT_ID",
        network: "testnet"
    });
    
    await openloginSdk.init();
    // already logged in
    if (openloginSdk.privKey) {
        // getting stark key pair from openlogin's key
        const account = getStarkHDAccount(openloginPrivKey, 1, STARKNET_NETWORKS.testnet);
        const keyPair = starkEc.keyFromPrivate(account.privKey);
    } else {
         // login here
         const privKey = await openlogin.login({
            // pass empty string '' as loginProvider to open default torus modal
            // with all default supported login providers or you can pass specific
            // login provider from available list to set as default.
            // for ex: google, facebook, twitter etc
            loginProvider: "",
            redirectUrl: `${window.location.origin}`,
        });
        
        // getting stark key pair from openlogin's key
        const account = getStarkHDAccount(privKey, 1, STARKNET_NETWORKS.testnet);
        const keyPair = starkEc.keyFromPrivate(account.privKey);
    }
    • Refer to examples/react-example folder in root folder of this repo to see a working example for this package.

    Keywords

    none

    Install

    npm i @toruslabs/openlogin-starkkey

    DownloadsWeekly Downloads

    147

    Version

    2.1.0

    License

    ISC

    Unpacked Size

    3.09 MB

    Total Files

    14

    Last publish

    Collaborators

    • torusresearch
    • chaitanyapotti
    • tetratorus
    • shubhamtorus