secure

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2025 License: GPL-3.0 Imports: 5 Imported by: 2

Documentation

Overview

File: envelope.go Description: This is the full, corrected file for the SecureEnvelope facade. The bug in 'FromProto' (which swallowed the URN parse error) and the corresponding bug in 'ToProto' (which passed the wrong type) are both fixed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecureEnvelope

type SecureEnvelope struct {
	// Updated JSON tags to camelCase
	RecipientID           urn.URN `json:"recipientId"`
	EncryptedData         []byte  `json:"encryptedData,omitempty"`
	EncryptedSymmetricKey []byte  `json:"encryptedSymmetricKey,omitempty"`
	Signature             []byte  `json:"signature,omitempty"`
	IsEphemeral           bool    `json:"isEphemeral,omitempty"`
	Priority              int32   `json:"priority,omitempty"`
}

SecureEnvelope is the canonical, idiomatic Go struct for a message.

func FromProto

func FromProto(native *SecureEnvelopePb) (*SecureEnvelope, error)

FromProto converts the Protobuf representation into the idiomatic Go struct.

func (SecureEnvelope) MarshalJSON

func (se SecureEnvelope) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

REFACTOR: This now has a VALUE RECEIVER (no *).

func (*SecureEnvelope) UnmarshalJSON

func (se *SecureEnvelope) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. This remains a POINTER RECEIVER (*se) to modify the struct.

type SecureEnvelopeList

type SecureEnvelopeList struct {
	Envelopes []*SecureEnvelope `json:"envelopes,omitempty"`
}

SecureEnvelopeList is the idiomatic Go struct for a list of envelopes.

func ListFromProto

func ListFromProto(proto *SecureEnvelopeListPb) (*SecureEnvelopeList, error)

ListFromProto converts the Protobuf list into the idiomatic Go struct.

func (SecureEnvelopeList) MarshalJSON

func (sel SecureEnvelopeList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for SecureEnvelopeList.

REFACTOR: This now has a VALUE RECEIVER (no *).

func (*SecureEnvelopeList) UnmarshalJSON

func (sel *SecureEnvelopeList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for SecureEnvelopeList. This remains a POINTER RECEIVER (*sel) to modify the struct.

type SecureEnvelopeListPb

type SecureEnvelopeListPb = smv1.SecureEnvelopeListPb

func ListToProto

func ListToProto(native *SecureEnvelopeList) *SecureEnvelopeListPb

ListToProto converts the idiomatic Go list into its Protobuf representation.

type SecureEnvelopePb

type SecureEnvelopePb = smv1.SecureEnvelopePb

func ToProto

func ToProto(native *SecureEnvelope) *SecureEnvelopePb

ToProto converts the idiomatic Go struct into its Protobuf representation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL