String Extension

Can anyone advise on how to code an extension to String to implement the following protocol:

protocol GenericPasswordConvertible: CustomStringConvertible {

init<D>(rawRepresentation data: D) throws where D: ContiguousBytes

var rawRepresentation: Data { get }

}

Thank you!

Thanks for your reply. I have seen this before and have used it store store Curve25519 private keys.

I'm simply wanting to store a string value in KeyChain as a generic key type but am unable to work out how to do this.

String Extension
 
 
Q