Skip to content

Commit a0f3e8c

Browse files
daverogavmidyllic
andauthored
Manage ethereum based identities (#200)
* 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]>
1 parent 67d91e5 commit a0f3e8c

24 files changed

+1601
-184
lines changed

index.html

+3
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@
7474
publishState: async () => {
7575
return '0xc837f95c984892dbcc3ac41812ecb145fedc26d7003202c50e1b87e226a9b33c';
7676
},
77+
publishStateGeneric: async () => {
78+
return '0xc837f95c984892dbcc3ac41812ecb145fedc26d7003202c50e1b87e226a9b33c';
79+
},
7780
getGISTProof: () => {
7881
return Promise.resolve({
7982
root: 0n,

src/credentials/status/reverse-sparse-merkle-tree.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { IStateStorage } from '../../storage';
55
import { CredentialStatusResolver, CredentialStatusResolveOptions } from './resolver';
66
import { CredentialStatus, RevocationStatus, State } from '../../verifiable';
77
import { VerifiableConstants, CredentialStatusType } from '../../verifiable/constants';
8-
import { isGenesisState } from '../../utils';
8+
import { isEthereumIdentity, isGenesisState } from '../../utils';
99
import { IssuerResolver } from './sparse-merkle-tree';
1010

1111
/**
@@ -173,11 +173,19 @@ export class RHSResolver implements CredentialStatusResolver {
173173
return this.getRevocationStatusFromIssuerData(issuerDID, issuerData, genesisState);
174174
}
175175
const currentStateBigInt = Hash.fromHex(stateHex).bigInt();
176-
if (!isGenesisState(issuerDID, currentStateBigInt)) {
176+
177+
const isEthIdentity = isEthereumIdentity(issuerDID);
178+
179+
if (!isEthIdentity && !isGenesisState(issuerDID, currentStateBigInt)) {
177180
throw new Error(
178181
`latest state not found and state parameter ${stateHex} is not genesis state`
179182
);
180183
}
184+
185+
if (isEthIdentity) {
186+
throw new Error(`State must be published for Ethereum based identity`);
187+
}
188+
181189
latestState = currentStateBigInt;
182190
}
183191

0 commit comments

Comments
 (0)