-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #909 from WalletConnect/bugfix/cocoapods-sync
[Cocoapods] Sync API support
- Loading branch information
Showing
5 changed files
with
26 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Sources/WalletConnectKMS/Keychain/String+GenericPasswordConvertible.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Foundation | ||
|
||
extension String: GenericPasswordConvertible { | ||
|
||
public init<D>(rawRepresentation data: D) throws where D: ContiguousBytes { | ||
let buffer = data.withUnsafeBytes { Data($0) } | ||
guard let string = String(data: buffer, encoding: .utf8) else { | ||
throw Errors.notUTF8 | ||
} | ||
self = string | ||
} | ||
|
||
public var rawRepresentation: Data { | ||
return data(using: .utf8) ?? Data() | ||
} | ||
} | ||
|
||
fileprivate enum Errors: Error { | ||
case notUTF8 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters