|
| 1 | +// @generated |
| 2 | +// This file is @generated by prost-build. |
| 3 | +/// Envelope contains an encrypted message unlockable via secret sharing. |
| 4 | +/// |
| 5 | +/// The message is encrypted with a key derived from a Ristretto255 scalar. |
| 6 | +/// The scalar is split into shares distributed across Grants. |
| 7 | +/// At least threshold+1 shares are needed to reconstruct the scalar. |
| 8 | +#[derive(Clone, PartialEq, ::prost::Message)] |
| 9 | +pub struct Envelope { |
| 10 | + /// EnvelopeId is the unique identifier of the envelope. |
| 11 | + /// If empty when building, generated from hash of secret + context. |
| 12 | + #[prost(string, tag="1")] |
| 13 | + pub envelope_id: ::prost::alloc::string::String, |
| 14 | + /// ContextHash is the BLAKE3 hash of the context string. |
| 15 | + /// Used to verify the envelope matches the expected application context. |
| 16 | + #[prost(bytes="vec", tag="2")] |
| 17 | + pub context_hash: ::prost::alloc::vec::Vec<u8>, |
| 18 | + /// Threshold is the CIRCL threshold parameter. |
| 19 | + /// Recovery requires threshold+1 shares. |
| 20 | + /// If zero, any single share suffices (no secret splitting). |
| 21 | + #[prost(uint32, tag="3")] |
| 22 | + pub threshold: u32, |
| 23 | + /// Ciphertext is the encrypted payload. |
| 24 | + /// Encrypted with XChaCha20-Poly1305 using a key derived from the scalar. |
| 25 | + #[prost(bytes="vec", tag="4")] |
| 26 | + pub ciphertext: ::prost::alloc::vec::Vec<u8>, |
| 27 | + /// Grants is the list of encrypted share bundles. |
| 28 | + #[prost(message, repeated, tag="5")] |
| 29 | + pub grants: ::prost::alloc::vec::Vec<EnvelopeGrant>, |
| 30 | + /// Keypairs is the list of public keys used to encrypt grants. |
| 31 | + #[prost(message, repeated, tag="6")] |
| 32 | + pub keypairs: ::prost::alloc::vec::Vec<EnvelopeKeypair>, |
| 33 | + /// Contents is an optional plaintext description of what the envelope contains. |
| 34 | + /// Application-specific; not used in the unlock process. |
| 35 | + #[prost(bytes="vec", tag="7")] |
| 36 | + pub contents: ::prost::alloc::vec::Vec<u8>, |
| 37 | +} |
| 38 | +/// EnvelopeGrant is an encrypted bundle of shares. |
| 39 | +/// The grant ciphertext contains a marshaled EnvelopeGrantInner. |
| 40 | +/// Encrypted to one or more keypairs in the Envelope keypairs list. |
| 41 | +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] |
| 42 | +pub struct EnvelopeGrant { |
| 43 | + /// KeypairIndexes lists which keypairs can decrypt this grant. |
| 44 | + /// Each value is an index into the Envelope.keypairs list. |
| 45 | + #[prost(uint32, repeated, tag="1")] |
| 46 | + pub keypair_indexes: ::prost::alloc::vec::Vec<u32>, |
| 47 | + /// Ciphertexts contains the encrypted EnvelopeGrantInner. |
| 48 | + /// One ciphertext per keypair index, in the same order. |
| 49 | + /// Each encrypted with peer.EncryptToPubKey to the corresponding keypair. |
| 50 | + #[prost(bytes="vec", repeated, tag="2")] |
| 51 | + pub ciphertexts: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>, |
| 52 | +} |
| 53 | +/// EnvelopeGrantInner is the decrypted contents of a grant. |
| 54 | +#[derive(Clone, PartialEq, ::prost::Message)] |
| 55 | +pub struct EnvelopeGrantInner { |
| 56 | + /// Shares is the list of Shamir shares in this grant. |
| 57 | + #[prost(message, repeated, tag="1")] |
| 58 | + pub shares: ::prost::alloc::vec::Vec<EnvelopeShare>, |
| 59 | +} |
| 60 | +/// EnvelopeShare is a single Shamir share (Ristretto255 scalar pair). |
| 61 | +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] |
| 62 | +pub struct EnvelopeShare { |
| 63 | + /// Id is the share identifier (marshaled Ristretto255 scalar, 32 bytes). |
| 64 | + #[prost(bytes="vec", tag="1")] |
| 65 | + pub id: ::prost::alloc::vec::Vec<u8>, |
| 66 | + /// Value is the share value (marshaled Ristretto255 scalar, 32 bytes). |
| 67 | + #[prost(bytes="vec", tag="2")] |
| 68 | + pub value: ::prost::alloc::vec::Vec<u8>, |
| 69 | +} |
| 70 | +/// EnvelopeKeypair is a public key entry in the envelope. |
| 71 | +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] |
| 72 | +pub struct EnvelopeKeypair { |
| 73 | + /// PubKey is the marshaled public key in PEM format (via bifrost/keypem). |
| 74 | + #[prost(bytes="vec", tag="1")] |
| 75 | + pub pub_key: ::prost::alloc::vec::Vec<u8>, |
| 76 | + /// AuthMethodId is an optional identifier for the auth method. |
| 77 | + /// Application-specific hint for how to derive the private key. |
| 78 | + #[prost(string, tag="2")] |
| 79 | + pub auth_method_id: ::prost::alloc::string::String, |
| 80 | + /// AuthMethodParams is optional parameters for the auth method. |
| 81 | + #[prost(bytes="vec", tag="3")] |
| 82 | + pub auth_method_params: ::prost::alloc::vec::Vec<u8>, |
| 83 | +} |
| 84 | +/// EnvelopeConfig is the configuration for building an envelope. |
| 85 | +#[derive(Clone, PartialEq, ::prost::Message)] |
| 86 | +pub struct EnvelopeConfig { |
| 87 | + /// EnvelopeId is the unique identifier. If empty, auto-generated. |
| 88 | + #[prost(string, tag="1")] |
| 89 | + pub envelope_id: ::prost::alloc::string::String, |
| 90 | + /// Threshold is the CIRCL threshold parameter (need threshold+1 shares). |
| 91 | + /// If zero, any single share suffices. |
| 92 | + #[prost(uint32, tag="2")] |
| 93 | + pub threshold: u32, |
| 94 | + /// TotalShares is the total number of shares to create. |
| 95 | + /// If zero, defaults to sum of shares across all grant configs. |
| 96 | + #[prost(uint32, tag="3")] |
| 97 | + pub total_shares: u32, |
| 98 | + /// GrantConfigs defines how shares are distributed across grants. |
| 99 | + #[prost(message, repeated, tag="4")] |
| 100 | + pub grant_configs: ::prost::alloc::vec::Vec<EnvelopeGrantConfig>, |
| 101 | +} |
| 102 | +/// EnvelopeGrantConfig configures a single grant in the envelope. |
| 103 | +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] |
| 104 | +pub struct EnvelopeGrantConfig { |
| 105 | + /// ShareCount is the number of shares to include in this grant. |
| 106 | + /// If zero, defaults to 1. |
| 107 | + #[prost(uint32, tag="1")] |
| 108 | + pub share_count: u32, |
| 109 | + /// KeypairIndexes lists which keypairs can decrypt this grant. |
| 110 | + /// Indexes into the keypairs list provided to BuildEnvelope. |
| 111 | + #[prost(uint32, repeated, tag="2")] |
| 112 | + pub keypair_indexes: ::prost::alloc::vec::Vec<u32>, |
| 113 | +} |
| 114 | +/// EnvelopeUnlockResult is the result of attempting to unlock an envelope. |
| 115 | +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] |
| 116 | +pub struct EnvelopeUnlockResult { |
| 117 | + /// Success indicates whether the envelope was fully unlocked. |
| 118 | + #[prost(bool, tag="1")] |
| 119 | + pub success: bool, |
| 120 | + /// SharesAvailable is the number of shares recovered from grants. |
| 121 | + #[prost(uint32, tag="2")] |
| 122 | + pub shares_available: u32, |
| 123 | + /// SharesNeeded is the number of shares needed (threshold+1). |
| 124 | + #[prost(uint32, tag="3")] |
| 125 | + pub shares_needed: u32, |
| 126 | + /// UnlockedGrantIndexes lists which grants were successfully decrypted. |
| 127 | + #[prost(uint32, repeated, tag="4")] |
| 128 | + pub unlocked_grant_indexes: ::prost::alloc::vec::Vec<u32>, |
| 129 | +} |
| 130 | +// @@protoc_insertion_point(module) |
0 commit comments