Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .well-known/did-configuration demo #2

Merged
merged 2 commits into from
Aug 8, 2019

Conversation

OR13
Copy link
Contributor

@OR13 OR13 commented Aug 6, 2019

This PR does a small reorg and adds a demo for .well-known/did-configuration.

other static well-known uris can be added later.

The demo opens up more questions about what "verification" of claims mean.

For example, the verifier needs to match the domain that was signed with the request for the claim.
(currently not implemented).

"name": "demo",
"version": "0.1.0",
"private": true,
"homepage": "https://well-known.transmute-did.com",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed to a DIF domain, I just added this for testing purposes.

@@ -0,0 +1,7 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the outer claims object, what I like about this format is that other claim formats can be added later. what I don't like about JWTs is that they are opaque until you decode them.

If this were a linked data signature the claim would be easier to read.

@@ -0,0 +1 @@
well-known.transmute-did.com
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed to DIF if desired

const path = require("path");
const ES256K = require("@transmute/es256k-jws-ts");

// feel free to impersonate me :/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebOfTrustInfo/btcr-hackathon-2019#6

I didn't have to link a leaked key, but I did.

this key is used all over the place in my ES256K tests, I will need to revoke this key at some point, and generate a clean set of claims for the demo.

const innerPayload = {
iss: "did:btcr:xxcl-lzpq-q83a-0d5",
domain: "example.com",
exp: Math.floor(Date.now() / 1000) + 60 * 60 * defaultExpiresInHours
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default expiration is 1 hour for this library, I like that a DID controller can control when their domain claim will expire independent of the domain admin.

const domainClaimJwt = await ES256K.JWT.sign(innerPayload, privateJWK);

const outerPayload = {
// typ: "jwt",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we want to keep the signed outer payload its here, otherwise this should be removed.

const verified = await ES256K.JWT.verify(jwt, publicKey.publicKeyJwk);

if (verified.iss === did) {
console.log(did, " is authorized for: ", verified.domain);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what should happen here? probably the domain associating with the config should be matched against the claim.

If they do not match, the claim should throw...

state = {};

async componentWillMount() {
const authorizedDids = await getAuthorizedDids(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks to the CORs headers for universal resolver a single page app can lookup and verify its own authorized DIDs.

@OR13 OR13 requested a review from ipatka August 6, 2019 23:21
… into feat/add-well-known-did-configuration-demo
@OR13 OR13 merged commit 68dea4f into master Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant