Return ciphertext rather than decrypted content
This commit is contained in:
@@ -31,22 +31,15 @@ test('Create a user data request (0x0002) packet.', () => {
|
||||
|
||||
test('Parse a user data request (0x0002).', () => {
|
||||
// Given
|
||||
const ciphertext = new Uint8Array([
|
||||
0x6e, 0x3f, 0xe8, 0x45, 0x65, 0x59, 0x45, 0x85, 0xb4, 0xb2, 0xbc, 0x7a, 0x03, 0xc5,
|
||||
0x6d, 0xf4, 0x23, 0x3e, 0xe9, 0x3b, 0x08, 0x6d, 0x67, 0x85, 0xc1, 0xda, 0xc6, 0x3f,
|
||||
0xef, 0xaf, 0x4f, 0xd8, 0x63, 0xe6, 0xc1, 0x6c, 0x98, 0x45, 0x46, 0x4a, 0x3b, 0x61,
|
||||
0x2c, 0x1e, 0x05, 0x03, 0x65, 0xe8, 0x8d, 0x82, 0x59, 0x56, 0x38, 0x58, 0x2e, 0xc4,
|
||||
0x6f, 0xed
|
||||
])
|
||||
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.UserDataRequest](ciphertext, KEY)
|
||||
const unpackedPacket = unpackers[MessageTypes.UserDataRequest](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