Skip to content

Commit

Permalink
fix color scheme and tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
vmidyllic committed Feb 20, 2023
1 parent 9586db2 commit 497ba32
Show file tree
Hide file tree
Showing 7 changed files with 6,271 additions and 6,100 deletions.
6 changes: 3 additions & 3 deletions docs/tutorial-basics/auth-handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_position: 5
Tutorial shows how to handle authorization request and
> codebase can be changed. Still in @beta
### transit your first state
### handle authorization request: flow without usage of profiles



Expand Down Expand Up @@ -176,8 +176,8 @@ Tutorial shows how to handle authorization request and
const authV2Data = await circuitStorage.loadCircuitData(CircuitId.AuthV2);
let pm = await initPackageManager(authV2Data,proofService.generateAuthV2Inputs.bind(proofService),proofService.verifyState.bind(proofService))

const authHandler = new AuthHandler(pm,proofService);
const authHandlerRequest = await authHandler.handleAuthorizationRequest(userDID,authRawRequest);
const authHandler = new AuthHandler(pm,proofService,credentialWallet);
const authHandlerRequest = await authHandler.handleAuthorizationRequestForGenesisDID(userDID,authRawRequest);
console.log(authHandlerRequest);

```
127 changes: 80 additions & 47 deletions docs/tutorial-basics/generate proofs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Credential is issued to the user with a BJJ signature proof, so we can generate

> codebase can be changed. Still in @beta

```javascript
async function generateProofs() {
console.log("=============== transit state ===============");
Expand Down Expand Up @@ -80,7 +79,7 @@ async function generateProofs() {

console.log("================= publish to blockchain ===================")

const ethSigner = new ethers.Wallet('08562dec34e81fbc26f719048efb075f217bf911521d4e674cf7b7ad51f989eb',(dataStorage.states as EthStateStorage).provider);
const ethSigner = new ethers.Wallet('',(dataStorage.states as EthStateStorage).provider);
const txId = await proofService.transitState(
issuerDID,
res.oldTreeState,
Expand Down Expand Up @@ -109,15 +108,21 @@ async function generateProofs() {
}
};

const { proof } = await proofService.generateProof(proofReqSig, userDID);
// find and choose credential to generate proof
let credsToChooseForZKPReq = await credentialWallet.findByQuery(
proofReqSig.query
);

const { proof } = await proofService.generateProof(
proofReqSig,
userDID,
credsToChooseForZKPReq[0] // e.g. user chose first
);

console.log(JSON.stringify(proof));
const sigProofOk = await proofService.verifyProof(proof, CircuitId.AtomicQuerySigV2);
console.log("valid: ", sigProofOk);




console.log("================= generate credentialAtomicMTPV2 ===================")


Expand Down Expand Up @@ -147,7 +152,15 @@ async function generateProofs() {
}
};

const { proof:proofMTP } = await proofService.generateProof(proofReqMtp, userDID);

credsToChooseForZKPReq = await credentialWallet.findByQuery(
proofReqMtp.query
);
const { proof: proofMTP } = await proofService.generateProof(
proofReqMtp,
userDID,
credsToChooseForZKPReq[0]
);
console.log(JSON.stringify(proofMTP));
const mtpProofOk = await proofService.verifyProof(proof, CircuitId.AtomicQueryMTPV2);
console.log("valid: ", mtpProofOk);
Expand Down Expand Up @@ -203,56 +216,76 @@ async function initProofService(
### signature proof request

```javascript
console.log(
"================= generate credentialAtomicSigV2 ==================="
);

const proofReqSig: ZeroKnowledgeProofRequest = {
id: 1,
circuitId: CircuitId.AtomicQuerySigV2,
optional: false,
query: {
allowedIssuers: ["*"],
type: credentialRequest.type,
context:
"https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld",
req: {
documentType: {
$eq: 99,
console.log(
"================= generate credentialAtomicSigV2 ==================="
);

const proofReqSig: ZeroKnowledgeProofRequest = {
id: 1,
circuitId: CircuitId.AtomicQuerySigV2,
optional: false,
query: {
allowedIssuers: ["*"],
type: credentialRequest.type,
context:
"https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld",
req: {
documentType: {
$eq: 99,
},
},
},
},
};
};

// find and choose credential to generate proof
let credsToChooseForZKPReq = await credentialWallet.findByQuery(
proofReqSig.query
);

const { proof } = await proofService.generateProof(proofReqSig, userDID);
const { proof } = await proofService.generateProof(
proofReqSig,
userDID,
credsToChooseForZKPReq[0] // e.g. user chose first
);
```

> :bulb: <i>ZeroKnowledgeProofRequest </i> is a protocol proof request, in this case for credential with a BJJ signature proof
### mtp proof request

```javascript
console.log(
"================= generate credentialAtomicSigV2 ==================="
);

const proofReqMtp: ZeroKnowledgeProofRequest = {
id: 1,
circuitId: CircuitId.AtomicQueryMTPV2,
optional: false,
query: {
allowedIssuers: ["*"],
type: credentialRequest.type,
context:
"https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld",
req: {
documentType: {
$eq: 99,
```javascript
console.log(
"================= generate credentialAtomicSigV2 ==================="
);

const proofReqMtp: ZeroKnowledgeProofRequest = {
id: 1,
circuitId: CircuitId.AtomicQueryMTPV2,
optional: false,
query: {
allowedIssuers: ["*"],
type: credentialRequest.type,
context:
"https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld",
req: {
documentType: {
$eq: 99,
},
},
},
},
},
};
};

const { proof } = await proofService.generateProof(proofReqSig, userDID);
credsToChooseForZKPReq = await credentialWallet.findByQuery(
proofReqMtp.query
);
const { proof: proofMTP } = await proofService.generateProof(
proofReqMtp,
userDID,
credsToChooseForZKPReq[0]
);
console.log(JSON.stringify(proofMTP));
const mtpProofOk = await proofService.verifyProof(proof, CircuitId.AtomicQueryMTPV2);
console.log("valid: ", mtpProofOk);
```
> :bulb: <i>ZeroKnowledgeProofRequest </i> is a protocol proof request, in this case for credential with a Iden3SparseMerkleTreeProof
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const config = {
label: 'API',
},
{
href: 'https://github.com/0xPolygonID/js-sdk-tutorials',
href: 'https://github.com/0xPolygonID/js-sdk',
label: 'GitHub',
position: 'right',
},
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/pages/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
text-align: center;
position: relative;
overflow: hidden;
background-color: #7b3fe4;
}

@media screen and (max-width: 996px) {
Expand All @@ -21,3 +22,18 @@
align-items: center;
justify-content: center;
}

.navbar-nav > .active > .a {

color: #9d70ec !important;
text-decoration: none;

}




:root {
--ifm-color-primary: #9d70ec !important;
--ifm-code-font-size: 95%;
}
2 changes: 1 addition & 1 deletion static/img/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 497ba32

Please sign in to comment.