-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support status param for onchain revocation
- Loading branch information
1 parent
5ffd319
commit 8536224
Showing
14 changed files
with
790 additions
and
279 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { buildDIDType, DID, Id, BytesHelper } from '@iden3/js-iden3-core'; | ||
/** | ||
* Checks if state is genesis state | ||
* | ||
* @param {string} did - did | ||
* @param {bigint|string} state - hash on bigInt or hex string format | ||
* @returns boolean | ||
*/ | ||
export function isGenesisState(did: DID, state: bigint | string): boolean { | ||
if (typeof state === 'string') { | ||
state = BytesHelper.bytesToInt(BytesHelper.hexToBytes(state)); | ||
} | ||
const id = DID.idFromDID(did); | ||
const { method, blockchain, networkId } = DID.decodePartsFromId(id); | ||
const type = buildDIDType(method, blockchain, networkId); | ||
const idFromState = Id.idGenesisFromIdenState(type, state); | ||
|
||
return id.bigInt().toString() === idFromState.bigInt().toString(); | ||
} |
Oops, something went wrong.