envelope

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoGrants            = errors.New("envelope has no grants")
	ErrNoKeypairs          = errors.New("envelope has no keypairs")
	ErrInvalidThreshold    = errors.New("invalid threshold configuration")
	ErrContextMismatch     = errors.New("envelope context does not match expected context")
	ErrInsufficientShares  = errors.New("insufficient shares to unlock envelope")
	ErrInvalidShareData    = errors.New("invalid share data")
	ErrInvalidKeypairIndex = errors.New("keypair index out of range")
	ErrEmptyPayload        = errors.New("payload is empty")
	ErrDecryptionFailed    = errors.New("envelope decryption failed")
)

Functions

This section is empty.

Types

type Envelope

type Envelope struct {

	// EnvelopeId is the unique identifier of the envelope.
	// If empty when building, generated from hash of secret + context.
	EnvelopeId string `protobuf:"bytes,1,opt,name=envelope_id,json=envelopeId,proto3" json:"envelopeId,omitempty"`
	// ContextHash is the BLAKE3 hash of the context string.
	// Used to verify the envelope matches the expected application context.
	ContextHash []byte `protobuf:"bytes,2,opt,name=context_hash,json=contextHash,proto3" json:"contextHash,omitempty"`
	// Threshold is the CIRCL threshold parameter.
	// Recovery requires threshold+1 shares.
	// If zero, any single share suffices (no secret splitting).
	Threshold uint32 `protobuf:"varint,3,opt,name=threshold,proto3" json:"threshold,omitempty"`
	// Ciphertext is the encrypted payload.
	// Encrypted with XChaCha20-Poly1305 using a key derived from the scalar.
	Ciphertext []byte `protobuf:"bytes,4,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"`
	// Grants is the list of encrypted share bundles.
	Grants []*EnvelopeGrant `protobuf:"bytes,5,rep,name=grants,proto3" json:"grants,omitempty"`
	// Keypairs is the list of public keys used to encrypt grants.
	Keypairs []*EnvelopeKeypair `protobuf:"bytes,6,rep,name=keypairs,proto3" json:"keypairs,omitempty"`
	// Contents is an optional plaintext description of what the envelope contains.
	// Application-specific; not used in the unlock process.
	Contents []byte `protobuf:"bytes,7,opt,name=contents,proto3" json:"contents,omitempty"`
	// contains filtered or unexported fields
}

Envelope contains an encrypted message unlockable via secret sharing.

The message is encrypted with a key derived from a Ristretto255 scalar. The scalar is split into shares distributed across Grants. At least threshold+1 shares are needed to reconstruct the scalar.

func BuildEnvelope

func BuildEnvelope(
	rnd io.Reader,
	context string,
	payload []byte,
	keypairs []crypto.PubKey,
	config *EnvelopeConfig,
) (*Envelope, error)

BuildEnvelope creates a new sealed Envelope from a plaintext payload.

The payload is encrypted with XChaCha20-Poly1305 using a key derived from a Ristretto255 scalar. The scalar is split into Shamir shares and distributed across grants, each encrypted to the specified keypairs.

Context must be the same string when calling UnlockEnvelope.

func (*Envelope) CloneMessageVT

func (m *Envelope) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Envelope) CloneVT

func (m *Envelope) CloneVT() *Envelope

func (*Envelope) EqualMessageVT

func (this *Envelope) EqualMessageVT(thatMsg any) bool

func (*Envelope) EqualVT

func (this *Envelope) EqualVT(that *Envelope) bool

func (*Envelope) GetCiphertext

func (x *Envelope) GetCiphertext() []byte

func (*Envelope) GetContents

func (x *Envelope) GetContents() []byte

func (*Envelope) GetContextHash

func (x *Envelope) GetContextHash() []byte

func (*Envelope) GetEnvelopeId

func (x *Envelope) GetEnvelopeId() string

func (*Envelope) GetGrants

func (x *Envelope) GetGrants() []*EnvelopeGrant

func (*Envelope) GetKeypairs

func (x *Envelope) GetKeypairs() []*EnvelopeKeypair

func (*Envelope) GetThreshold

func (x *Envelope) GetThreshold() uint32

func (*Envelope) MarshalJSON

func (x *Envelope) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Envelope to JSON.

func (*Envelope) MarshalProtoJSON

func (x *Envelope) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Envelope message to JSON.

func (*Envelope) MarshalProtoText

func (x *Envelope) MarshalProtoText() string

func (*Envelope) MarshalToSizedBufferVT

func (m *Envelope) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Envelope) MarshalToVT

func (m *Envelope) MarshalToVT(dAtA []byte) (int, error)

func (*Envelope) MarshalVT

func (m *Envelope) MarshalVT() (dAtA []byte, err error)

func (*Envelope) ProtoMessage

func (*Envelope) ProtoMessage()

func (*Envelope) Reset

func (x *Envelope) Reset()

func (*Envelope) SizeVT

func (m *Envelope) SizeVT() (n int)

func (*Envelope) String

func (x *Envelope) String() string

func (*Envelope) UnmarshalJSON

func (x *Envelope) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Envelope from JSON.

func (*Envelope) UnmarshalProtoJSON

func (x *Envelope) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Envelope message from JSON.

func (*Envelope) UnmarshalVT

func (m *Envelope) UnmarshalVT(dAtA []byte) error

type EnvelopeConfig

type EnvelopeConfig struct {

	// EnvelopeId is the unique identifier. If empty, auto-generated.
	EnvelopeId string `protobuf:"bytes,1,opt,name=envelope_id,json=envelopeId,proto3" json:"envelopeId,omitempty"`
	// Threshold is the CIRCL threshold parameter (need threshold+1 shares).
	// If zero, any single share suffices.
	Threshold uint32 `protobuf:"varint,2,opt,name=threshold,proto3" json:"threshold,omitempty"`
	// TotalShares is the total number of shares to create.
	// If zero, defaults to sum of shares across all grant configs.
	TotalShares uint32 `protobuf:"varint,3,opt,name=total_shares,json=totalShares,proto3" json:"totalShares,omitempty"`
	// GrantConfigs defines how shares are distributed across grants.
	GrantConfigs []*EnvelopeGrantConfig `protobuf:"bytes,4,rep,name=grant_configs,json=grantConfigs,proto3" json:"grantConfigs,omitempty"`
	// contains filtered or unexported fields
}

EnvelopeConfig is the configuration for building an envelope.

func (*EnvelopeConfig) CloneMessageVT

func (m *EnvelopeConfig) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*EnvelopeConfig) CloneVT

func (m *EnvelopeConfig) CloneVT() *EnvelopeConfig

func (*EnvelopeConfig) EqualMessageVT

func (this *EnvelopeConfig) EqualMessageVT(thatMsg any) bool

func (*EnvelopeConfig) EqualVT

func (this *EnvelopeConfig) EqualVT(that *EnvelopeConfig) bool

func (*EnvelopeConfig) GetEnvelopeId

func (x *EnvelopeConfig) GetEnvelopeId() string

func (*EnvelopeConfig) GetGrantConfigs

func (x *EnvelopeConfig) GetGrantConfigs() []*EnvelopeGrantConfig

func (*EnvelopeConfig) GetThreshold

func (x *EnvelopeConfig) GetThreshold() uint32

func (*EnvelopeConfig) GetTotalShares

func (x *EnvelopeConfig) GetTotalShares() uint32

func (*EnvelopeConfig) MarshalJSON

func (x *EnvelopeConfig) MarshalJSON() ([]byte, error)

MarshalJSON marshals the EnvelopeConfig to JSON.

func (*EnvelopeConfig) MarshalProtoJSON

func (x *EnvelopeConfig) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the EnvelopeConfig message to JSON.

func (*EnvelopeConfig) MarshalProtoText

func (x *EnvelopeConfig) MarshalProtoText() string

func (*EnvelopeConfig) MarshalToSizedBufferVT

func (m *EnvelopeConfig) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*EnvelopeConfig) MarshalToVT

func (m *EnvelopeConfig) MarshalToVT(dAtA []byte) (int, error)

func (*EnvelopeConfig) MarshalVT

func (m *EnvelopeConfig) MarshalVT() (dAtA []byte, err error)

func (*EnvelopeConfig) ProtoMessage

func (*EnvelopeConfig) ProtoMessage()

func (*EnvelopeConfig) Reset

func (x *EnvelopeConfig) Reset()

func (*EnvelopeConfig) SizeVT

func (m *EnvelopeConfig) SizeVT() (n int)

func (*EnvelopeConfig) String

func (x *EnvelopeConfig) String() string

func (*EnvelopeConfig) UnmarshalJSON

func (x *EnvelopeConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the EnvelopeConfig from JSON.

func (*EnvelopeConfig) UnmarshalProtoJSON

func (x *EnvelopeConfig) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the EnvelopeConfig message from JSON.

func (*EnvelopeConfig) UnmarshalVT

func (m *EnvelopeConfig) UnmarshalVT(dAtA []byte) error

type EnvelopeGrant

type EnvelopeGrant struct {

	// KeypairIndexes lists which keypairs can decrypt this grant.
	// Each value is an index into the Envelope.keypairs list.
	KeypairIndexes []uint32 `protobuf:"varint,1,rep,packed,name=keypair_indexes,json=keypairIndexes,proto3" json:"keypairIndexes,omitempty"`
	// Ciphertexts contains the encrypted EnvelopeGrantInner.
	// One ciphertext per keypair index, in the same order.
	// Each encrypted with peer.EncryptToPubKey to the corresponding keypair.
	Ciphertexts [][]byte `protobuf:"bytes,2,rep,name=ciphertexts,proto3" json:"ciphertexts,omitempty"`
	// contains filtered or unexported fields
}

EnvelopeGrant is an encrypted bundle of shares. The grant ciphertext contains a marshaled EnvelopeGrantInner. Encrypted to one or more keypairs in the Envelope keypairs list.

func (*EnvelopeGrant) CloneMessageVT

func (m *EnvelopeGrant) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*EnvelopeGrant) CloneVT

func (m *EnvelopeGrant) CloneVT() *EnvelopeGrant

func (*EnvelopeGrant) EqualMessageVT

func (this *EnvelopeGrant) EqualMessageVT(thatMsg any) bool

func (*EnvelopeGrant) EqualVT

func (this *EnvelopeGrant) EqualVT(that *EnvelopeGrant) bool

func (*EnvelopeGrant) GetCiphertexts

func (x *EnvelopeGrant) GetCiphertexts() [][]byte

func (*EnvelopeGrant) GetKeypairIndexes

func (x *EnvelopeGrant) GetKeypairIndexes() []uint32

func (*EnvelopeGrant) MarshalJSON

func (x *EnvelopeGrant) MarshalJSON() ([]byte, error)

MarshalJSON marshals the EnvelopeGrant to JSON.

func (*EnvelopeGrant) MarshalProtoJSON

func (x *EnvelopeGrant) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the EnvelopeGrant message to JSON.

func (*EnvelopeGrant) MarshalProtoText

func (x *EnvelopeGrant) MarshalProtoText() string

func (*EnvelopeGrant) MarshalToSizedBufferVT

func (m *EnvelopeGrant) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*EnvelopeGrant) MarshalToVT

func (m *EnvelopeGrant) MarshalToVT(dAtA []byte) (int, error)

func (*EnvelopeGrant) MarshalVT

func (m *EnvelopeGrant) MarshalVT() (dAtA []byte, err error)

func (*EnvelopeGrant) ProtoMessage

func (*EnvelopeGrant) ProtoMessage()

func (*EnvelopeGrant) Reset

func (x *EnvelopeGrant) Reset()

func (*EnvelopeGrant) SizeVT

func (m *EnvelopeGrant) SizeVT() (n int)

func (*EnvelopeGrant) String

func (x *EnvelopeGrant) String() string

func (*EnvelopeGrant) UnmarshalJSON

func (x *EnvelopeGrant) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the EnvelopeGrant from JSON.

func (*EnvelopeGrant) UnmarshalProtoJSON

func (x *EnvelopeGrant) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the EnvelopeGrant message from JSON.

func (*EnvelopeGrant) UnmarshalVT

func (m *EnvelopeGrant) UnmarshalVT(dAtA []byte) error

type EnvelopeGrantConfig

type EnvelopeGrantConfig struct {

	// ShareCount is the number of shares to include in this grant.
	// If zero, defaults to 1.
	ShareCount uint32 `protobuf:"varint,1,opt,name=share_count,json=shareCount,proto3" json:"shareCount,omitempty"`
	// KeypairIndexes lists which keypairs can decrypt this grant.
	// Indexes into the keypairs list provided to BuildEnvelope.
	KeypairIndexes []uint32 `protobuf:"varint,2,rep,packed,name=keypair_indexes,json=keypairIndexes,proto3" json:"keypairIndexes,omitempty"`
	// contains filtered or unexported fields
}

EnvelopeGrantConfig configures a single grant in the envelope.

func (*EnvelopeGrantConfig) CloneMessageVT

func (*EnvelopeGrantConfig) CloneVT

func (*EnvelopeGrantConfig) EqualMessageVT

func (this *EnvelopeGrantConfig) EqualMessageVT(thatMsg any) bool

func (*EnvelopeGrantConfig) EqualVT

func (this *EnvelopeGrantConfig) EqualVT(that *EnvelopeGrantConfig) bool

func (*EnvelopeGrantConfig) GetKeypairIndexes

func (x *EnvelopeGrantConfig) GetKeypairIndexes() []uint32

func (*EnvelopeGrantConfig) GetShareCount

func (x *EnvelopeGrantConfig) GetShareCount() uint32

func (*EnvelopeGrantConfig) MarshalJSON

func (x *EnvelopeGrantConfig) MarshalJSON() ([]byte, error)

MarshalJSON marshals the EnvelopeGrantConfig to JSON.

func (*EnvelopeGrantConfig) MarshalProtoJSON

func (x *EnvelopeGrantConfig) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the EnvelopeGrantConfig message to JSON.

func (*EnvelopeGrantConfig) MarshalProtoText

func (x *EnvelopeGrantConfig) MarshalProtoText() string

func (*EnvelopeGrantConfig) MarshalToSizedBufferVT

func (m *EnvelopeGrantConfig) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*EnvelopeGrantConfig) MarshalToVT

func (m *EnvelopeGrantConfig) MarshalToVT(dAtA []byte) (int, error)

func (*EnvelopeGrantConfig) MarshalVT

func (m *EnvelopeGrantConfig) MarshalVT() (dAtA []byte, err error)

func (*EnvelopeGrantConfig) ProtoMessage

func (*EnvelopeGrantConfig) ProtoMessage()

func (*EnvelopeGrantConfig) Reset

func (x *EnvelopeGrantConfig) Reset()

func (*EnvelopeGrantConfig) SizeVT

func (m *EnvelopeGrantConfig) SizeVT() (n int)

func (*EnvelopeGrantConfig) String

func (x *EnvelopeGrantConfig) String() string

func (*EnvelopeGrantConfig) UnmarshalJSON

func (x *EnvelopeGrantConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the EnvelopeGrantConfig from JSON.

func (*EnvelopeGrantConfig) UnmarshalProtoJSON

func (x *EnvelopeGrantConfig) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the EnvelopeGrantConfig message from JSON.

func (*EnvelopeGrantConfig) UnmarshalVT

func (m *EnvelopeGrantConfig) UnmarshalVT(dAtA []byte) error

type EnvelopeGrantInner

type EnvelopeGrantInner struct {

	// Shares is the list of Shamir shares in this grant.
	Shares []*EnvelopeShare `protobuf:"bytes,1,rep,name=shares,proto3" json:"shares,omitempty"`
	// contains filtered or unexported fields
}

EnvelopeGrantInner is the decrypted contents of a grant.

func (*EnvelopeGrantInner) CloneMessageVT

func (m *EnvelopeGrantInner) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*EnvelopeGrantInner) CloneVT

func (m *EnvelopeGrantInner) CloneVT() *EnvelopeGrantInner

func (*EnvelopeGrantInner) EqualMessageVT

func (this *EnvelopeGrantInner) EqualMessageVT(thatMsg any) bool

func (*EnvelopeGrantInner) EqualVT

func (this *EnvelopeGrantInner) EqualVT(that *EnvelopeGrantInner) bool

func (*EnvelopeGrantInner) GetShares

func (x *EnvelopeGrantInner) GetShares() []*EnvelopeShare

func (*EnvelopeGrantInner) MarshalJSON

func (x *EnvelopeGrantInner) MarshalJSON() ([]byte, error)

MarshalJSON marshals the EnvelopeGrantInner to JSON.

func (*EnvelopeGrantInner) MarshalProtoJSON

func (x *EnvelopeGrantInner) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the EnvelopeGrantInner message to JSON.

func (*EnvelopeGrantInner) MarshalProtoText

func (x *EnvelopeGrantInner) MarshalProtoText() string

func (*EnvelopeGrantInner) MarshalToSizedBufferVT

func (m *EnvelopeGrantInner) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*EnvelopeGrantInner) MarshalToVT

func (m *EnvelopeGrantInner) MarshalToVT(dAtA []byte) (int, error)

func (*EnvelopeGrantInner) MarshalVT

func (m *EnvelopeGrantInner) MarshalVT() (dAtA []byte, err error)

func (*EnvelopeGrantInner) ProtoMessage

func (*EnvelopeGrantInner) ProtoMessage()

func (*EnvelopeGrantInner) Reset

func (x *EnvelopeGrantInner) Reset()

func (*EnvelopeGrantInner) SizeVT

func (m *EnvelopeGrantInner) SizeVT() (n int)

func (*EnvelopeGrantInner) String

func (x *EnvelopeGrantInner) String() string

func (*EnvelopeGrantInner) UnmarshalJSON

func (x *EnvelopeGrantInner) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the EnvelopeGrantInner from JSON.

func (*EnvelopeGrantInner) UnmarshalProtoJSON

func (x *EnvelopeGrantInner) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the EnvelopeGrantInner message from JSON.

func (*EnvelopeGrantInner) UnmarshalVT

func (m *EnvelopeGrantInner) UnmarshalVT(dAtA []byte) error

type EnvelopeKeypair

type EnvelopeKeypair struct {

	// PubKey is the marshaled public key (libp2p crypto format).
	PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pubKey,omitempty"`
	// AuthMethodId is an optional identifier for the auth method.
	// Application-specific hint for how to derive the private key.
	AuthMethodId string `protobuf:"bytes,2,opt,name=auth_method_id,json=authMethodId,proto3" json:"authMethodId,omitempty"`
	// AuthMethodParams is optional parameters for the auth method.
	AuthMethodParams []byte `protobuf:"bytes,3,opt,name=auth_method_params,json=authMethodParams,proto3" json:"authMethodParams,omitempty"`
	// contains filtered or unexported fields
}

EnvelopeKeypair is a public key entry in the envelope.

func (*EnvelopeKeypair) CloneMessageVT

func (m *EnvelopeKeypair) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*EnvelopeKeypair) CloneVT

func (m *EnvelopeKeypair) CloneVT() *EnvelopeKeypair

func (*EnvelopeKeypair) EqualMessageVT

func (this *EnvelopeKeypair) EqualMessageVT(thatMsg any) bool

func (*EnvelopeKeypair) EqualVT

func (this *EnvelopeKeypair) EqualVT(that *EnvelopeKeypair) bool

func (*EnvelopeKeypair) GetAuthMethodId

func (x *EnvelopeKeypair) GetAuthMethodId() string

func (*EnvelopeKeypair) GetAuthMethodParams

func (x *EnvelopeKeypair) GetAuthMethodParams() []byte

func (*EnvelopeKeypair) GetPubKey

func (x *EnvelopeKeypair) GetPubKey() []byte

func (*EnvelopeKeypair) MarshalJSON

func (x *EnvelopeKeypair) MarshalJSON() ([]byte, error)

MarshalJSON marshals the EnvelopeKeypair to JSON.

func (*EnvelopeKeypair) MarshalProtoJSON

func (x *EnvelopeKeypair) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the EnvelopeKeypair message to JSON.

func (*EnvelopeKeypair) MarshalProtoText

func (x *EnvelopeKeypair) MarshalProtoText() string

func (*EnvelopeKeypair) MarshalToSizedBufferVT

func (m *EnvelopeKeypair) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*EnvelopeKeypair) MarshalToVT

func (m *EnvelopeKeypair) MarshalToVT(dAtA []byte) (int, error)

func (*EnvelopeKeypair) MarshalVT

func (m *EnvelopeKeypair) MarshalVT() (dAtA []byte, err error)

func (*EnvelopeKeypair) ProtoMessage

func (*EnvelopeKeypair) ProtoMessage()

func (*EnvelopeKeypair) Reset

func (x *EnvelopeKeypair) Reset()

func (*EnvelopeKeypair) SizeVT

func (m *EnvelopeKeypair) SizeVT() (n int)

func (*EnvelopeKeypair) String

func (x *EnvelopeKeypair) String() string

func (*EnvelopeKeypair) UnmarshalJSON

func (x *EnvelopeKeypair) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the EnvelopeKeypair from JSON.

func (*EnvelopeKeypair) UnmarshalProtoJSON

func (x *EnvelopeKeypair) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the EnvelopeKeypair message from JSON.

func (*EnvelopeKeypair) UnmarshalVT

func (m *EnvelopeKeypair) UnmarshalVT(dAtA []byte) error

type EnvelopeShare

type EnvelopeShare struct {

	// Id is the share identifier (marshaled Ristretto255 scalar, 32 bytes).
	Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Value is the share value (marshaled Ristretto255 scalar, 32 bytes).
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

EnvelopeShare is a single Shamir share (Ristretto255 scalar pair).

func (*EnvelopeShare) CloneMessageVT

func (m *EnvelopeShare) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*EnvelopeShare) CloneVT

func (m *EnvelopeShare) CloneVT() *EnvelopeShare

func (*EnvelopeShare) EqualMessageVT

func (this *EnvelopeShare) EqualMessageVT(thatMsg any) bool

func (*EnvelopeShare) EqualVT

func (this *EnvelopeShare) EqualVT(that *EnvelopeShare) bool

func (*EnvelopeShare) GetId

func (x *EnvelopeShare) GetId() []byte

func (*EnvelopeShare) GetValue

func (x *EnvelopeShare) GetValue() []byte

func (*EnvelopeShare) MarshalJSON

func (x *EnvelopeShare) MarshalJSON() ([]byte, error)

MarshalJSON marshals the EnvelopeShare to JSON.

func (*EnvelopeShare) MarshalProtoJSON

func (x *EnvelopeShare) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the EnvelopeShare message to JSON.

func (*EnvelopeShare) MarshalProtoText

func (x *EnvelopeShare) MarshalProtoText() string

func (*EnvelopeShare) MarshalToSizedBufferVT

func (m *EnvelopeShare) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*EnvelopeShare) MarshalToVT

func (m *EnvelopeShare) MarshalToVT(dAtA []byte) (int, error)

func (*EnvelopeShare) MarshalVT

func (m *EnvelopeShare) MarshalVT() (dAtA []byte, err error)

func (*EnvelopeShare) ProtoMessage

func (*EnvelopeShare) ProtoMessage()

func (*EnvelopeShare) Reset

func (x *EnvelopeShare) Reset()

func (*EnvelopeShare) SizeVT

func (m *EnvelopeShare) SizeVT() (n int)

func (*EnvelopeShare) String

func (x *EnvelopeShare) String() string

func (*EnvelopeShare) UnmarshalJSON

func (x *EnvelopeShare) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the EnvelopeShare from JSON.

func (*EnvelopeShare) UnmarshalProtoJSON

func (x *EnvelopeShare) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the EnvelopeShare message from JSON.

func (*EnvelopeShare) UnmarshalVT

func (m *EnvelopeShare) UnmarshalVT(dAtA []byte) error

type EnvelopeUnlockResult

type EnvelopeUnlockResult struct {

	// Success indicates whether the envelope was fully unlocked.
	Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	// SharesAvailable is the number of shares recovered from grants.
	SharesAvailable uint32 `protobuf:"varint,2,opt,name=shares_available,json=sharesAvailable,proto3" json:"sharesAvailable,omitempty"`
	// SharesNeeded is the number of shares needed (threshold+1).
	SharesNeeded uint32 `protobuf:"varint,3,opt,name=shares_needed,json=sharesNeeded,proto3" json:"sharesNeeded,omitempty"`
	// UnlockedGrantIndexes lists which grants were successfully decrypted.
	UnlockedGrantIndexes []uint32 `` /* 129-byte string literal not displayed */
	// contains filtered or unexported fields
}

EnvelopeUnlockResult is the result of attempting to unlock an envelope.

func UnlockEnvelope

func UnlockEnvelope(
	context string,
	env *Envelope,
	privKeys []crypto.PrivKey,
) ([]byte, *EnvelopeUnlockResult, error)

UnlockEnvelope attempts to decrypt an Envelope using the provided private keys.

Returns (payload, result, nil) on success. Returns (nil, result, nil) when not enough shares are available (result has progress). Returns (nil, nil, err) on invalid envelope or other errors.

func (*EnvelopeUnlockResult) CloneMessageVT

func (*EnvelopeUnlockResult) CloneVT

func (*EnvelopeUnlockResult) EqualMessageVT

func (this *EnvelopeUnlockResult) EqualMessageVT(thatMsg any) bool

func (*EnvelopeUnlockResult) EqualVT

func (this *EnvelopeUnlockResult) EqualVT(that *EnvelopeUnlockResult) bool

func (*EnvelopeUnlockResult) GetSharesAvailable

func (x *EnvelopeUnlockResult) GetSharesAvailable() uint32

func (*EnvelopeUnlockResult) GetSharesNeeded

func (x *EnvelopeUnlockResult) GetSharesNeeded() uint32

func (*EnvelopeUnlockResult) GetSuccess

func (x *EnvelopeUnlockResult) GetSuccess() bool

func (*EnvelopeUnlockResult) GetUnlockedGrantIndexes

func (x *EnvelopeUnlockResult) GetUnlockedGrantIndexes() []uint32

func (*EnvelopeUnlockResult) MarshalJSON

func (x *EnvelopeUnlockResult) MarshalJSON() ([]byte, error)

MarshalJSON marshals the EnvelopeUnlockResult to JSON.

func (*EnvelopeUnlockResult) MarshalProtoJSON

func (x *EnvelopeUnlockResult) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the EnvelopeUnlockResult message to JSON.

func (*EnvelopeUnlockResult) MarshalProtoText

func (x *EnvelopeUnlockResult) MarshalProtoText() string

func (*EnvelopeUnlockResult) MarshalToSizedBufferVT

func (m *EnvelopeUnlockResult) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*EnvelopeUnlockResult) MarshalToVT

func (m *EnvelopeUnlockResult) MarshalToVT(dAtA []byte) (int, error)

func (*EnvelopeUnlockResult) MarshalVT

func (m *EnvelopeUnlockResult) MarshalVT() (dAtA []byte, err error)

func (*EnvelopeUnlockResult) ProtoMessage

func (*EnvelopeUnlockResult) ProtoMessage()

func (*EnvelopeUnlockResult) Reset

func (x *EnvelopeUnlockResult) Reset()

func (*EnvelopeUnlockResult) SizeVT

func (m *EnvelopeUnlockResult) SizeVT() (n int)

func (*EnvelopeUnlockResult) String

func (x *EnvelopeUnlockResult) String() string

func (*EnvelopeUnlockResult) UnmarshalJSON

func (x *EnvelopeUnlockResult) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the EnvelopeUnlockResult from JSON.

func (*EnvelopeUnlockResult) UnmarshalProtoJSON

func (x *EnvelopeUnlockResult) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the EnvelopeUnlockResult message from JSON.

func (*EnvelopeUnlockResult) UnmarshalVT

func (m *EnvelopeUnlockResult) UnmarshalVT(dAtA []byte) error

Jump to

Keyboard shortcuts

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