Created
November 3, 2019 23:09
-
-
Save pmrt/f22dad4798d19003be3de733ece7f764 to your computer and use it in GitHub Desktop.
WhatsApp constants
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// appInfo (for HKDF) | |
feacbgeaf: function(e, t, n) { | |
"use strict"; | |
Object.defineProperty(t, "__esModule", { | |
value: !0 | |
}), t.default = function(e, t) { | |
var n = function(e) { | |
return (0, i.default)(e, { | |
[u.default.AUDIO]: function() { | |
return "WhatsApp Audio Keys" | |
}, | |
[u.default.DOCUMENT]: function() { | |
return "WhatsApp Document Keys" | |
}, | |
[u.default.GIF]: function() { | |
return "WhatsApp Video Keys" | |
}, | |
[u.default.IMAGE]: function() { | |
return "WhatsApp Image Keys" | |
}, | |
[u.default.PPIC]: function() { | |
throw new Error("Cannot create media keys for profile pics") | |
}, | |
[u.default.PRODUCT]: function() { | |
return "WhatsApp Image Keys" | |
}, | |
[u.default.PTT]: function() { | |
return "WhatsApp Audio Keys" | |
}, | |
[u.default.STICKER]: function() { | |
return "WhatsApp Image Keys" | |
}, | |
[u.default.VIDEO]: function() { | |
return "WhatsApp Video Keys" | |
}, | |
[u.default.TEMPLATE]: function() { | |
return "WhatsApp Template Keys" | |
} | |
}) | |
}(e); | |
if (!t || !n) throw new r.MediaEncryptionError(`createKeys fail: !!mediakey: ${!!t} info: ${n} type: ${e}`); | |
return o.default.extractAndExpand(a.default.decode(t), n, 112).then(function(e) { | |
if (!e || e.byteLength < 112) throw new r.MediaEncryptionError("computeMediaKeys: hkdf error"); | |
return { | |
iv: e.slice(0, 16), | |
encKey: e.slice(16, 48), | |
macKey: e.slice(48, 80), | |
refKey: e.slice(80, 112) | |
} | |
}) | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MSG_TYPE: { | |
NOTIFICATION: "notification", | |
NOTIFICATION_TEMPLATE: "notification_template", | |
GROUP_NOTIFICATION: "group_notification", | |
GP2: "gp2", | |
BROADCAST_NOTIFICATION: "broadcast_notification", | |
E2E_NOTIFICATION: "e2e_notification", | |
CALL_LOG: "call_log", | |
PROTOCOL: "protocol", | |
CHAT: "chat", | |
LOCATION: "location", | |
PAYMENT: "payment", | |
VCARD: "vcard", | |
CIPHERTEXT: "ciphertext", | |
MULTI_VCARD: "multi_vcard", | |
REVOKED: "revoked", | |
OVERSIZED: "oversized", | |
GROUPS_V4_INVITE: "groups_v4_invite", | |
TEMPLATE: "template", | |
HSM: "hsm", | |
TEMPLATE_BUTTON_REPLY: "template_button_reply", | |
IMAGE: "image", | |
VIDEO: "video", | |
AUDIO: "audio", | |
PTT: "ptt", | |
STICKER: "sticker", | |
DOCUMENT: "document", | |
PRODUCT: "product", | |
UNKNOWN: "unknown" | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment