From e544c6fa9e15e7277da79e2464243e90b2706b8c Mon Sep 17 00:00:00 2001 From: StevenWdV Date: Mon, 24 Jan 2022 14:59:25 +0100 Subject: Cleanup Added variables to Makefiles to specify custom exports/ directory; Split exception classes in Java & C#; Added more comments; Renamed library and Go package; Removed real (pure) tests; Added generate_lib.ps1 to generate import .lib for Windows (Swift); Moved built Go libraries to exports/lib/; Switch to hopefully faster Swift GitHub Action. --- wrappers/swift/Sources/EduVpnCommon/EduVpnCommon.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'wrappers/swift/Sources') diff --git a/wrappers/swift/Sources/EduVpnCommon/EduVpnCommon.swift b/wrappers/swift/Sources/EduVpnCommon/EduVpnCommon.swift index 340e94a..b849626 100644 --- a/wrappers/swift/Sources/EduVpnCommon/EduVpnCommon.swift +++ b/wrappers/swift/Sources/EduVpnCommon/EduVpnCommon.swift @@ -9,7 +9,7 @@ private extension Data { // This closure method guarantees this try withUnsafeBytes { (pointer: UnsafeRawBufferPointer) -> ResultType in // Note: UnsafeRawBufferPointer.startIndex will always be 0, see docs - // Cast to UnsafeMutableRawPointer, assumes it will not be written to + // Cast to UnsafeMutableRawPointer, assumes it will not actually be written to try body(GoSlice(data: UnsafeMutableRawPointer(mutating: pointer.baseAddress), len: GoInt(pointer.count), cap: GoInt(pointer.count))) } @@ -33,9 +33,9 @@ public enum VerifyErr: Error, Equatable { /// Signature has a timestamp lower than the specified minimum signing time. case ErrTooOld /// Other unknown error - case Unknown(code: GoInt) + case Unknown(code: GoInt8) - static func fromCode(_ code: GoInt) -> VerifyErr { + static func fromCode(_ code: GoInt8) -> VerifyErr { precondition(code != 0) switch code { case 1: return ErrUnknownExpectedFileName @@ -54,7 +54,7 @@ public enum VerifyErr: Error, Equatable { /// - signature: .minisig signature file contents. /// - signedJson: Signed .json file contents. /// - expectedFileName: The file type to be verified, one of "server_list.json" or "organization_list.json". -/// - minSignTime: Minimum time for signature. Should be set to at least the time in a previously retrieved file. +/// - minSignTime: Minimum time for signature. Should be set to at least the time of the previous signature. /// - Throws: VerifyErr: If signature verification fails or `expectedFileName` is not one of the allowed values. public func Verify(signature: Data, signedJson: Data, expectedFileName: String, minSignTime: Date) throws { let result = signature.withSlice { signatureData in -- cgit v1.2.3