diff options
| author | Mistivia <i@mistivia.com> | 2025-11-02 15:27:18 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-11-02 15:27:18 +0800 |
| commit | e9c24f4af7ed56760f6db7941827d09f6db9020b (patch) | |
| tree | 62128c43b883ce5e3148113350978755779bb5de /teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go | |
| parent | 58d5e7cfda4781d8a57ec52aefd02983835c301a (diff) | |
add matterbridge
Diffstat (limited to 'teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go')
| -rw-r--r-- | teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go new file mode 100644 index 0000000..0447167 --- /dev/null +++ b/teleirc/matterbridge/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 +} |
