Skip to content

Commit 9406469

Browse files
committed
[dtos] device public key support
1 parent a3c061c commit 9406469

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

smsgateway/domain_devices.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@ package smsgateway
22

33
import "time"
44

5+
// VersionedPublicKey represents a public key for E2E encryption.
6+
type VersionedPublicKey struct {
7+
PublicKey *string `json:"publicKey,omitempty" example:"MIIBIjANBgkqh..."` // Base64-encoded RSA public key for E2E encryption (nullable)
8+
KeyVersion *int `json:"keyVersion,omitempty" example:"1"` // Key version for rotation tracking
9+
}
10+
511
// Device represents a device registered on the server.
612
type Device struct {
13+
VersionedPublicKey
14+
715
ID string `json:"id" example:"PyDmBQZZXYmyxMwED8Fzy"` // Device ID, read only.
816
Name string `json:"name" example:"My Device"` // Device name.
917
CreatedAt time.Time `json:"createdAt" example:"2020-01-01T00:00:00Z"` // Time at which the device was created, read only.

smsgateway/requests_mobile.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@ import "time"
44

55
// MobileRegisterRequest represents a request to register a mobile device.
66
type MobileRegisterRequest struct {
7+
VersionedPublicKey
8+
79
Name *string `json:"name,omitempty" validate:"omitempty,max=128" example:"Android Phone"` // Name of the device (optional)
810
PushToken *string `json:"pushToken" validate:"omitempty,max=256" example:"gHz-T6NezDlOfllr7F-Be"` // FCM token of the device (optional)
911
SimCards []SimCard `json:"simCards,omitempty"` // SIM cards (optional)
1012
}
1113

1214
// MobileUpdateRequest represents a request to update a mobile device.
1315
type MobileUpdateRequest struct {
16+
MobileRegisterRequest
17+
1418
//nolint:revive,staticcheck // backward compatibility
15-
Id string `json:"id" example:"QslD_GefqiYV6RQXdkM6V"` // Device ID
16-
PushToken string `json:"pushToken" example:"gHz-T6NezDlOfllr7F-Be" validate:"omitempty,max=256"` // FCM token of the device (optional)
17-
SimCards []SimCard `json:"simCards,omitempty"` // SIM cards (optional)
19+
Id string `json:"id" example:"QslD_GefqiYV6RQXdkM6V"` // Device ID
1820
}
1921

2022
// MobileChangePasswordRequest represents a request to change the password of a mobile device.

0 commit comments

Comments
 (0)