
Security News
Potemkin Understanding in LLMs: New Study Reveals Flaws in AI Benchmarks
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
blockstack-react-auth-provider
Advanced tools
Lightweight React Context-based management of Blockstack authentication state
Impliment blockstack.js' authentication using React patterns you know and love.
$ yarn add blockstack-react-auth-provider
import React, { Component } from 'react'
import { AuthProvider } from 'blockstack-react-auth-provider'
import Router from '~/router'
import { render } from 'react-dom'
class App extends Component {
render() {
return (
<AuthProvider>
<Router />
</AuthProvider>
)
}
}
render(<App />, document.getElementById('root'))
Notice how we use loggedIn
(a boolean) to decide whether to display the 'account' page link, or a 'log in' button.
import React from 'react'
import { AuthConsumer } from 'blockstack-react-auth-provider'
import { NavLink } from 'react-router-dom'
export default () => (
<AuthConsumer>
{({ state: { loggedIn }, logIn }) => (
<div>
<NavLink
exact
to='/'
children='feed'
/>
<NavLink
to='/some-other-page'
children='some-other-page'
/>
{
loggedIn
? (
<NavLink
to='/account'
children='account'
/>
) : (
<button
onClick={ logIn }
children='log in'
className='active'
/>
)
}
</div>
)}
</AuthConsumer>
)
In our router, we might want to disable routes based on authentication state. We can do this by conditionally (based on the value of loggedIn
) rendering a redirect. We also (usually) will want to prevent rendering the main router before authentication state has loaded (aka. isLoading
).
import React, { Component } from 'react'
import { AuthConsumer } from 'blockstack-react-auth-provider'
import { Loading } from '~/components'
import { Feed, SomeOtherPage, Account, FourOFour } from '~/pages'
import { BrowserRouter, Switch, Route, Redirect } from 'react-router-dom'
export default class Router extends Component {
render() {
return (
<AuthConsumer>
{({ state: { isLoading, loggedIn } }) => (
isLoading
? <Loading />
: (
<BrowserRouter>
<Switch>
<Route
exact
path='/'
component={ Feed }
/>
<Route
path='/some-other-page'
component={ SomeOtherPage }
/>
<Route
path='/account'
component={
loggedIn
? Account
: () => <Redirect to='/' />
}
/>
<Route component={ FourOFour } />
</Switch>
</BrowserRouter>
)
)}
</AuthConsumer>
)
}
}
FAQs
Lightweight React Context-based management of Blockstack authentication state
The npm package blockstack-react-auth-provider receives a total of 2 weekly downloads. As such, blockstack-react-auth-provider popularity was classified as not popular.
We found that blockstack-react-auth-provider demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.