Skip to content

Commit

Permalink
fix: Base validation fetchStatusList2021 (#299)
Browse files Browse the repository at this point in the history
* fix: Error handling fetchStatusList2021

* Removed unsafe type-casts

---------

Co-authored-by: Tasos Derisiotis <50984242+Eengineer1@users.noreply.github.com>
  • Loading branch information
DaevMithran and Eengineer1 committed Jul 4, 2023
1 parent f40ab75 commit 208dde3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,23 @@ didCheqdMainnetProvider:
$require: '@cheqd/did-provider-cheqd#CheqdDIDProvider'
$args:
- defaultKms: local
cosmosPayerSeed: 'your cosmos payer mnemonic seed or private key'
cosmosPayerSeed: sketch mountain erode window enact net enrich smoke claim kangaroo another visual write meat latin bacon pulp similar forum guilt father state erase bright
networkType: mainnet
rpcUrl: 'https://rpc.cheqd.net'
dkgOptions:
chain: cheqdMainnet
network: localhost

didCheqdTestnetProvider:
$require: '@cheqd/did-provider-cheqd#CheqdDIDProvider'
$args:
- defaultKms: local
cosmosPayerSeed: 'your cosmos payer mnemonic seed or private key'
cosmosPayerSeed: sketch mountain erode window enact net enrich smoke claim kangaroo another visual write meat latin bacon pulp similar forum guilt father state erase bright
networkType: testnet
rpcUrl: 'https://rpc.cheqd.network'
dkgOptions:
chain: cheqdTestnet
network: localhost

# DID Manager
didManager:
Expand Down
5 changes: 4 additions & 1 deletion src/agent/ICheqd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3178,7 +3178,6 @@ export class Cheqd implements IAgentPlugin {
} catch (error) {
// silent fail + early exit
console.error(error)

return { suspended: [], error: error as IError } satisfies BulkSuspensionResult
}
}
Expand Down Expand Up @@ -3786,6 +3785,10 @@ export class Cheqd implements IAgentPlugin {
// fetch status list 2021
const content = await (await fetch(credential.credentialStatus.id.split('#')[0])).json() as StatusList2021Revocation | StatusList2021Suspension

if (!(content.StatusList2021 && content.metadata && content.StatusList2021.encodedList && content.StatusList2021.statusPurpose && content.metadata.encoding)) {
throw new Error(`'[did-provider-cheqd]: fetch status list: Status List resource content is not valid'`)
}

// return raw if requested
if (returnRaw) {
return fromString(content.StatusList2021.encodedList, content.metadata.encoding as DefaultStatusList2021Encoding)
Expand Down

0 comments on commit 208dde3

Please sign in to comment.