Skip to content

Instantly share code, notes, and snippets.

@dingpl716
Created February 12, 2019 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dingpl716/d17593b1a39629fb39086c078675d9af to your computer and use it in GitHub Desktop.
Save dingpl716/d17593b1a39629fb39086c078675d9af to your computer and use it in GitHub Desktop.
The following is how the response of request_auth from peer looks like:
{
pk: "peer's pk",
jwt: "jwtHeader.jwtBody.signature"
}
The jwt header and body should further decode as
{
alg: "Ed25519",
type: "jwt"
}
{
iss: "peer's did",
iat: "issued time",
nbf: "not before",
exp: "expiry time",
rvc:[ // stands for requested verifiable claims
prf: ["fullName", "ssn", "birthday", "and other predefined claims"], // stands for profile
poh: [“token name 1”, "token name 2"], // stands for proof of holding
doc: [{uri: "https://doc1.io/useragreemnt", hash: "doc1's digest"}, {uri: "ipfs://doc2", hash: "doc2's digets"}] // stands for doc to be signed
]
edp: "https://example/logon" // stands for endpoint to send claims back
}
The rvc sent back to peer should look like:
prf: [
{id: "fullName", value: "Alice Xu"},
{id: "ssn", value: "123456"},
{id: "birthday", value: "1990-01-31"}
]
poh: [
{
token: "token name 1",
addresses: [ // in case where the user has multiple addresses, the sum of the balance of all the addresses can be used to do the proof of holding
{
address: "address 1",
pk: "address 1's public key",
sig: "signature against the address value, this is used to prove the ownership of the sk"
},
{
address: "address 2",
pk: "address 2's public key",
sig: "signature against the address value, this is used to prove the ownership of the sk"
}
]
},
{
token: "token name 2",
addresses: [
{
address: "address 1",
pk: "address 1's public key",
sig: "signature against the address value, this is used to prove the ownership of the sk"
}
]
}
]
doc: [
{
uri: "https://doc1.io/useragreemnt"
hash: "doc 1's hash",
value: "AGREED or DECLINED",
sig: "user's signature against the doc hash."
},
{
uri: "ipfs://doc2"
hash: "doc 2's hash",
value: "AGREED or DECLINED",
sig: "user's signature against the doc hash."
}
]
@mave99a
Copy link

mave99a commented Feb 12, 2019

  • you'd put this in official repo, so all comments and history preserved.

  • DID Auth message size is not an issue, so don't use short names, those save some bytes but make it not readable. we don't need to save those bytes.

  • define each verifiable claim data forma in the protocol document and for code review. the sample here isn't clear

@mave99a
Copy link

mave99a commented Feb 12, 2019

This still missing meta data for the peer (peer's own information for requester to verify)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment