We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 92c6014 commit 2252dcfCopy full SHA for 2252dcf
Sources/SRP/keys.swift
@@ -2,16 +2,22 @@ import BigNum
2
3
/// Wrapper for keys used by SRP
4
public struct SRPKey {
5
- public var bytes: [UInt8] { number.bytes }
6
public let number: BigNum
7
-
+ public var bytes: [UInt8] { number.bytes }
+ public var hex: String { number.hex }
8
+
9
public init(_ bytes: [UInt8]) {
10
self.number = BigNum(bytes: bytes)
11
}
12
13
public init(_ number: BigNum) {
14
self.number = number
15
16
17
+ public init?(hex: String) {
18
+ guard let number = BigNum(hex: hex) else { return nil }
19
+ self.number = number
20
+ }
21
22
23
extension SRPKey: Equatable { }
0 commit comments