mirror of
https://github.com/signalapp/libsignal.git
synced 2026-04-26 01:35:22 +02:00
Limit device ID to the range 1-127
This is already required for sealed sender messages and enforced by the server.
This commit is contained in:
@@ -16,7 +16,7 @@ use(chaiAsPromised);
|
||||
util.initLogger();
|
||||
|
||||
describe('ProtocolAddress', () => {
|
||||
it('can hold arbitrary data', () => {
|
||||
it('can hold arbitrary name', () => {
|
||||
const addr = SignalClient.ProtocolAddress.new('name', 42);
|
||||
assert.deepEqual(addr.name(), 'name');
|
||||
assert.deepEqual(addr.deviceId(), 42);
|
||||
@@ -32,6 +32,13 @@ describe('ProtocolAddress', () => {
|
||||
assert.isTrue(aciAddr.serviceId()?.isEqual(aci));
|
||||
assert.isTrue(pniAddr.serviceId()?.isEqual(pni));
|
||||
});
|
||||
|
||||
it('rejects out-of-range device IDs', () => {
|
||||
assert.throws(
|
||||
() => SignalClient.ProtocolAddress.new('name', 128),
|
||||
'invalid: name.128'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ServiceId', () => {
|
||||
|
||||
Reference in New Issue
Block a user