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

Make body required for all messages #257

Merged
merged 2 commits into from
Aug 20, 2024
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xpolygonid/js-sdk",
"version": "1.17.3",
"version": "1.17.4",
"description": "SDK to work with Polygon ID",
"main": "dist/node/cjs/index.js",
"module": "dist/node/esm/index.js",
Expand Down 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
Loading