Skip to content

Commit

Permalink
Update to libsignal 0.49.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jun 3, 2024
1 parent c5a7cca commit 3e65610
Show file tree
Hide file tree
Showing 9 changed files with 272 additions and 138 deletions.
10 changes: 4 additions & 6 deletions pkg/libsignalgo/authcredential.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,17 @@ func (ac *AuthCredentialWithPni) Slice() []byte {
}

func ReceiveAuthCredentialWithPni(
serverPublicParams ServerPublicParams,
serverPublicParams *ServerPublicParams,
aci uuid.UUID,
pni uuid.UUID,
redemptionTime uint64,
authCredResponse AuthCredentialWithPniResponse,
) (*AuthCredentialWithPni, error) {
var c_result C.SignalOwnedBuffer = C.SignalOwnedBuffer{}
c_serverPublicParams := (*[C.SignalSERVER_PUBLIC_PARAMS_LEN]C.uchar)(unsafe.Pointer(&serverPublicParams[0]))

signalFfiError := C.signal_server_public_params_receive_auth_credential_with_pni_as_service_id(
&c_result,
c_serverPublicParams,
serverPublicParams,
NewACIServiceID(aci).CFixedBytes(),
NewPNIServiceID(pni).CFixedBytes(),
C.uint64_t(redemptionTime),
Expand All @@ -78,19 +77,18 @@ func NewAuthCredentialWithPniResponse(b []byte) (*AuthCredentialWithPniResponse,
}

func CreateAuthCredentialWithPniPresentation(
serverPublicParams ServerPublicParams,
serverPublicParams *ServerPublicParams,
randomness Randomness,
groupSecretParams GroupSecretParams,
authCredWithPni AuthCredentialWithPni,
) (*AuthCredentialPresentation, error) {
var c_result C.SignalOwnedBuffer = C.SignalOwnedBuffer{}
c_serverPublicParams := (*[C.SignalSERVER_PUBLIC_PARAMS_LEN]C.uchar)(unsafe.Pointer(&serverPublicParams[0]))
c_randomness := (*[C.SignalRANDOMNESS_LEN]C.uchar)(unsafe.Pointer(&randomness[0]))
c_groupSecretParams := (*[C.SignalGROUP_SECRET_PARAMS_LEN]C.uchar)(unsafe.Pointer(&groupSecretParams[0]))

signalFfiError := C.signal_server_public_params_create_auth_credential_with_pni_presentation_deterministic(
&c_result,
c_serverPublicParams,
serverPublicParams,
c_randomness,
c_groupSecretParams,
BytesToBuffer(authCredWithPni[:]),
Expand Down
5 changes: 2 additions & 3 deletions pkg/libsignalgo/groupsecretparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,17 @@ func (gsp *GroupSecretParams) EncryptProfileKey(profileKey ProfileKey, u uuid.UU
return &result, nil
}

func (gsp *GroupSecretParams) CreateExpiringProfileKeyCredentialPresentation(spp ServerPublicParams, credential ExpiringProfileKeyCredential) (*ProfileKeyCredentialPresentation, error) {
func (gsp *GroupSecretParams) CreateExpiringProfileKeyCredentialPresentation(spp *ServerPublicParams, credential ExpiringProfileKeyCredential) (*ProfileKeyCredentialPresentation, error) {
var out C.SignalOwnedBuffer = C.SignalOwnedBuffer{}
randomness := GenerateRandomness()
signalFfiError := C.signal_server_public_params_create_expiring_profile_key_credential_presentation_deterministic(
&out,
(*[C.SignalSERVER_PUBLIC_PARAMS_LEN]C.uchar)(unsafe.Pointer(&spp)),
spp,
(*[C.SignalRANDOMNESS_LEN]C.uint8_t)(unsafe.Pointer(&randomness)),
(*[C.SignalGROUP_SECRET_PARAMS_LEN]C.uchar)(unsafe.Pointer(gsp)),
(*[C.SignalEXPIRING_PROFILE_KEY_CREDENTIAL_LEN]C.uchar)(unsafe.Pointer(&credential)),
)
runtime.KeepAlive(gsp)
runtime.KeepAlive(spp)
runtime.KeepAlive(credential)
runtime.KeepAlive(randomness)
if signalFfiError != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/libsignalgo/libsignal
Submodule libsignal updated 332 files
Loading

0 comments on commit 3e65610

Please sign in to comment.