How to use lockr - 10 common examples

To help you get started, we’ve selected a few lockr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github roblav96 / robinhood.tools / src / client / adapters / security.ts View on Github external
const state = {
	ready: false,
	ishuman: false,
	rhusername: '',
}
store.register('security', state)
declare global { namespace Store { interface State { security: typeof state } } }



export const doc = {
	uuid: lockr.get('security.uuid'),
	finger: lockr.get('security.finger'),
} as Security.Doc

// export function headers() {
// 	let headers = {
// 		'x-uuid': `${doc.uuid}.${Date.now()}`,
// 		'x-finger': doc.finger,
// 	} as Dict
// 	return headers
// }

const copts = {
	domain: core.HOSTNAME,
	path: '/', sameSite: true,
} as cookie.CookieSerializeOptions

export function cookies() {
github tronscan / tronscan-frontend / src / components / exchange / dex20 / components / ExchangeList / Table.js View on Github external
Lockr.set("optional", list);
    }
    let newdataSource = dataSource.map(item => {
      if (record.exchange_id == item.exchange_id) {
        item.isChecked = !item.isChecked;
      }
      return item;
    });
    let newUnRecomendList = unRecomendList.map(item => {
      if (record.exchange_id == item.exchange_id) {
        item.isChecked = !item.isChecked;
      }
      return item;
    });
    if (Lockr.get("DEX") != "GEM") {
      this.setState({
        dataSource: newdataSource,
        unRecomendList: newUnRecomendList || []
      });
    }

    // if (Lockr.get("DEX") == "GEM") {
    //   let new20List = dataSource.filter(item => item.isChecked);
    //   let newUnrecoment = unRecomendList.filter(item => item.isChecked);
    //   this.setState({
    //     dataSource: new20List,
    //     unRecomendList: newUnrecoment || []
    //   });
    // } else {
    //   this.setState({ dataSource: newdataSource });
    // }
github tronscan / tronscan-frontend / src / components / blockchain / Compiler / index.js View on Github external
initCompile = () => {
        // code
        const compileCode = Lockr.get('CompileCode');
        // 编译状态
        const compileStatus = Lockr.get('CompileStatus');
        // contractNameList
        const contractNameList = Lockr.get('contractNameList');
        // compileInfo
        const compileInfo = Lockr.get('compileInfo');
        // 编译文件列表
        const compileFiles = Lockr.get('compileFiles');
        const files = compileFiles && this.dataUrlToFile(compileFiles);

        this.setState({
            code: compileCode && compileCode,
            CompileStatus: compileStatus || [],
            contractNameList: contractNameList || [],
            compileInfo: compileInfo || [],
            compileFiles: files || [],
            curFile: files && files[0] && files[0].name
        });
    }
github learningequality / kolibri / kolibri / core / assets / src / heartbeat.js View on Github external
signOutDueToInactivity() {
    // Store that this sign out was for inactivity in local storage.
    Lockr.set(SIGNED_OUT_DUE_TO_INACTIVITY, true);
    // Redirect the user to let the server sort out where they should
    // be now
    redirectBrowser();
  }
  _sessionUrl(id) {
github Ameobea / polotrack / frontend / src / components / FileUploader.js View on Github external
setTimeout(() => {
      this.setState({
        confirmLoading: false,
      });

      // store the uploaded data in localStorage so it's persistant
      Lockr.prefix = 'userData';
      Lockr.set('deposits', JSON.stringify(this.props.deposits));
      Lockr.set('withdrawls', JSON.stringify(this.props.withdrawls));
      Lockr.set('trades', JSON.stringify(this.props.trades));
      Lockr.set('demo', JSON.stringify(false));

      // signal that all data has been successfully uploaded and that it's time to show some juicy visualizations
      this.props.dispatch({type: 'userData/allDataUploaded'});
      this.hideFileUploader();

      // since this is real user data, set the `isDemo` flag to false
      this.props.dispatch({type: 'globalData/setDemoFlag', isDemo: false});

      // hard-refresh the page since components are wired to not watch for changes to static user data
      window.location.reload();
    }, 1234);
    this.setState({
github tronscan / tronscan-frontend / src / components / blockchain / Compiler / index.js View on Github external
componentWillUnmount() {
        let { code, CompileStatus, compileInfo, contractNameList, compileFiles } = this.state;
        if (CompileStatus && code !== '// type your code...'){
            Lockr.set('CompileCode', code);
            Lockr.set('CompileStatus', CompileStatus);
            Lockr.set('compileInfo', compileInfo);
            Lockr.set('contractNameList', contractNameList);

            // file转base64保存
            let list = [];
            compileFiles.map(v => {
                let reader = new FileReader();
                const isFile = v instanceof File;
                reader.readAsDataURL(isFile ? v : v.originFileObj, 'UTF-8');
                reader.onloadend = (evt) => {
                    const dataUrl = evt.target.result;
                    list.push({ dataUrl, name: v.name });
                    Lockr.set('compileFiles', list);
                };
            });
        }
    }
github tronscan / tronscan-frontend / src / reducers / app.js View on Github external
address: action.address,
          isOpen: true,
        },
      };
    }

    case LOGOUT: {
      Lockr.rm("account_key");
      Lockr.rm("account_address");
      Lockr.set("islogin", 0);
      //  compileCode
      Lockr.rm('CompileCode');
      // compile status
      Lockr.rm('CompileStatus');
      // contractNameList
      Lockr.rm('contractNameList');
      // compileInfo
      Lockr.rm('compileInfo');
      // compile files
      Lockr.rm('compileFiles');
      return {
        ...state,
        account: {
          key: undefined,
          isLoggedIn: false,
        },
        wallet: {
          type: undefined,
          address: undefined,
          isOpen: false,
        },
      }
github tronscan / tronscan-frontend / src / reducers / app.js View on Github external
tronStationSDK: new TronStationSDK(action.tronWeb, true)
        },
        wallet: {
          type: ACCOUNT_LEDGER,
          address: action.address,
          isOpen: true,
        },
      };
    }

    case LOGOUT: {
      Lockr.rm("account_key");
      Lockr.rm("account_address");
      Lockr.set("islogin", 0);
      //  compileCode
      Lockr.rm('CompileCode');
      // compile status
      Lockr.rm('CompileStatus');
      // contractNameList
      Lockr.rm('contractNameList');
      // compileInfo
      Lockr.rm('compileInfo');
      // compile files
      Lockr.rm('compileFiles');
      return {
        ...state,
        account: {
          key: undefined,
          isLoggedIn: false,
        },
        wallet: {
          type: undefined,
github tronscan / tronscan-frontend / src / reducers / app.js View on Github external
}

    case LOGOUT: {
      Lockr.rm("account_key");
      Lockr.rm("account_address");
      Lockr.set("islogin", 0);
      //  compileCode
      Lockr.rm('CompileCode');
      // compile status
      Lockr.rm('CompileStatus');
      // contractNameList
      Lockr.rm('contractNameList');
      // compileInfo
      Lockr.rm('compileInfo');
      // compile files
      Lockr.rm('compileFiles');
      return {
        ...state,
        account: {
          key: undefined,
          isLoggedIn: false,
        },
        wallet: {
          type: undefined,
          address: undefined,
          isOpen: false,
        },
      }
    }

    case SET_THEME: {
      //Lockr.set("theme", action.theme);
github tronscan / tronscan-frontend / src / reducers / app.js View on Github external
wallet: {
          type: ACCOUNT_LEDGER,
          address: action.address,
          isOpen: true,
        },
      };
    }

    case LOGOUT: {
      Lockr.rm("account_key");
      Lockr.rm("account_address");
      Lockr.set("islogin", 0);
      //  compileCode
      Lockr.rm('CompileCode');
      // compile status
      Lockr.rm('CompileStatus');
      // contractNameList
      Lockr.rm('contractNameList');
      // compileInfo
      Lockr.rm('compileInfo');
      // compile files
      Lockr.rm('compileFiles');
      return {
        ...state,
        account: {
          key: undefined,
          isLoggedIn: false,
        },
        wallet: {
          type: undefined,
          address: undefined,
          isOpen: false,

lockr

![Lockr logo](http://i.imgur.com/m5kPjkB.png)

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis