Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
message box
Browse files Browse the repository at this point in the history
Signed-off-by: griff <[email protected]>
  • Loading branch information
m00sey committed Jun 18, 2020
1 parent 5539d16 commit c940451
Show file tree
Hide file tree
Showing 8 changed files with 1,267 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/aries-agent-rest/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/piprate/json-gold v0.3.0 h1:a1vHx7Q1jOO1pjCtKwTI/WCzwaQwRt9VM7apK2uy200=
github.com/piprate/json-gold v0.3.0/go.mod h1:OK1z7UgtBZk06n2cDE2OSq1kffmjFFp5/2yhLLCz9UM=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 h1:J9b7z+QKAmPf4YLrFg6oQUotqHQeUNWwkvo7jZp1GLU=
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ require (
github.com/multiformats/go-multibase v0.0.1
github.com/multiformats/go-multihash v0.0.13
github.com/piprate/json-gold v0.3.0
github.com/pkg/errors v0.9.1
github.com/rs/cors v1.7.0
github.com/square/go-jose/v3 v3.0.0-20191119004800-96c717272387
github.com/stretchr/testify v1.4.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/piprate/json-gold v0.3.0 h1:a1vHx7Q1jOO1pjCtKwTI/WCzwaQwRt9VM7apK2uy200=
github.com/piprate/json-gold v0.3.0/go.mod h1:OK1z7UgtBZk06n2cDE2OSq1kffmjFFp5/2yhLLCz9UM=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 h1:J9b7z+QKAmPf4YLrFg6oQUotqHQeUNWwkvo7jZp1GLU=
Expand Down
16 changes: 16 additions & 0 deletions pkg/didcomm/protocol/messagepickup/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
Copyright Scoir Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

package messagepickup

import (
"github.com/hyperledger/aries-framework-go/pkg/didcomm/common/model"
)

// ProtocolService fix
type ProtocolService interface {
AddMessage(message *model.Envelope, theirDID string) error
}
68 changes: 68 additions & 0 deletions pkg/didcomm/protocol/messagepickup/models.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
Copyright Scoir Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

package messagepickup

import (
"time"

"github.com/hyperledger/aries-framework-go/pkg/didcomm/common/model"
"github.com/hyperledger/aries-framework-go/pkg/didcomm/protocol/decorator"
)

// StatusRequest sent by the recipient to the message_holder to request a status message./0212-pickup#statusrequest
// https://github.com/hyperledger/aries-rfcs/tree/master/features/0212-pickup#statusrequest
type StatusRequest struct {
Type string `json:"@type,omitempty"`
ID string `json:"@id,omitempty"`
Thread *decorator.Thread `json:"~thread,omitempty"`
}

// Status details about pending messages
// https://github.com/hyperledger/aries-rfcs/tree/master/features/0212-pickup#status
type Status struct {
Type string `json:"@type,omitempty"`
ID string `json:"@id,omitempty"`
MessageCount int `json:"message_count"`
DurationWaited int `json:"duration_waited,omitempty"`
LastAddedTime time.Time `json:"last_added_time,omitempty"`
LastDeliveredTime time.Time `json:"last_delivered_time,omitempty"`
LastRemovedTime time.Time `json:"last_removed_time,omitempty"`
TotalSize int `json:"total_size,omitempty"`
Thread *decorator.Thread `json:"~thread,omitempty"`
}

// BatchPickup a request to have multiple waiting messages sent inside a batch message.
// https://github.com/hyperledger/aries-rfcs/tree/master/features/0212-pickup#batch-pickup
type BatchPickup struct {
Type string `json:"@type,omitempty"`
ID string `json:"@id,omitempty"`
BatchSize int `json:"batch_size"`
Thread *decorator.Thread `json:"~thread,omitempty"`
}

// Batch a message that contains multiple waiting messages.
// https://github.com/hyperledger/aries-rfcs/tree/master/features/0212-pickup#batch
type Batch struct {
Type string `json:"@type,omitempty"`
ID string `json:"@id,omitempty"`
Messages []*Message `json:"messages~attach"`
Thread *decorator.Thread `json:"~thread,omitempty"`
}

// Message messagepickup wrapper
type Message struct {
ID string `json:"id"`
AddedTime time.Time `json:"added_time"`
Message *model.Envelope `json:"msg,omitempty"`
}

// Noop message
// https://github.com/hyperledger/aries-rfcs/tree/master/features/0212-pickup#noop
type Noop struct {
Type string `json:"@type,omitempty"`
ID string `json:"@id,omitempty"`
}
Loading

0 comments on commit c940451

Please sign in to comment.