Signal-iOS/SignalMessaging/groups/GroupsV2Utils.swift
Jordan Rose 4c8d7662a6 Add OWSIdentityManager.shouldSharePhoneNumber(with:transaction:)
When someone sends a message to your PNI, your responses (from your
ACI) must include a PNI signature, and the sealed sender certificate
you use during this period should include your phone number. This
confirms to the other user that your ACI is associated with your PNI.

This commit adds the state tracking that and ensures that both
TSOutgoingMessage and OWSUDManager check that state when building 1:1
messages and choosing certificates, respectively. Later commits will
set and clear this flag as needed.
2022-05-19 14:20:53 -07:00

22 lines
761 B
Swift

//
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
import Foundation
import SignalServiceKit
import LibSignalClient
public extension ProfileKeyVersion {
// GroupsV2 TODO: We might move this to the wrappers.
func asHexadecimalString() throws -> String {
let profileKeyVersionData = serialize().asData
// A peculiarity of ProfileKeyVersion is that its contents
// are an ASCII-encoded hexadecimal string of the profile key
// version, rather than the raw version bytes.
guard let profileKeyVersionString = String(data: profileKeyVersionData, encoding: .ascii) else {
throw OWSAssertionError("Invalid profile key version.")
}
return profileKeyVersionString
}
}