Skip to content

Instantly share code, notes, and snippets.

@pelle
Last active May 21, 2018 21:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pelle/9e4e751c1144a2e684d970d3a17435cc to your computer and use it in GitHub Desktop.
Save pelle/9e4e751c1144a2e684d970d3a17435cc to your computer and use it in GitHub Desktop.
import { Credentials } from 'uport'
import { verifyJWT } from 'did-jwt'
async function mySigner (data) {
// bring up signing UX
// sign data with sha256/secpk256k1
// see https://github.com/uport-project/did-jwt#creating-custom-signers-for-integrating-with-hsm
return
}
const credentials = new Credentials({
did: 'did:ethr:0x...ethereum address of signing identity',
signer: mySigner
})
async function handleAuthRequest (requestJwt) {
const request = await verifyJWT(requestJwt)
// Display UX to user
return credentials.disclose({
nad: '0x...' // ethereum address,
own: {
name: 'Quincy Fandango'
})
}
if (typeof window.didAuthProviders !== 'undefined') {
window.didAuthProviders = []
}
window.didAuthProviders.push(handleAuthRequest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment