Skip to content

Commit 5304027

Browse files
committed
test: add nonce generator
Signed-off-by: Allain Magyar <[email protected]>
1 parent d28b753 commit 5304027

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

E2E/e2eTests/Source/Abilities/OpenEnterpriseAPI.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ class OpenEnterpriseAPI: Ability {
424424
)
425425
]),
426426
name: "proof_req_1",
427-
nonce: "1103253414365527824079144",
427+
nonce: Utils.generateNonce(length: 25),
428428
version: "1.0"
429429
)
430430

@@ -447,7 +447,6 @@ class OpenEnterpriseAPI: Ability {
447447
default:
448448
throw Error.WrongResponse(response)
449449
}
450-
451450
}
452451

453452
func getPresentation(_ presentationId: String) async throws -> Components.Schemas.PresentationStatus {

E2E/e2eTests/Source/Utils.swift

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Foundation
2+
import XCTest
3+
4+
class Utils {
5+
static func generateNonce(length: Int) -> String {
6+
var result: String = ""
7+
8+
while (result.count < length) {
9+
var randomByte: UInt8 = 0
10+
_ = SecRandomCopyBytes(kSecRandomDefault, 1, &randomByte)
11+
if (randomByte >= 250) {
12+
continue
13+
}
14+
let randomDigit = randomByte % 10
15+
result += String(randomDigit)
16+
}
17+
return result
18+
}
19+
}
20+

0 commit comments

Comments
 (0)