summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/libsignal/keys/prekey
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-01-31 00:27:37 +0100
committerWim <wim@42.be>2022-03-20 14:57:48 +0100
commite3cafeaf9292f67459ff1d186f68283bfaedf2ae (patch)
treeb69c39620aa91dba695b3b935c6651c0fb37ce75 /vendor/go.mau.fi/libsignal/keys/prekey
parente7b193788a56ee7cdb02a87a9db0ad6724ef66d5 (diff)
downloadmatterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.tar.gz
matterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.tar.bz2
matterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.zip
Add dependencies/vendor (whatsapp)
Diffstat (limited to 'vendor/go.mau.fi/libsignal/keys/prekey')
-rw-r--r--vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go86
1 files changed, 86 insertions, 0 deletions
diff --git a/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go b/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go
new file mode 100644
index 00000000..04471673
--- /dev/null
+++ b/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go
@@ -0,0 +1,86 @@
+// Package prekey provides prekey bundle structures for calculating
+// a new Signal session with a user asyncronously.
+package prekey
+
+import (
+ "go.mau.fi/libsignal/ecc"
+ "go.mau.fi/libsignal/keys/identity"
+ "go.mau.fi/libsignal/util/optional"
+)
+
+// NewBundle returns a Bundle structure that contains a remote PreKey
+// and collection of associated items.
+func NewBundle(registrationID, deviceID uint32, preKeyID *optional.Uint32, signedPreKeyID uint32,
+ preKeyPublic, signedPreKeyPublic ecc.ECPublicKeyable, signedPreKeySig [64]byte,
+ identityKey *identity.Key) *Bundle {
+
+ bundle := Bundle{
+ registrationID: registrationID,
+ deviceID: deviceID,
+ preKeyID: preKeyID,
+ preKeyPublic: preKeyPublic,
+ signedPreKeyID: signedPreKeyID,
+ signedPreKeyPublic: signedPreKeyPublic,
+ signedPreKeySignature: signedPreKeySig,
+ identityKey: identityKey,
+ }
+
+ return &bundle
+}
+
+// Bundle is a structure that contains a remote PreKey and collection
+// of associated items.
+type Bundle struct {
+ registrationID uint32
+ deviceID uint32
+ preKeyID *optional.Uint32
+ preKeyPublic ecc.ECPublicKeyable
+ signedPreKeyID uint32
+ signedPreKeyPublic ecc.ECPublicKeyable
+ signedPreKeySignature [64]byte
+ identityKey *identity.Key
+}
+
+// DeviceID returns the device ID this PreKey belongs to.
+func (b *Bundle) DeviceID() uint32 {
+ return b.deviceID
+}
+
+// PreKeyID returns the unique key ID for this PreKey.
+func (b *Bundle) PreKeyID() *optional.Uint32 {
+ return b.preKeyID
+}
+
+// PreKey returns the public key for this PreKey.
+func (b *Bundle) PreKey() ecc.ECPublicKeyable {
+ return b.preKeyPublic
+}
+
+// SignedPreKeyID returns the unique key ID for this
+// signed PreKey.
+func (b *Bundle) SignedPreKeyID() uint32 {
+ return b.signedPreKeyID
+}
+
+// SignedPreKey returns the signed PreKey for this
+// PreKeyBundle.
+func (b *Bundle) SignedPreKey() ecc.ECPublicKeyable {
+ return b.signedPreKeyPublic
+}
+
+// SignedPreKeySignature returns the signature over the
+// signed PreKey.
+func (b *Bundle) SignedPreKeySignature() [64]byte {
+ return b.signedPreKeySignature
+}
+
+// IdentityKey returns the Identity Key of this PreKey's owner.
+func (b *Bundle) IdentityKey() *identity.Key {
+ return b.identityKey
+}
+
+// RegistrationID returns the registration ID associated with
+// this PreKey.
+func (b *Bundle) RegistrationID() uint32 {
+ return b.registrationID
+}