Skip to content

Commit

Permalink
improving the randomness for nonce.
Browse files Browse the repository at this point in the history
  • Loading branch information
RockfordWei committed Jun 27, 2022
1 parent a03a65f commit 8d5d8e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/PerfectAuth/Nonce.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import PerfectCrypto
/// For example, any post method should include a valid nonce before action, so if not, the server can just simply ignore it.
public struct Nonce {
fileprivate struct Payload: Codable {
let host: Int
let host: UUID
let timestamp: TimeInterval
init(host h: Int, timestamp t: TimeInterval = Date().timeIntervalSince1970) {
init(host h: UUID, timestamp t: TimeInterval = Date().timeIntervalSince1970) {
host = h; timestamp = t
}
}

fileprivate static let algo = JWT.Alg.hs256
fileprivate static let host = Int.random
fileprivate static let host = UUID()

/// allocate a nonce string
public static func allocate(authorityPrivateKey: PEMKey) throws -> String {
Expand Down

0 comments on commit 8d5d8e8

Please sign in to comment.