Last active
May 21, 2018 21:42
-
-
Save pelle/9e4e751c1144a2e684d970d3a17435cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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