mirror of
https://github.com/signalapp/libsignal.git
synced 2026-04-25 17:25:18 +02:00
- Java: org.whispersystems:signal-client-java ->
org.signal:libsignal-client
- Java: org.whispersystems:signal-client-android ->
org.signal:libsignal-android
- Java: org.whispersystems:libsignal-server ->
org.signal:libsignal-server
- Swift: SignalClient -> LibSignalClient
- NPM: @signalapp/signal-client -> @signalapp/libsignal-client
- Repository: github.com/signalapp/libsignal-client ->
github.com/signalapp/libsignal
38 lines
991 B
Swift
38 lines
991 B
Swift
//
|
|
// Copyright 2020-2021 Signal Messenger, LLC.
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
import Foundation
|
|
import SignalFfi
|
|
|
|
public class ProfileKey: ByteArray {
|
|
|
|
public static let SIZE: Int = 32
|
|
|
|
public required init(contents: [UInt8]) throws {
|
|
try super.init(newContents: contents, expectedLength: ProfileKey.SIZE)
|
|
}
|
|
|
|
public func getCommitment(uuid: UUID) throws -> ProfileKeyCommitment {
|
|
return try withUnsafePointerToSerialized { contents in
|
|
try withUnsafePointer(to: uuid.uuid) { uuid in
|
|
try invokeFnReturningSerialized {
|
|
signal_profile_key_get_commitment($0, contents, uuid)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public func getProfileKeyVersion(uuid: UUID) throws -> ProfileKeyVersion {
|
|
return try withUnsafePointerToSerialized { contents in
|
|
try withUnsafePointer(to: uuid.uuid) { uuid in
|
|
try invokeFnReturningSerialized {
|
|
signal_profile_key_get_profile_key_version($0, contents, uuid)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|