Skip to content

Commit

Permalink
Manage ethereum based identities (#200)
Browse files Browse the repository at this point in the history
* create ethereum based identities

* add transit state logic to identiy wallet

* fix sec256k1 private key generation less than 32 bytes

* add key rotation use case test

* add function to get mtp from core claim


---------

Co-authored-by: vmidyllic <[email protected]>
  • Loading branch information
daveroga and vmidyllic authored Apr 12, 2024
1 parent 67d91e5 commit a0f3e8c
Show file tree
Hide file tree
Showing 24 changed files with 1,601 additions and 184 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
publishState: async () => {
return '0xc837f95c984892dbcc3ac41812ecb145fedc26d7003202c50e1b87e226a9b33c';
},
publishStateGeneric: async () => {
return '0xc837f95c984892dbcc3ac41812ecb145fedc26d7003202c50e1b87e226a9b33c';
},
getGISTProof: () => {
return Promise.resolve({
root: 0n,
Expand Down
12 changes: 10 additions & 2 deletions src/credentials/status/reverse-sparse-merkle-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IStateStorage } from '../../storage';
import { CredentialStatusResolver, CredentialStatusResolveOptions } from './resolver';
import { CredentialStatus, RevocationStatus, State } from '../../verifiable';
import { VerifiableConstants, CredentialStatusType } from '../../verifiable/constants';
import { isGenesisState } from '../../utils';
import { isEthereumIdentity, isGenesisState } from '../../utils';
import { IssuerResolver } from './sparse-merkle-tree';

/**
Expand Down Expand Up @@ -173,11 +173,19 @@ export class RHSResolver implements CredentialStatusResolver {
return this.getRevocationStatusFromIssuerData(issuerDID, issuerData, genesisState);
}
const currentStateBigInt = Hash.fromHex(stateHex).bigInt();
if (!isGenesisState(issuerDID, currentStateBigInt)) {

const isEthIdentity = isEthereumIdentity(issuerDID);

if (!isEthIdentity && !isGenesisState(issuerDID, currentStateBigInt)) {
throw new Error(
`latest state not found and state parameter ${stateHex} is not genesis state`
);
}

if (isEthIdentity) {
throw new Error(`State must be published for Ethereum based identity`);
}

latestState = currentStateBigInt;
}

Expand Down
Loading

0 comments on commit a0f3e8c

Please sign in to comment.