Skip to content

Commit

Permalink
Make body required for all messages (#257)
Browse files Browse the repository at this point in the history
* Make body required for all messages

* 1.17.4
  • Loading branch information
amonsosanz authored Aug 20, 2024
1 parent 3f74a4a commit 737264d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"lint": "eslint --fix --ext .ts src/** tests/**",
"lint:check": "eslint --ext .ts src/** tests/**",
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
"format:check": "prettier \"src/**/*.ts\" \"tests/**/*.ts\" --check"
"format:check": "prettier \"src/**/*.ts\" \"tests/**/*.ts\" --check",
"watch": "tsc --watch"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/iden3comm/types/protocol/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export type IssuanceMessageBody = {

/** CredentialFetchRequestMessage represent Iden3message for credential fetch request */
export type CredentialFetchRequestMessage = BasicMessage & {
body?: CredentialFetchRequestMessageBody;
body: CredentialFetchRequestMessageBody;
type: typeof PROTOCOL_MESSAGE_TYPE.CREDENTIAL_FETCH_REQUEST_MESSAGE_TYPE;
};

Expand All @@ -85,7 +85,7 @@ export type Schema = {

/** CredentialRefreshMessage represent Iden3message for credential refresh request */
export type CredentialRefreshMessage = Required<BasicMessage> & {
body?: CredentialRefreshMessageBody;
body: CredentialRefreshMessageBody;
type: typeof PROTOCOL_MESSAGE_TYPE.CREDENTIAL_REFRESH_MESSAGE_TYPE;
};

Expand Down
2 changes: 1 addition & 1 deletion src/iden3comm/types/protocol/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PROTOCOL_MESSAGE_TYPE } from '../../constants';

/** MessageFetchRequestMessage represent Iden3message for message fetch request. */
export type MessageFetchRequestMessage = Required<BasicMessage> & {
body?: MessageFetchRequestMessageBody;
body: MessageFetchRequestMessageBody;
type: typeof PROTOCOL_MESSAGE_TYPE.CREDENTIAL_FETCH_REQUEST_MESSAGE_TYPE;
};

Expand Down
4 changes: 2 additions & 2 deletions src/iden3comm/types/protocol/proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ZeroKnowledgeProofRequest, ZeroKnowledgeProofResponse } from './auth';

/** ProofGenerationRequestMessage is struct the represents body for proof generation request */
export type ProofGenerationRequestMessage = Required<BasicMessage> & {
body?: ProofGenerationRequestMessageBody;
body: ProofGenerationRequestMessageBody;
type: typeof PROTOCOL_MESSAGE_TYPE.PROOF_GENERATION_REQUEST_MESSAGE_TYPE;
};

Expand All @@ -15,7 +15,7 @@ export type ProofGenerationRequestMessageBody = {

/** ProofGenerationResponseMessage is struct the represents body for proof generation request */
export type ProofGenerationResponseMessage = Required<BasicMessage> & {
body?: ResponseMessageBody;
body: ResponseMessageBody;
type: typeof PROTOCOL_MESSAGE_TYPE.PROOF_GENERATION_RESPONSE_MESSAGE_TYPE;
};

Expand Down
6 changes: 3 additions & 3 deletions src/iden3comm/types/protocol/proposal-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PROTOCOL_MESSAGE_TYPE } from '../../constants';

/** @beta ProposalRequestMessage is struct the represents proposal-request message */
export type ProposalRequestMessage = BasicMessage & {
body?: ProposalRequestMessageBody;
body: ProposalRequestMessageBody;
type: typeof PROTOCOL_MESSAGE_TYPE.PROPOSAL_REQUEST_MESSAGE_TYPE;
};

Expand All @@ -16,7 +16,7 @@ export type ProposalRequestMessageBody = {

/** @beta ProposalMessage is struct the represents proposal message */
export type ProposalMessage = BasicMessage & {
body?: ProposalMessageBody;
body: ProposalMessageBody;
type: typeof PROTOCOL_MESSAGE_TYPE.PROPOSAL_MESSAGE_TYPE;
};

Expand All @@ -33,7 +33,7 @@ export type ProposalRequestCredential = {

/** @beta Proposal is struct the represents proposal inside proposal protocol message */
export type Proposal = {
credentials?: ProposalRequestCredential[];
credentials: ProposalRequestCredential[];
type: string;
url?: string;
expiration?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/iden3comm/types/protocol/revocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PROTOCOL_MESSAGE_TYPE } from '../../constants';

/** RevocationStatusRequestMessage is struct the represents body for proof generation request */
export type RevocationStatusRequestMessage = BasicMessage & {
body?: RevocationStatusRequestMessageBody;
body: RevocationStatusRequestMessageBody;
type: typeof PROTOCOL_MESSAGE_TYPE.REVOCATION_STATUS_REQUEST_MESSAGE_TYPE;
};

Expand All @@ -15,7 +15,7 @@ export type RevocationStatusRequestMessageBody = {

/** RevocationStatusResponseMessage is struct the represents body for proof generation request */
export type RevocationStatusResponseMessage = Required<BasicMessage> & {
body?: RevocationStatusResponseMessageBody;
body: RevocationStatusResponseMessageBody;
type: typeof PROTOCOL_MESSAGE_TYPE.REVOCATION_STATUS_RESPONSE_MESSAGE_TYPE;
};

Expand Down
3 changes: 2 additions & 1 deletion tests/handlers/credential-proposal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ describe('proposal-request handler', () => {
{
type: 'WebVerificationForm',
url: 'http://issuer-agent.com/verify?anyUniqueIdentifierOfSession=55',
description: 'you can pass the verification on our KYC provider by following the next link'
description: 'you can pass the verification on our KYC provider by following the next link',
credentials: []
}
]);

Expand Down

0 comments on commit 737264d

Please sign in to comment.