Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(async () => {
const userSession = new UserSession({
appConfig: new AppConfig(['store_write', 'publish_data']),
});
configure({
userSession,
});
try {
await collection.drop();
} catch (error) {
// collection doesn't exist
}
const appPrivateKey = makeECPrivateKey();
const blockstackConfig = JSON.stringify({
version: '1.0.0',
userData: {
appPrivateKey,
username: faker.name.findName(),
)}
);
}
}
// Made this a default prop (instead of using this.userSession) so a dummy userSession
// can be passed in for testing purposes
Profile.defaultProps = {
userSession: new UserSession(appConfig)
};
export default Profile
import React, {setGlobal} from 'reactn';
import ReactDOM from 'react-dom';
import { Value } from 'slate';
import 'semantic-ui-css/semantic.min.css'
import './styles/App.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { configure } from 'radiks';
import { UserSession } from 'blockstack';
import { appConfig } from './utils/config';
import initialValue from './components/docs/views/editor/initialValue.json';
import axios from 'axios'
const avatarFallbackImage = 'https://s3.amazonaws.com/onename/avatar-placeholder.png';
const userSession = new UserSession({ appConfig })
const port = window.location.href.includes('local') ? 'http://localhost:5000' : 'https://whispering-sands-47101.herokuapp.com';
const setAxiosHeaders = () => {
// Default
axios.defaults.baseURL = process.env.NODE_ENV === 'development' ? process.env.REACT_APP_API_URL_LOCAL : process.env.REACT_APP_API_URL_SOCKET
// Local w/ sockets (PRO)
// axios.defaults.baseURL = process.env.REACT_APP_API_URL_SOCKET
// Local w/o sockets (Normal)
// axios.defaults.baseURL = process.env.REACT_APP_API_URL_LOCAL
}
setGlobal({
userSession,
organization: {},
)}
);
}
}
// Made this a default prop (instead of using this.userSession) so a dummy userSession
// can be passed in for testing purposes
Profile.defaultProps = {
userSession: new UserSession(appConfig)
};
export default Profile
import { UserSession, AppConfig } from 'blockstack'
export const appConfig = new AppConfig(['store_write', 'publish_data'])
export const userSession = new UserSession({ appConfig })
window.userSession = userSession
const makeUserSession = () => {
const appConfig = new AppConfig(['store_write', 'publish_data'], process.env.RADIKS_API_SERVER);
return new UserSession({ appConfig });
};
export const logoutFromBlockstack = () => {
const userSession = new blockstack.UserSession()
userSession.signUserOut()
}
export function createUserSession() {
const appConfig = new AppConfig(['email'], window.location.origin, null, '/static/manifest.json');
const userSession = new UserSession({ appConfig });
return userSession;
}
import * as blockstack from 'blockstack'
import db from '../db'
const userSession = new blockstack.UserSession()
export const loginWithBlockstack = () => {
const envPath = process.env.NODE_ENV === 'development' ? '-localhost' : ''
const redirectPath = `/redirect-web${envPath}.html`
const appDomain = 'https://lannister.capital'
const transitPrivateKey = userSession.generateAndStoreTransitKey()
const redirectURI = appDomain + redirectPath
const manifestURI = appDomain + '/manifest.json'
const scopes = ['store_write']
const authRequest = blockstack.makeAuthRequest(
transitPrivateKey,
redirectURI,
manifestURI,
scopes,
appDomain
)
import ProfileInformation from "./ProfileInformation.jsx";
import SearchHistory from "./SearchHistory.jsx";
import Pages from "./Pages.jsx";
import LikesAndReactions from "./LikesAndReactions.jsx";
import Ads from "./Ads.jsx";
import Comments from "./Comments.jsx";
import FollowingAndFollowers from "./FollowingAndFollowers.jsx";
import Events from "./Events.jsx";
import Friends from "./Friends.jsx";
import Main from "./Main.jsx";
import Signin from "./Signin.jsx";
import { UserSession, AppConfig } from "blockstack";
import { BrowserRouter as Router, Route, Switch, Link } from "react-router-dom";
import YourPosts from "./YourPosts.jsx";
const appConfig = new AppConfig(["store_write", "publish_data"]);
const userSession = new UserSession({ appConfig: appConfig });
export default class App extends Component {
constructor(props) {
super(props);
}
handleSignIn(e) {
e.preventDefault();
userSession.redirectToSignIn();
}
handleSignOut(e) {
e.preventDefault();
userSession.signUserOut(window.location.origin);
}