@@ -19,6 +19,7 @@ struct SecureVector{CryptoBackendT <: AbstractCryptoBackend, DataT}
1919end
2020
2121Base. length (v:: SecureVector ) = v. length
22+
2223function Base. show (io:: IO , v:: SecureVector )
2324 print (" SecureVector{" , backend_name (v), " }(data=<encrypted>, length=$(v. length) )" )
2425end
@@ -34,11 +35,10 @@ struct PlainVector{CryptoBackendT <: AbstractCryptoBackend, DataT}
3435end
3536
3637Base. length (v:: PlainVector ) = v. length
37- function Base. show (io:: IO , v:: PlainVector{CryptoBackendT} ) where CryptoBackendT
38- print (" PlainVector{" , backend_name (v), " }(data=<plain>, length=$(v. length) )" )
39- end
4038
41- Base. print (io:: IO , plain_vector:: PlainVector ) = print (io, plain_vector. data)
39+ function Base. show (io:: IO , v:: PlainVector )
40+ print (io, " PlainVector{" , backend_name (v), " }(data=<encoded>, length=$(v. length) )" )
41+ end
4242
4343struct PrivateKey{CryptoBackendT <: AbstractCryptoBackend , KeyT}
4444 private_key:: KeyT
@@ -49,7 +49,7 @@ struct PrivateKey{CryptoBackendT <: AbstractCryptoBackend, KeyT}
4949 end
5050end
5151
52- function Base. show (io:: IO , key:: PrivateKey{CryptoBackendT} ) where CryptoBackendT
52+ function Base. show (io:: IO , key:: PrivateKey )
5353 print (" PrivateKey{" , backend_name (key), " }()" )
5454end
5555
@@ -62,7 +62,7 @@ struct PublicKey{CryptoBackendT <: AbstractCryptoBackend, KeyT}
6262 end
6363end
6464
65- function Base. show (io:: IO , key:: PublicKey{CryptoBackendT} ) where CryptoBackendT
65+ function Base. show (io:: IO , key:: PublicKey )
6666 print (" PublicKey{" , backend_name (key), " }()" )
6767end
6868
7272# Note: prefixed by `__` since it is really, really dirty black magic internals we use here!
7373__parameterless_type (T) = Base. typename (T). wrapper
7474
75- # Convenience method for getting the human-readable backend name
75+ # Convenience method for getting human-readable names
7676backend_name (x:: Union {SecureContext{T}, SecureVector{T}, PlainVector{T}, PrivateKey{T},
7777 PublicKey{T}}) where T = string (__parameterless_type (T))
0 commit comments