-
Notifications
You must be signed in to change notification settings - Fork 36
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
support agent revocation status; refactring resolve opts #103
Conversation
@ilya-korotya skip revocation option is supported on sdk level and allows not to include revocation info into the circuits, so zkp will be generated without checks for non-revocation of credentials. |
src/credentials/credential-wallet.ts
Outdated
if (!cred.credentialSubject.id) { | ||
userDID = issuerDID; | ||
} else { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this try catch because DID.parse throws custom error and code flows looks more clearly
src/credentials/credential-wallet.ts
Outdated
issuerDID, | ||
userDID | ||
}; | ||
return await this.getRevocationStatus(cred.credentialStatus, opts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can ommit await here
src/credentials/credential-wallet.ts
Outdated
issuer: issuerDID, | ||
issuerData: issuerData | ||
}); | ||
const cs = await statusResolver.resolve(credStatus, credentialStatusResolveOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const cs = await statusResolver.resolve(credStatus, credentialStatusResolveOptions); | |
return statusResolver.resolve(credStatus, credentialStatusResolveOptions); |
import { MediaType, PROTOCOL_MESSAGE_TYPE } from '../../iden3comm/constants'; | ||
import * as uuid from 'uuid'; | ||
|
||
export class AgentResolver implements CredentialStatusResolver { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add JSDoc comment to all public members for documentation generation
} | ||
}); | ||
const agentResponse = await response.json(); | ||
return Object.assign(new RevocationStatusAgent(), { agentResponse }).toRevocationStatus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const revocationStatusRequestMessage: RevocationStatusRequestMessage = { | ||
id: uuid.v4(), | ||
typ: MediaType.PlainMessage, | ||
type: PROTOCOL_MESSAGE_TYPE.REVOCATION_STATUS_REQUEST_MESSAGE_TYPE, | ||
body: { | ||
revocation_nonce: revocationNonce | ||
}, | ||
thid: uuid.v4(), | ||
from: from, | ||
to: to | ||
}; | ||
return revocationStatusRequestMessage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const revocationStatusRequestMessage: RevocationStatusRequestMessage = { | |
id: uuid.v4(), | |
typ: MediaType.PlainMessage, | |
type: PROTOCOL_MESSAGE_TYPE.REVOCATION_STATUS_REQUEST_MESSAGE_TYPE, | |
body: { | |
revocation_nonce: revocationNonce | |
}, | |
thid: uuid.v4(), | |
from: from, | |
to: to | |
}; | |
return revocationStatusRequestMessage; | |
return { | |
id: uuid.v4(), | |
typ: MediaType.PlainMessage, | |
type: PROTOCOL_MESSAGE_TYPE.REVOCATION_STATUS_REQUEST_MESSAGE_TYPE, | |
body: { | |
revocation_nonce: revocationNonce | |
}, | |
thid: uuid.v4(), | |
from: from, | |
to: to | |
} |
return revocationStatusRequestMessage; | ||
} | ||
|
||
class RevocationStatusAgent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any sense to keep this as class instead of creating function something like
toRevocationStatus(agentResponse: RevocationStatusResponseMessage): RevocationStatus {
return {
mtp: agentResponse.body.mtp,
issuer: agentResponse.body.issuer
}
}
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analog of DTO implementation
src/credentials/status/resolver.ts
Outdated
CredentialStatusType | ||
} from '../../verifiable'; | ||
|
||
export type CredentialStatusResolveOptions = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep it as interface to be more consistent in the project
src/proof/proof-service.ts
Outdated
if (!credential.credentialSubject.id) { | ||
userDID = issuerDID; | ||
} else { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also don't see a reason wrapping this with try/catch
tests/rhs/rhs.test.ts
Outdated
@@ -262,7 +262,7 @@ describe('rhs', () => { | |||
await idWallet.publishStateToRHS(issuerDID, rhsUrl); | |||
|
|||
const rhsResolver = new RHSResolver(mockStateStorageForDefinedState); | |||
const rhsStatus = await rhsResolver.resolve(credRHSStatus, { issuer: issuerDID }); | |||
const rhsStatus = await rhsResolver.resolve(credRHSStatus, { issuerDID: issuerDID }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const rhsStatus = await rhsResolver.resolve(credRHSStatus, { issuerDID: issuerDID }); | |
const rhsStatus = await rhsResolver.resolve(credRHSStatus, { issuerDID }); |
No description provided.