Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assigning default signing algorithm from user selection #5

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Sources/RqesKit/RQESServiceAuthorized.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ public class RQESServiceAuthorized: RQESServiceAuthorizedProtocol, @unchecked Se
self.credentialInfo = credentialInfo
self.hashAlgorithmOID = hashAlgorithmOID ?? defaultHashAlgorithmOID
let certs = certificates?.map(\.base64String) ?? credentialInfo.cert.certificates

guard let algo = credentialInfo.key.algo.first else {
throw NSError(
domain: "Signing alogorithm error",
code: 0,
userInfo: [NSLocalizedDescriptionKey: "Failes to retrive list of supported signing algorithms"]
)
}
defaultSigningAlgorithmOID = SigningAlgorithmOID(rawValue: algo)

// STEP 9: calculate hashes
calculateHashResponse = try await RQESService.calculateHashes(rqes, documents: documents.map(\.fileURL), certificates: certs, accessToken: accessToken, hashAlgorithmOID: self.hashAlgorithmOID!)
// STEP 10: Set up an credential authorization request using OAuth2AuthorizeRequest with required parameters
Expand Down