wordpress-mobile / WordPress-iOS-Shared

Shared components used in building the WordPress iOS apps and other library components
GNU General Public License v2.0
18 stars 22 forks source link

Adds Secret wrapper for sensitive information #230

Closed koke closed 4 years ago

koke commented 4 years ago

I initially added this to https://github.com/wordpress-mobile/WordPressKit-iOS/pull/202 but it seems useful beyond networking, so maybe it belongs here.

Secret wraps a value that contains sensitive information to prevent accidental logging:

let password = Secret("my secret password")
print(password)             // Prints "--redacted--"
print(password.secretValue) // Prints "my secret password"