mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
proto: update manually to 2.3000.1020608496
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": [2, 3000, 1019707846]
|
||||
"version": [2, 3000, 1020608496]
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import NodeCache from '@cacheable/node-cache'
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { randomBytes } from 'crypto'
|
||||
import Long = require('long');
|
||||
import { proto } from '../../WAProto'
|
||||
import { DEFAULT_CACHE_TTLS, KEY_BUNDLE_TYPE, MIN_PREKEY_COUNT } from '../Defaults'
|
||||
import { MessageReceiptType, MessageRelayOptions, MessageUserReceipt, SocketConfig, WACallEvent, WAMessageKey, WAMessageStatus, WAMessageStubType, WAPatchName } from '../Types'
|
||||
@@ -846,7 +847,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
throw new Boom('Not authenticated')
|
||||
}
|
||||
|
||||
const pdoMessage = {
|
||||
const pdoMessage: proto.Message.IPeerDataOperationRequestMessage = {
|
||||
historySyncOnDemandRequest: {
|
||||
chatJid: oldestMsgKey.remoteJid,
|
||||
oldestMsgFromMe: oldestMsgKey.fromMe,
|
||||
|
||||
@@ -669,15 +669,15 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
try {
|
||||
const media = await decryptMediaRetryData(result.media!, mediaKey, result.key.id!)
|
||||
if(media.result !== proto.MediaRetryNotification.ResultType.SUCCESS) {
|
||||
const resultStr = proto.MediaRetryNotification.ResultType[media.result]
|
||||
const resultStr = proto.MediaRetryNotification.ResultType[media.result!]
|
||||
throw new Boom(
|
||||
`Media re-upload failed by device (${resultStr})`,
|
||||
{ data: media, statusCode: getStatusCodeForMediaRetry(media.result) || 404 }
|
||||
{ data: media, statusCode: getStatusCodeForMediaRetry(media.result!) || 404 }
|
||||
)
|
||||
}
|
||||
|
||||
content.directPath = media.directPath
|
||||
content.url = getUrlFromDirectPath(content.directPath)
|
||||
content.url = getUrlFromDirectPath(content.directPath!)
|
||||
|
||||
logger.debug({ directPath: media.directPath, key: result.key }, 'media update successful')
|
||||
} catch(err) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import NodeCache from '@cacheable/node-cache'
|
||||
import { randomBytes } from 'crypto'
|
||||
import type { Logger } from 'pino'
|
||||
import { DEFAULT_CACHE_TTLS } from '../Defaults'
|
||||
import type { AuthenticationCreds, CacheStore, SignalDataSet, SignalDataTypeMap, SignalKeyStore, SignalKeyStoreWithTransaction, TransactionCapabilityOptions } from '../Types'
|
||||
import { Curve, signedKeyPair } from './crypto'
|
||||
|
||||
@@ -217,13 +217,13 @@ export const decodeSyncdMutations = async(
|
||||
const syncAction = proto.SyncActionData.decode(result)
|
||||
|
||||
if(validateMacs) {
|
||||
const hmac = hmacSign(syncAction.index, key.indexKey)
|
||||
const hmac = hmacSign(syncAction.index!, key.indexKey)
|
||||
if(Buffer.compare(hmac, record.index!.blob!) !== 0) {
|
||||
throw new Boom('HMAC index verification failed')
|
||||
}
|
||||
}
|
||||
|
||||
const indexStr = Buffer.from(syncAction.index).toString()
|
||||
const indexStr = Buffer.from(syncAction.index!).toString()
|
||||
onMutation({ syncAction, index: JSON.parse(indexStr) })
|
||||
|
||||
ltGenerator.mix({
|
||||
|
||||
@@ -149,7 +149,7 @@ export const decryptMessageNode = (
|
||||
for(const { tag, attrs, content } of stanza.content) {
|
||||
if(tag === 'verified_name' && content instanceof Uint8Array) {
|
||||
const cert = proto.VerifiedNameCertificate.decode(content)
|
||||
const details = proto.VerifiedNameCertificate.Details.decode(cert.details)
|
||||
const details = proto.VerifiedNameCertificate.Details.decode(cert.details!)
|
||||
fullMessage.verifiedBizName = details.verifiedName
|
||||
}
|
||||
|
||||
|
||||
@@ -332,7 +332,6 @@ export const generateWAMessageContent = async(
|
||||
}
|
||||
|
||||
if(urlInfo) {
|
||||
extContent.canonicalUrl = urlInfo['canonical-url']
|
||||
extContent.matchedText = urlInfo['matched-text']
|
||||
extContent.jpegThumbnail = urlInfo.jpegThumbnail
|
||||
extContent.description = urlInfo.description
|
||||
|
||||
@@ -131,27 +131,27 @@ export const configureSuccessfulPairing = (
|
||||
|
||||
const { details, hmac } = proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content as Buffer)
|
||||
// check HMAC matches
|
||||
const advSign = hmacSign(details, Buffer.from(advSecretKey, 'base64'))
|
||||
if(Buffer.compare(hmac, advSign) !== 0) {
|
||||
const advSign = hmacSign(details!, Buffer.from(advSecretKey, 'base64'))
|
||||
if(Buffer.compare(hmac!, advSign) !== 0) {
|
||||
throw new Boom('Invalid account signature')
|
||||
}
|
||||
|
||||
const account = proto.ADVSignedDeviceIdentity.decode(details)
|
||||
const account = proto.ADVSignedDeviceIdentity.decode(details!)
|
||||
const { accountSignatureKey, accountSignature, details: deviceDetails } = account
|
||||
// verify the device signature matches
|
||||
const accountMsg = Buffer.concat([ Buffer.from([6, 0]), deviceDetails, signedIdentityKey.public ])
|
||||
if(!Curve.verify(accountSignatureKey, accountMsg, accountSignature)) {
|
||||
const accountMsg = Buffer.concat([ Buffer.from([6, 0]), deviceDetails!, signedIdentityKey.public ])
|
||||
if(!Curve.verify(accountSignatureKey!, accountMsg, accountSignature!)) {
|
||||
throw new Boom('Failed to verify account signature')
|
||||
}
|
||||
|
||||
// sign the details with our identity key
|
||||
const deviceMsg = Buffer.concat([ Buffer.from([6, 1]), deviceDetails, signedIdentityKey.public, accountSignatureKey ])
|
||||
const deviceMsg = Buffer.concat([ Buffer.from([6, 1]), deviceDetails!, signedIdentityKey.public, accountSignatureKey! ])
|
||||
account.deviceSignature = Curve.sign(signedIdentityKey.private, deviceMsg)
|
||||
|
||||
const identity = createSignalIdentity(jid, accountSignatureKey)
|
||||
const identity = createSignalIdentity(jid, accountSignatureKey!)
|
||||
const accountEnc = encodeSignedDeviceIdentity(account, false)
|
||||
|
||||
const deviceIdentity = proto.ADVDeviceIdentity.decode(account.details)
|
||||
const deviceIdentity = proto.ADVDeviceIdentity.decode(account.details!)
|
||||
|
||||
const reply: BinaryNode = {
|
||||
tag: 'iq',
|
||||
@@ -167,7 +167,7 @@ export const configureSuccessfulPairing = (
|
||||
content: [
|
||||
{
|
||||
tag: 'device-identity',
|
||||
attrs: { 'key-index': deviceIdentity.keyIndex.toString() },
|
||||
attrs: { 'key-index': deviceIdentity.keyIndex!.toString() },
|
||||
content: accountEnc
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user