Skip to content

Commit

Permalink
support profiles (#105)
Browse files Browse the repository at this point in the history
* support profiles

* support profiles

* modify IPFS tests

* MInor fix

* Rollback rename

* make findCredential private

---------

Co-authored-by: Dimasik Kolezhniuk <[email protected]>
  • Loading branch information
vmidyllic and Kolezhniuk authored Jul 21, 2023
1 parent 92ef8d6 commit 2390add
Show file tree
Hide file tree
Showing 29 changed files with 466 additions and 531 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:

- name: Run Tests
env:
IPFS_URL: ${{ secrets.IPFS_URL }}
WALLET_KEY: ${{ secrets.WALLET_KEY }}
RPC_URL: ${{ secrets.RPC_URL }}
RHS_URL: ${{ secrets.RHS_URL }}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ To run them, please set following variables:
export WALLET_KEY="...key in hex format"
export RPC_URL="...url to polygon network rpc node"
export RHS_URL="..reverse hash service url"
export IPFS_URL="url for ipfs"

```

And place actual circuits to `test/proofs/testdata`
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"dependencies": {
"@iden3/js-crypto": "1.0.0",
"@iden3/js-iden3-core": "1.0.0",
"@iden3/js-jsonld-merklization": "1.0.0",
"@iden3/js-jsonld-merklization": "1.0.1",
"@iden3/js-jwz": "1.0.0",
"@iden3/js-merkletree": "1.0.0",
"@lumeweb/js-sha3-browser": "^0.8.1",
Expand Down
13 changes: 8 additions & 5 deletions src/credentials/status/on-chain-revocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,24 @@ export class OnChainResolver implements CredentialStatusResolver {
issuer: string;
} {
const url = new URL(id);
if (!url.searchParams.has('contractAddress')) {
const contractId = url.searchParams.get('contractAddress');
const revocationNonceParam = url.searchParams.get('revocationNonce');

if (!contractId) {
throw new Error('contractAddress not found');
}
if (!url.searchParams.has('revocationNonce')) {
if (!revocationNonceParam) {
throw new Error('revocationNonce not found');
}

const issuer = id.split('/')[0];
if (!issuer) {
throw new Error('issuer not found in credentialStatus id');
}

// TODO (illia-korotia): after merging core v2 need to parse contract address from did if `contractAddress` is not present in id as param
const contractId = url.searchParams.get('contractAddress');
const revocationNonce = parseInt(url.searchParams.get('revocationNonce')!, 10);
const parts = contractId!.split(':');
const revocationNonce = parseInt(revocationNonceParam, 10);
const parts = contractId.split(':');
if (parts.length != 2) {
throw new Error('invalid contract address');
}
Expand Down
Loading

0 comments on commit 2390add

Please sign in to comment.