From 72998387c3bb21e7a974db752024ecc94548b187 Mon Sep 17 00:00:00 2001 From: Fabian Boemer Date: Tue, 17 Sep 2024 09:52:22 -0700 Subject: [PATCH] Make Plaintext.poly internal (#109) --- Sources/HomomorphicEncryption/Encoding.swift | 6 ++---- Sources/HomomorphicEncryption/HeScheme.swift | 6 ++---- Sources/HomomorphicEncryption/Plaintext.swift | 2 +- Sources/HomomorphicEncryption/SerializedCiphertext.swift | 2 +- Sources/PrivateInformationRetrieval/IndexPirProtocol.swift | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Sources/HomomorphicEncryption/Encoding.swift b/Sources/HomomorphicEncryption/Encoding.swift index 1f079061..85d59cc6 100644 --- a/Sources/HomomorphicEncryption/Encoding.swift +++ b/Sources/HomomorphicEncryption/Encoding.swift @@ -65,8 +65,7 @@ extension Context { /// - values: Values to encode. /// - format: Encoding format. /// - moduliCount: Optional number of moduli. If not set, encoding will use the top-level ciphertext context with - /// all the - /// moduli. + /// all the moduli. /// - Returns: The plaintext encoding `values`. /// - Throws: Error upon failure to encode. @inlinable @@ -83,8 +82,7 @@ extension Context { /// - signedValues: Signed values to encode. /// - format: Encoding format. /// - moduliCount: Optional number of moduli. If not set, encoding will use the top-level ciphertext context with - /// all the - /// moduli. + /// all the moduli. /// - Returns: The plaintext encoding `signedValues`. /// - Throws: Error upon failure to encode. @inlinable diff --git a/Sources/HomomorphicEncryption/HeScheme.swift b/Sources/HomomorphicEncryption/HeScheme.swift index 37db97aa..5a7a97e2 100644 --- a/Sources/HomomorphicEncryption/HeScheme.swift +++ b/Sources/HomomorphicEncryption/HeScheme.swift @@ -196,8 +196,7 @@ public protocol HeScheme { /// - values: Values to encode. /// - format: Encoding format. /// - moduliCount: Optional number of moduli. If not set, encoding will use the top-level ciphertext context with - /// all the - /// moduli. + /// all the moduli. /// - Returns: A plaintext encoding `values`. /// - Throws: Error upon failure to encode. /// - seealso: ``Context/encode(values:format:moduliCount:)`` for an alternative API. @@ -213,8 +212,7 @@ public protocol HeScheme { /// - signedValues: Signed values to encode. /// - format: Encoding format. /// - moduliCount: Optional number of moduli. If not set, encoding will use the top-level ciphertext context with - /// all the - /// moduli. + /// all the moduli. /// - Returns: A plaintext encoding `signedValues`. /// - Throws: Error upon failure to encode. /// - seealso: ``Context/encode(signedValues:format:moduliCount:)`` for an alternative API. diff --git a/Sources/HomomorphicEncryption/Plaintext.swift b/Sources/HomomorphicEncryption/Plaintext.swift index c4c6d1ff..b99616e7 100644 --- a/Sources/HomomorphicEncryption/Plaintext.swift +++ b/Sources/HomomorphicEncryption/Plaintext.swift @@ -18,7 +18,7 @@ public struct Plaintext: Equatable, Sendab /// Context for HE computation. public let context: Context - @usableFromInline package var poly: PolyRq + @usableFromInline var poly: PolyRq @inlinable package init(context: Context, poly: PolyRq) { diff --git a/Sources/HomomorphicEncryption/SerializedCiphertext.swift b/Sources/HomomorphicEncryption/SerializedCiphertext.swift index 8a3b98ac..0674e3b8 100644 --- a/Sources/HomomorphicEncryption/SerializedCiphertext.swift +++ b/Sources/HomomorphicEncryption/SerializedCiphertext.swift @@ -38,7 +38,7 @@ extension Ciphertext { /// - serialized: Serialized ciphertext. /// - context: Context to associate with the ciphertext. /// - moduliCount: Number of moduli in the serialized ciphertext. If not set, deserialization will use the - /// top-level ciphertext with all the moduli. + /// top-level ciphertext context with all the moduli. /// - Throws: Error upon failure to deserialize the ciphertext. @inlinable public init( diff --git a/Sources/PrivateInformationRetrieval/IndexPirProtocol.swift b/Sources/PrivateInformationRetrieval/IndexPirProtocol.swift index 9d4601b1..02bb7300 100644 --- a/Sources/PrivateInformationRetrieval/IndexPirProtocol.swift +++ b/Sources/PrivateInformationRetrieval/IndexPirProtocol.swift @@ -245,7 +245,7 @@ public struct ProcessedDatabase: Equatable, Sendable { for plaintext in plaintexts { if let plaintext { buffer.append(Self.serializedPlaintextTag) - buffer += plaintext.poly.serialize() + buffer += plaintext.serialize().poly } else { buffer.append(Self.serializedZeroPlaintextTag) }