libsignalgo.mau.fi/libsignal/util/keyhelper Index | Files

package keyhelper

import "go.mau.fi/libsignal/util/keyhelper"

Package keyhelper is based on: https://github.com/WhisperSystems/libsignal-protocol-java/blob/master/java/src/main/java/org/whispersystems/libsignal/util/KeyHelper.java

Index

Functions

func GenerateIdentityKeyPair

func GenerateIdentityKeyPair() (*identity.KeyPair, error)

GenerateIdentityKeyPair generates an identity keypair used for signing. Clients should only do this once at install time.

func GenerateLastResortKey

func GenerateLastResortKey(serializer record.PreKeySerializer) (*record.PreKey, error)

GenerateLastResortKey will generate the last resort PreKey. Clients should do this only once, at install time, and durably store it for the length of the install.

func GeneratePreKeys

func GeneratePreKeys(start int, count int, serializer record.PreKeySerializer) ([]*record.PreKey, error)

GeneratePreKeys generates a list of PreKeys. Client shsould do this at install time, and subsequently any time the list of PreKeys stored on the server runs low.

PreKeys IDs are shorts, so they will eventually be repeated. Clients should store PreKeys in a circular buffer, so that they are repeated as infrequently as possible.

func GenerateRegistrationID

func GenerateRegistrationID() uint32

GenerateRegistrationID generates a registration ID. Clients should only do this once, at install time.

func GenerateSenderKey

func GenerateSenderKey() []byte

func GenerateSenderKeyID

func GenerateSenderKeyID() uint32

func GenerateSenderSigningKey

func GenerateSenderSigningKey() (*ecc.ECKeyPair, error)

func GenerateSignedPreKey

func GenerateSignedPreKey(identityKeyPair *identity.KeyPair, signedPreKeyID uint32, serializer record.SignedPreKeySerializer) (*record.SignedPreKey, error)

GenerateSignedPreKey generates a signed PreKey.

Source Files

KeyHelper.go

Version
v0.1.2 (latest)
Published
Feb 12, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
1 week ago

Tools for package owners.