Return ciphertext rather than decrypted content
This commit is contained in:
@@ -31,22 +31,15 @@ test('Create a user data response (0x0003) packet.', () => {
|
||||
|
||||
test('Parse a user data response (0x0003).', () => {
|
||||
// Given
|
||||
const ciphertext = new Uint8Array([
|
||||
0x56, 0x71, 0x08, 0xf9, 0x2c, 0x4e, 0x41, 0x13, 0xbe, 0x44, 0xba, 0xd9, 0xe4, 0x25,
|
||||
0x14, 0x60, 0x3b, 0x96, 0x7e, 0x0b, 0xbd, 0xac, 0xf0, 0xaf, 0xac, 0xd7, 0x80, 0xe5,
|
||||
0x62, 0xd4, 0x33, 0x10, 0x23, 0x6d, 0x00, 0x3c, 0xae, 0x40, 0x6c, 0xe9, 0x40, 0xfc,
|
||||
0x1c, 0xe0, 0xd3, 0xca, 0x65, 0xea, 0x83, 0x73, 0x5e, 0xd2, 0x67, 0xb2, 0x94, 0x58,
|
||||
0x12, 0x73
|
||||
])
|
||||
const data = new Uint8Array([0, 12, 66, 117, 116, 108, 101, 114, 115, 97, 117, 114, 117, 115, 255, 64, 0, 0, 7, 77, 101, 114, 99, 117, 114, 121])
|
||||
const username = 'Butlersaurus'
|
||||
const colour = Color('#FF4000')
|
||||
const clientId = 'Mercury'
|
||||
|
||||
// When
|
||||
const unpackedPacket = unpackers[MessageTypes.UserDataResponse](ciphertext, KEY)
|
||||
const unpackedPacket = unpackers[MessageTypes.UserDataResponse](data)
|
||||
|
||||
// Then
|
||||
expect(unpackedPacket.success).toBe(true)
|
||||
expect(unpackedPacket.username).toBe(username)
|
||||
expect(unpackedPacket.colour).toMatchObject(colour)
|
||||
expect(unpackedPacket.clientId).toBe(clientId)
|
||||
|
||||
Reference in New Issue
Block a user