mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-20 03:52:17 +02:00
ad5166e814
This logic is a bit finicky and it's better not to repeat it.
32 lines
771 B
TypeScript
32 lines
771 B
TypeScript
//
|
|
// Copyright 2021 Signal Messenger, LLC.
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
import * as Native from './Native';
|
|
import NativeImpl from './NativeImpl';
|
|
|
|
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);
|
|
}
|
|
}
|