Skip to content

Instantly share code, notes, and snippets.

View kamescg's full-sized avatar
🏗️
Ethereum Applications

Kames Geraghty kamescg

🏗️
Ethereum Applications
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kamescg on github.
  • I am kamescg (https://keybase.io/kamescg) on keybase.
  • I have a public key whose fingerprint is 424C AF10 69FD 6A7E 0719 37A1 F137 D798 0D1A 3A34

To claim this, I am signing this object:

@kamescg
kamescg / UPortLoginFirebase.js
Last active May 30, 2018 18:55
UPortLoginFirebase React Component Example
/* ------------------------- External Dependencies -------------------------- */
import idx from './idx'
import React from 'react';
import {compose, lifecycle, withState} from 'recompose'
import { connect } from 'react-redux'
/* ------------------------- Internal Dependencies -------------------------- */
import Component from './component'
import { fromUport } from 'assimilation/store/selectors'
import { fromDatabase } from 'store/departments/selectors'
import {
@kamescg
kamescg / .js
Created May 30, 2018 19:02
UPortLoginFirebase Login Request via the Database
// Login
loginRequest: ()=>dispatch(databaseWriteRequest({
payload: {
input: {
requested: props.requested,
notifications: props.notifications,
},
meta: {
type: 'login',
status: 'initialized',
@kamescg
kamescg / uPortFirebaseLoginGenerate.js
Last active June 26, 2018 18:15
Attestation Generation Firebase Cloud Function
/**
* @desc Generates a uPort login request using the createRequest method
* @param {object} eventData The data saved in the Firebase realtime database.
* @param {string} eventKey The key referencing the new realtime database entry.
*/
const loginGenerate = (eventData, eventKey) => {
return uportCredentials.createRequest({
requested: eventData.input.requested,
notifications: eventData.input.notifications,
callbackUrl: `https://us-central1-${projectId}.cloudfunctions.net/identityCallback?uid=${eventKey}`
@kamescg
kamescg / .js
Last active May 30, 2018 22:23
DAppify Example with Event Registrtion
<script
type="text/javascript"
data-smart-contract-address="0x311a70681f008d51f01e75032ee766718c9d74ba" // Pass in a smart contract address
data-provider="uport" // Select Web3 provider. Currently support uPort, but MetaMask will be added.
src="http://uportme.surge.sh/embed.js"
>
</script>
@kamescg
kamescg / .js
Last active June 6, 2018 14:56
Twitter Verification | uPort Firebase Cloud Function
**
* VerifyTwitter
* @param {object} req
* @param {object} res
*/
const verifyTwitter = (req, res) => {
var params = {user_id: req.user.firebase.identities['twitter.com'][0]}
TwitterClient.get('users/lookup', params, function (error, user, response) {
if (!error) {
const twitterProfile = user[0]
**
* Identity
* @desc Authenticates a uPort decentralized identity
* @param {object} request The HTTP request object
* @param {object} response The HTTP response object
*/
exports.identity = functions.https.onRequest((request, response) => {
cors(request, response, () => {
uportCredentials.receive(request.body.JWT)
.then(profile => {
/* ------------------------- External Dependencies -------------------------- */
import { connect } from 'react-redux';
import { compose, lifecycle, withState } from 'recompose'
import { reduxForm } from 'redux-form'
/* ------------------------- Internal Dependencies -------------------------- */
import { createValidator, required } from 'logic/forms/validation'
import { fromEthers } from 'assimilation/store/selectors'
import ethers from 'assimilation/store/ethers/actions'
import Form from './form'
/* ------------------------- External Dependencies -------------------------- */
import React from 'react'
import { Field } from 'redux-form'
/* ------------------------- Internal Dependencies -------------------------- */
// files
// atoms
import StyleFieldDefault from 'static/style/StyleFieldDefault'
import Box from 'atoms/Box'
import Flex from 'atoms/Flex'
@kamescg
kamescg / EthersReducer.js
Created July 2, 2018 00:32
A demonstration of simplified Redux reducers using a delta identifier.
import { initialState } from './selectors'
import actions from './actions'
export default (state = initialState, {type, payload, metadata, batch, entity} ) => {
if(!!(metadata && metadata.delta) && entity === 'ethers') {
return {
...state,
[metadata.delta]: {
...state[metadata.delta],
status: {