blob: 2e885a7894de94dca38698ed70f105bf9954fb1a [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package conn
import (
"v.io/x/ref/lib/security/bcrypter"
"v.io/v23/security"
)
// Blessings is used to transport blessings between the two ends of a Conn.
// Since blessings can be large, we try not to send them more than once by
// associating them with an integer key (BKey). Thereafter we refer to them
// by their key.
type Blessings struct {
Blessings security.WireBlessings
BKey uint64
}
// EncryptedBlessings is used to transport encrypted blessings between the
// two ends of a Conn. The encryption is with respect to a set of blessing
// patterns that define the set of peers that are allowed to see the blessings.
// Since encrypted blessings can be large, we try not to send them more than
// once by associating them with an integer key (BKey). Thereafter we refer to
// them by their key.
type EncryptedBlessings struct {
Ciphertexts []bcrypter.WireCiphertext
BKey uint64
}
// Discharges is used to transport discharges between the two ends of a Conn.
// Since discharges can be large, we try not to send them more than once by
// associating them with an integer key (DKey). Thereafter we refer to them
// by their key.
// Discharges also contains the BKey of the blessings with which the discharges
// are associated with.
type Discharges struct {
Discharges []security.WireDischarge
DKey, BKey uint64
}
// EncryptedDischarges is used to transport encrypted discharges between the
// two ends of a Conn. The encryption is with respect to a set of blessing
// patterns that define the set of peers that are allowed to see the discharges.
// Since discharges can be large, we try not to send them more than once by
// associating them with an integer key (DKey). Thereafter we refer to them
// by their key.
// EncryptedDischarges also contains the BKey of the blessings with which the
// plaintext discharges are associated with.
type EncryptedDischarges struct {
Ciphertexts []bcrypter.WireCiphertext
DKey, BKey uint64
}
// BlessingsFlowMessage is used to send either a Blessings, Discharges, EncryptedBlessings
// or EncryptedDischarges object over the wire.
type BlessingsFlowMessage union {
Blessings Blessings
Discharges Discharges
EncryptedBlessings EncryptedBlessings
EncryptedDischarges EncryptedDischarges
}