Skip to content

Commit

Permalink
Update protos
Browse files Browse the repository at this point in the history
  • Loading branch information
fboemer committed Aug 29, 2024
1 parent 9d3d208 commit 2c79cd4
Show file tree
Hide file tree
Showing 11 changed files with 621 additions and 138 deletions.
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ let package = Package(
.product(name: "SwiftProtobuf", package: "swift-protobuf")],
exclude: ["generated/README.md", "protobuf_module_mappings.txtpb"],
swiftSettings: librarySettings),

.target(
name: "TestUtilities",
dependencies: [
Expand Down
12 changes: 6 additions & 6 deletions Sources/PrivateInformationRetrievalProtobuf/ConversionApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import HomomorphicEncryption
import HomomorphicEncryptionProtobuf
import PrivateInformationRetrieval

extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRResponse {
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRResponse {
/// Converts the protobuf object to a native type.
/// - Parameter context: Context to associate with the native type.
/// - Returns: The converted native type.
Expand All @@ -36,16 +36,16 @@ extension Response {
/// Converts the native object into a protobuf object.
/// - Returns: The converted protobuf object.
/// - Throws: Error upon unsupported object.
public func proto() throws -> Apple_SwiftHomomorphicEncryption_Api_V1_PIRResponse {
try Apple_SwiftHomomorphicEncryption_Api_V1_PIRResponse.with { pirResponse in
public func proto() throws -> Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRResponse {
try Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRResponse.with { pirResponse in
pirResponse.replies = try ciphertexts.map { reply in
try reply.map { try $0.serialize(forDecryption: true) }.proto()
}
}
}
}

extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig {
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRShardConfig {
/// Converts the protobuf object to a native type.
/// - Parameters:
/// - batchSize: Number of queries in a batch.
Expand All @@ -65,8 +65,8 @@ extension IndexPirParameter {
/// Converts the native object into a protobuf object.
/// - Parameter shardID: Optional identifier to associate with the shard
/// - Returns: The converted protobuf object.
public func proto(shardID: String = "") -> Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig {
Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig.with { shardConfig in
public func proto(shardID: String = "") -> Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRShardConfig {
Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRShardConfig.with { shardConfig in
shardConfig.numEntries = UInt64(entryCount)
shardConfig.entrySize = UInt64(entrySizeInBytes)
shardConfig.dimensions = dimensions.map(UInt64.init)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: apple/swift_homomorphic_encryption/api/v1/api_pir.proto
// Source: apple/swift_homomorphic_encryption/api/pir/v1/pir.proto
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
Expand Down Expand Up @@ -37,7 +37,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
}

/// Configuration for one shard of the PIR database.
public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig: Sendable {
public struct Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRShardConfig: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
Expand Down Expand Up @@ -91,7 +91,7 @@ public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig: Sendable {
}

/// Configuration for one PIR usecase.
public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRConfig: @unchecked Sendable {
public struct Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRConfig: @unchecked Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
Expand All @@ -107,7 +107,7 @@ public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRConfig: @unchecked Send
public mutating func clearEncryptionParameters() {self._encryptionParameters = nil}

/// Configuration for each shard.
public var shardConfigs: [Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig] = []
public var shardConfigs: [Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRShardConfig] = []

/// Parameters specific to KeywordPIR.
public var keywordPirParams: Apple_SwiftHomomorphicEncryption_Pir_V1_KeywordPirParameters {
Expand Down Expand Up @@ -137,7 +137,7 @@ public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRConfig: @unchecked Send
}

/// PIR Request.
public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRRequest: @unchecked Sendable {
public struct Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRRequest: @unchecked Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
Expand All @@ -156,8 +156,8 @@ public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRRequest: @unchecked Sen
public mutating func clearQuery() {self._query = nil}

/// Evaluation key metadata.
public var evaluationKeyMetadata: Apple_SwiftHomomorphicEncryption_Api_V1_EvaluationKeyMetadata {
get {return _evaluationKeyMetadata ?? Apple_SwiftHomomorphicEncryption_Api_V1_EvaluationKeyMetadata()}
public var evaluationKeyMetadata: Apple_SwiftHomomorphicEncryption_Api_Shared_V1_EvaluationKeyMetadata {
get {return _evaluationKeyMetadata ?? Apple_SwiftHomomorphicEncryption_Api_Shared_V1_EvaluationKeyMetadata()}
set {_evaluationKeyMetadata = newValue}
}
/// Returns true if `evaluationKeyMetadata` has been explicitly set.
Expand All @@ -179,8 +179,8 @@ public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRRequest: @unchecked Sen
public mutating func clearShardID() {self._shardID = nil}

/// If set, evaluation key to query with. Will override evaluation key stored server-side.
public var evaluationKey: Apple_SwiftHomomorphicEncryption_Api_V1_EvaluationKey {
get {return _evaluationKey ?? Apple_SwiftHomomorphicEncryption_Api_V1_EvaluationKey()}
public var evaluationKey: Apple_SwiftHomomorphicEncryption_Api_Shared_V1_EvaluationKey {
get {return _evaluationKey ?? Apple_SwiftHomomorphicEncryption_Api_Shared_V1_EvaluationKey()}
set {_evaluationKey = newValue}
}
/// Returns true if `evaluationKey` has been explicitly set.
Expand All @@ -193,13 +193,13 @@ public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRRequest: @unchecked Sen
public init() {}

fileprivate var _query: Apple_SwiftHomomorphicEncryption_Pir_V1_EncryptedIndices? = nil
fileprivate var _evaluationKeyMetadata: Apple_SwiftHomomorphicEncryption_Api_V1_EvaluationKeyMetadata? = nil
fileprivate var _evaluationKeyMetadata: Apple_SwiftHomomorphicEncryption_Api_Shared_V1_EvaluationKeyMetadata? = nil
fileprivate var _shardID: String? = nil
fileprivate var _evaluationKey: Apple_SwiftHomomorphicEncryption_Api_V1_EvaluationKey? = nil
fileprivate var _evaluationKey: Apple_SwiftHomomorphicEncryption_Api_Shared_V1_EvaluationKey? = nil
}

/// PIR Response.
public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRResponse: Sendable {
public struct Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRResponse: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
Expand All @@ -214,9 +214,9 @@ public struct Apple_SwiftHomomorphicEncryption_Api_V1_PIRResponse: Sendable {

// MARK: - Code below here is support for the SwiftProtobuf runtime.

fileprivate let _protobuf_package = "apple.swift_homomorphic_encryption.api.v1"
fileprivate let _protobuf_package = "apple.swift_homomorphic_encryption.api.pir.v1"

extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRShardConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".PIRShardConfig"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "num_entries"),
Expand Down Expand Up @@ -270,7 +270,7 @@ extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig: SwiftProtobuf.
try unknownFields.traverse(visitor: &visitor)
}

public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig, rhs: Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig) -> Bool {
public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRShardConfig, rhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRShardConfig) -> Bool {
if lhs.numEntries != rhs.numEntries {return false}
if lhs.entrySize != rhs.entrySize {return false}
if lhs.dimensions != rhs.dimensions {return false}
Expand All @@ -282,7 +282,7 @@ extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRShardConfig: SwiftProtobuf.
}
}

extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".PIRConfig"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "encryption_parameters"),
Expand Down Expand Up @@ -336,7 +336,7 @@ extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRConfig: SwiftProtobuf.Messa
try unknownFields.traverse(visitor: &visitor)
}

public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_V1_PIRConfig, rhs: Apple_SwiftHomomorphicEncryption_Api_V1_PIRConfig) -> Bool {
public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRConfig, rhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRConfig) -> Bool {
if lhs._encryptionParameters != rhs._encryptionParameters {return false}
if lhs.shardConfigs != rhs.shardConfigs {return false}
if lhs._keywordPirParams != rhs._keywordPirParams {return false}
Expand All @@ -348,7 +348,7 @@ extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRConfig: SwiftProtobuf.Messa
}
}

extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".PIRRequest"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "shard_index"),
Expand Down Expand Up @@ -402,7 +402,7 @@ extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRRequest: SwiftProtobuf.Mess
try unknownFields.traverse(visitor: &visitor)
}

public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_V1_PIRRequest, rhs: Apple_SwiftHomomorphicEncryption_Api_V1_PIRRequest) -> Bool {
public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRRequest, rhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRRequest) -> Bool {
if lhs.shardIndex != rhs.shardIndex {return false}
if lhs._query != rhs._query {return false}
if lhs._evaluationKeyMetadata != rhs._evaluationKeyMetadata {return false}
Expand All @@ -414,7 +414,7 @@ extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRRequest: SwiftProtobuf.Mess
}
}

extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".PIRResponse"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "replies"),
Expand All @@ -439,7 +439,7 @@ extension Apple_SwiftHomomorphicEncryption_Api_V1_PIRResponse: SwiftProtobuf.Mes
try unknownFields.traverse(visitor: &visitor)
}

public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_V1_PIRResponse, rhs: Apple_SwiftHomomorphicEncryption_Api_V1_PIRResponse) -> Bool {
public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRResponse, rhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_PIRResponse) -> Bool {
if lhs.replies != rhs.replies {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
Expand Down
Loading

0 comments on commit 2c79cd4

Please sign in to comment.