Files
libsignal/swift/Sources/LibSignalClient/zkgroup/CallLinkAuthCredentialPresentation.swift
Jordan Rose 9e13263581 Switch to swift-format for formatting instead of swiftformat
swift-format is owned by the Swift project and is generally less
opinionated than swiftformat (but better at formatting to a limited
line length).
2025-06-25 11:24:57 -07:00

41 lines
1.2 KiB
Swift

//
// Copyright 2023 Signal Messenger, LLC.
// SPDX-License-Identifier: AGPL-3.0-only
//
import Foundation
import SignalFfi
public class CallLinkAuthCredentialPresentation: ByteArray, @unchecked Sendable {
public required init(contents: Data) throws {
try super.init(contents, checkValid: signal_call_link_auth_credential_presentation_check_valid_contents)
}
public func verify(
now: Date = Date(),
serverParams: GenericServerSecretParams,
callLinkParams: CallLinkPublicParams
) throws {
try withAllBorrowed(self, serverParams, callLinkParams) { contents, serverParams, callLinkParams in
try checkError(
signal_call_link_auth_credential_presentation_verify(
contents,
UInt64(now.timeIntervalSince1970),
serverParams,
callLinkParams
)
)
}
}
public var userId: UuidCiphertext {
return failOnError {
try withUnsafeBorrowedBuffer { contents in
try invokeFnReturningSerialized {
signal_call_link_auth_credential_presentation_get_user_id($0, contents)
}
}
}
}
}