|
| 1 | +//// |
| 2 | +//// SecKeyConvertible.swift |
| 3 | +//// SuiKit |
| 4 | +//// |
| 5 | +//// Copyright (c) 2024-2025 OpenDive |
| 6 | +//// |
| 7 | +//// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | +//// of this software and associated documentation files (the "Software"), to deal |
| 9 | +//// in the Software without restriction, including without limitation the rights |
| 10 | +//// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | +//// copies of the Software, and to permit persons to whom the Software is |
| 12 | +//// furnished to do so, subject to the following conditions: |
| 13 | +//// |
| 14 | +//// The above copyright notice and this permission notice shall be included in |
| 15 | +//// all copies or substantial portions of the Software. |
| 16 | +//// |
| 17 | +//// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | +//// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +//// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +//// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +//// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | +//// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 23 | +//// THE SOFTWARE. |
| 24 | +//// |
1 | 25 | // |
2 | | -// SecKeyConvertible.swift |
3 | | -// SuiKit |
| 26 | +//import Foundation |
| 27 | +//import CryptoKit |
4 | 28 | // |
5 | | -// Copyright (c) 2024-2025 OpenDive |
| 29 | +//public protocol GenericPasswordConvertible: CustomStringConvertible { |
| 30 | +// /// Creates a key from a raw representation. |
| 31 | +// init(rawRepresentation data: Data) throws |
6 | 32 | // |
7 | | -// Permission is hereby granted, free of charge, to any person obtaining a copy |
8 | | -// of this software and associated documentation files (the "Software"), to deal |
9 | | -// in the Software without restriction, including without limitation the rights |
10 | | -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
11 | | -// copies of the Software, and to permit persons to whom the Software is |
12 | | -// furnished to do so, subject to the following conditions: |
| 33 | +// /// A raw representation of the key. |
| 34 | +// var rawRepresentation: Data { get } |
| 35 | +//} |
13 | 36 | // |
14 | | -// The above copyright notice and this permission notice shall be included in |
15 | | -// all copies or substantial portions of the Software. |
| 37 | +//#if swift(>=5.9) |
| 38 | +//extension SecureEnclave.P256.Signing.PrivateKey: @retroactive CustomStringConvertible {} |
| 39 | +//extension SecureEnclave.P256.Signing.PrivateKey: GenericPasswordConvertible { |
| 40 | +// public var description: String { |
| 41 | +// "\(self.hashValue)" |
| 42 | +// } |
16 | 43 | // |
17 | | -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18 | | -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19 | | -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
20 | | -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
21 | | -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
22 | | -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
23 | | -// THE SOFTWARE. |
| 44 | +// public init(rawRepresentation data: Data) throws { |
| 45 | +// try self.init(dataRepresentation: data) |
| 46 | +// } |
24 | 47 | // |
25 | | - |
26 | | -import Foundation |
27 | | -import CryptoKit |
28 | | - |
29 | | -public protocol GenericPasswordConvertible: CustomStringConvertible { |
30 | | - /// Creates a key from a raw representation. |
31 | | - init(rawRepresentation data: Data) throws |
32 | | - |
33 | | - /// A raw representation of the key. |
34 | | - var rawRepresentation: Data { get } |
35 | | -} |
36 | | - |
37 | | -#if swift(>=5.9) |
38 | | -extension SecureEnclave.P256.Signing.PrivateKey: @retroactive CustomStringConvertible {} |
39 | | -extension SecureEnclave.P256.Signing.PrivateKey: GenericPasswordConvertible { |
40 | | - public var description: String { |
41 | | - "\(self.hashValue)" |
42 | | - } |
43 | | - |
44 | | - public init(rawRepresentation data: Data) throws { |
45 | | - try self.init(dataRepresentation: data) |
46 | | - } |
47 | | - |
48 | | - public var rawRepresentation: Data { |
49 | | - return dataRepresentation |
50 | | - } |
51 | | -} |
52 | | -#else |
53 | | -extension SecureEnclave.P256.Signing.PrivateKey: CustomStringConvertible {} |
54 | | -extension SecureEnclave.P256.Signing.PrivateKey: GenericPasswordConvertible { |
55 | | - public var description: String { |
56 | | - "\(self.hashValue)" |
57 | | - } |
58 | | - |
59 | | - public init(rawRepresentation data: Data) throws { |
60 | | - try self.init(dataRepresentation: data) |
61 | | - } |
62 | | - |
63 | | - public var rawRepresentation: Data { |
64 | | - return dataRepresentation |
65 | | - } |
66 | | -} |
67 | | -#endif |
| 48 | +// public var rawRepresentation: Data { |
| 49 | +// return dataRepresentation |
| 50 | +// } |
| 51 | +//} |
| 52 | +//#else |
| 53 | +//extension SecureEnclave.P256.Signing.PrivateKey: CustomStringConvertible {} |
| 54 | +//extension SecureEnclave.P256.Signing.PrivateKey: GenericPasswordConvertible { |
| 55 | +// public var description: String { |
| 56 | +// "\(self.hashValue)" |
| 57 | +// } |
| 58 | +// |
| 59 | +// public init(rawRepresentation data: Data) throws { |
| 60 | +// try self.init(dataRepresentation: data) |
| 61 | +// } |
| 62 | +// |
| 63 | +// public var rawRepresentation: Data { |
| 64 | +// return dataRepresentation |
| 65 | +// } |
| 66 | +//} |
| 67 | +//#endif |
0 commit comments