mirror of
https://github.com/signalapp/libsignal.git
synced 2026-05-09 08:33:13 +02:00
This dedicated error is thrown when a recipient has a registration ID that's out of the range used by Signal [0, 0x3FFF]. These IDs cannot be encoded in the sealed sender v2 format and are not supported, even though they don't cause any problems for 1:1 messages.
35 lines
923 B
TypeScript
35 lines
923 B
TypeScript
//
|
|
// Copyright 2021 Signal Messenger, LLC.
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
import * as Native from './Native';
|
|
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
|
const NativeImpl = require('node-gyp-build')(
|
|
__dirname + '/../..'
|
|
) as typeof Native;
|
|
|
|
export class ProtocolAddress {
|
|
readonly _nativeHandle: Native.ProtocolAddress;
|
|
|
|
private constructor(handle: Native.ProtocolAddress) {
|
|
this._nativeHandle = handle;
|
|
}
|
|
|
|
static _fromNativeHandle(handle: Native.ProtocolAddress): ProtocolAddress {
|
|
return new ProtocolAddress(handle);
|
|
}
|
|
|
|
static new(name: string, deviceId: number): ProtocolAddress {
|
|
return new ProtocolAddress(NativeImpl.ProtocolAddress_New(name, deviceId));
|
|
}
|
|
|
|
name(): string {
|
|
return NativeImpl.ProtocolAddress_Name(this);
|
|
}
|
|
|
|
deviceId(): number {
|
|
return NativeImpl.ProtocolAddress_DeviceId(this);
|
|
}
|
|
}
|