Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Base validation fetchStatusList2021 #299

Merged
merged 2 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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