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

DIDComm alignment: expires_time & created_time #64

Merged
merged 1 commit into from
Nov 22, 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
3 changes: 3 additions & 0 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type BasicMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// ProtocolMessage is IDEN3Comm message
Expand Down
6 changes: 6 additions & 0 deletions protocol/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ type AuthorizationResponseMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
vmidyllic marked this conversation as resolved.
Show resolved Hide resolved
}

// AuthorizationMessageResponseBody is struct the represents authorization response data
Expand All @@ -45,6 +48,9 @@ type AuthorizationRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// AuthorizationRequestMessageBody is body for authorization request
Expand Down
3 changes: 3 additions & 0 deletions protocol/contract_invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ type ContractInvokeRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// ContractInvokeRequestMessageBody is body for contract invoke request
Expand Down
33 changes: 33 additions & 0 deletions protocol/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ type CredentialIssuanceRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// CredentialIssuanceRequestMessageBody represents data for credential issuance request
Expand All @@ -118,6 +121,9 @@ type CredentialsOfferMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// CredentialsOfferMessageBody is struct the represents offer message
Expand All @@ -144,6 +150,9 @@ type CredentialIssuanceMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// IssuanceMessageBody is struct the represents message when credential is issued
Expand All @@ -161,6 +170,9 @@ type CredentialFetchRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// CredentialFetchRequestMessageBody is msg body for fetch request
Expand All @@ -186,6 +198,9 @@ type CredentialStatusUpdateMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// CredentialStatusUpdateMessageBody the structure that represents the body of credential status update message
Expand All @@ -205,6 +220,9 @@ type CredentialRefreshMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// CredentialRefreshMessageBody is msg body for refresh message
Expand All @@ -224,6 +242,9 @@ type CredentialsOnchainOfferMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// CredentialsOnchainOfferMessageBody is struct the represents onchain offer message
Expand All @@ -247,6 +268,9 @@ type CredentialsProposalRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// CredentialsProposalMessage represents Iden3message for credential proposal
Expand All @@ -264,6 +288,9 @@ type CredentialsProposalMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// CredentialsProposalRequestBody is msg body for proposal requests
Expand Down Expand Up @@ -334,6 +361,9 @@ type CredentialPaymentRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// CredentialPaymentRequestBody is msg body for payment requests
Expand Down Expand Up @@ -389,6 +419,9 @@ type CredentialPaymentMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// CredentialPaymentBody is msg body for payment
Expand Down
3 changes: 3 additions & 0 deletions protocol/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ type DeviceRegistrationRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// DeviceRegistrationRequestMessageBody is struct the represents body for register device request request
Expand Down
3 changes: 3 additions & 0 deletions protocol/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ type MessageFetchRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// MessageFetchRequestMessageBody is struct the represents body for message fetch request.
Expand Down
6 changes: 6 additions & 0 deletions protocol/payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ type PaymentRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// PaymentRequestMessageBody represents the body of the PaymentRequestMessage.
Expand Down Expand Up @@ -334,6 +337,9 @@ type PaymentMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// PaymentMessageBody represents the body of the PaymentMessage.
Expand Down
14 changes: 10 additions & 4 deletions protocol/payment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ func TestPaymentRequestMessagePaymentTypeUnmarshall(t *testing.T) {
]
},
"to": "did:polygonid:polygon:mumbai:2qJUZDSCFtpR8QvHyBC4eFm6ab9sJo5rqPbcaeyGC4",
"from": "did:iden3:polygon:mumbai:x3HstHLj2rTp6HHXk2WczYP7w3rpCsRbwCMeaQ2H2"
"from": "did:iden3:polygon:mumbai:x3HstHLj2rTp6HHXk2WczYP7w3rpCsRbwCMeaQ2H2",
"created_time": 1732111531
}
`

Expand All @@ -51,6 +52,7 @@ func TestPaymentRequestMessagePaymentTypeUnmarshall(t *testing.T) {
"to": "did:iden3:polygon:amoy:x7Z95VkUuyo6mqraJw2VGwCfqTzdqhM1RVjRHzcpK",
"typ": "application/iden3comm-plain-json",
"type": "https://iden3-communication.io/credentials/0.1/payment-request",
"created_time": 1732111531,
"body": {
"agent": "",
"payments": [
Expand Down Expand Up @@ -170,6 +172,7 @@ func TestPaymentRequestMessagePaymentTypeUnmarshall(t *testing.T) {
"from": "did:iden3:polygon:amoy:xCRp75DgAdS63W65fmXHz6p9DwdonuRU9e46DifhX",
"to": "did:iden3:polygon:amoy:x7Z95VkUuyo6mqraJw2VGwCfqTzdqhM1RVjRHzcpK",
"typ": "application/iden3comm-plain-json",
"created_time": 1732111531,
"type": "https://iden3-communication.io/credentials/0.1/payment-request",
"body": {
"agent": "agent.example.com",
Expand Down Expand Up @@ -547,7 +550,8 @@ func TestPaymentMarshalUnmarshal(t *testing.T) {
]
},
"to": "did:polygonid:polygon:mumbai:2qJUZDSCFtpR8QvHyBC4eFm6ab9sJo5rqPbcaeyGC4",
"from": "did:iden3:polygon:mumbai:x3HstHLj2rTp6HHXk2WczYP7w3rpCsRbwCMeaQ2H2"
"from": "did:iden3:polygon:mumbai:x3HstHLj2rTp6HHXk2WczYP7w3rpCsRbwCMeaQ2H2",
"created_time": 1732111531
}
`
const paymentNative = `
Expand All @@ -570,7 +574,8 @@ func TestPaymentMarshalUnmarshal(t *testing.T) {
]
},
"to": "did:polygonid:polygon:mumbai:2qJUZDSCFtpR8QvHyBC4eFm6ab9sJo5rqPbcaeyGC4",
"from": "did:iden3:polygon:mumbai:x3HstHLj2rTp6HHXk2WczYP7w3rpCsRbwCMeaQ2H2"
"from": "did:iden3:polygon:mumbai:x3HstHLj2rTp6HHXk2WczYP7w3rpCsRbwCMeaQ2H2",
"created_time": 1732111531
}
`
const paymentERC20 = `
Expand All @@ -594,7 +599,8 @@ func TestPaymentMarshalUnmarshal(t *testing.T) {
]
},
"to": "did:polygonid:polygon:mumbai:2qJUZDSCFtpR8QvHyBC4eFm6ab9sJo5rqPbcaeyGC4",
"from": "did:iden3:polygon:mumbai:x3HstHLj2rTp6HHXk2WczYP7w3rpCsRbwCMeaQ2H2"
"from": "did:iden3:polygon:mumbai:x3HstHLj2rTp6HHXk2WczYP7w3rpCsRbwCMeaQ2H2",
"created_time": 1732111531
}
`

Expand Down
3 changes: 3 additions & 0 deletions protocol/problem_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ type ProblemReportMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// ProblemReportMessageBody is struct the represents body for problem report
Expand Down
6 changes: 6 additions & 0 deletions protocol/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ type ProofGenerationRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// ProofGenerationRequestMessageBody is struct the represents body for proof generation request
Expand All @@ -40,6 +43,9 @@ type ProofGenerationResponseMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// ResponseMessageBody is struct the represents request for revocation status
Expand Down
6 changes: 6 additions & 0 deletions protocol/revocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ type RevocationStatusRequestMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// RevocationStatusRequestMessageBody is struct the represents request for revocation status
Expand All @@ -40,6 +43,9 @@ type RevocationStatusResponseMessage struct {

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`

CreatedTime *int64 `json:"created_time,omitempty"`
ExpiresTime *int64 `json:"expires_time,omitempty"`
}

// RevocationStatusResponseMessageBody is struct the represents request for revocation status
Expand Down
Loading