@signalapp/libsignal-client
Advanced tools
Comparing version 0.28.0 to 0.29.0
@@ -38,6 +38,13 @@ /// <reference types="node" /> | ||
static _fromNativeHandle(handle: Native.ProtocolAddress): ProtocolAddress; | ||
static new(name: string, deviceId: number): ProtocolAddress; | ||
static new(name: string | ServiceId, deviceId: number): ProtocolAddress; | ||
name(): string; | ||
/** | ||
* Returns a ServiceId if this address contains a valid ServiceId, `null` otherwise. | ||
* | ||
* In a future release ProtocolAddresses will *only* support ServiceIds. | ||
*/ | ||
serviceId(): ServiceId | null; | ||
deviceId(): number; | ||
toString(): string; | ||
} | ||
export {}; |
@@ -92,2 +92,5 @@ "use strict"; | ||
static new(name, deviceId) { | ||
if (typeof name !== 'string') { | ||
name = name.getServiceIdString(); | ||
} | ||
return new ProtocolAddress(Native.ProtocolAddress_New(name, deviceId)); | ||
@@ -98,7 +101,23 @@ } | ||
} | ||
/** | ||
* Returns a ServiceId if this address contains a valid ServiceId, `null` otherwise. | ||
* | ||
* In a future release ProtocolAddresses will *only* support ServiceIds. | ||
*/ | ||
serviceId() { | ||
try { | ||
return ServiceId.parseFromServiceIdString(this.name()); | ||
} | ||
catch (_a) { | ||
return null; | ||
} | ||
} | ||
deviceId() { | ||
return Native.ProtocolAddress_DeviceId(this); | ||
} | ||
toString() { | ||
return `${this.name()}.${this.deviceId()}`; | ||
} | ||
} | ||
exports.ProtocolAddress = ProtocolAddress; | ||
//# sourceMappingURL=Address.js.map |
/// <reference types="node" /> | ||
export type UsernameLink = { | ||
entropy: Buffer; | ||
encryptedUsername: Buffer; | ||
}; | ||
export declare function generateCandidates(nickname: string, minNicknameLength: number, maxNicknameLength: number): string[]; | ||
@@ -6,9 +10,4 @@ export declare function hash(username: string): Buffer; | ||
export declare function generateProofWithRandom(username: string, random: Buffer): Buffer; | ||
export declare class UsernameLink { | ||
readonly entropy: Buffer; | ||
readonly encryptedUsername: Buffer; | ||
constructor(entropy: Buffer, encryptedUsername: Buffer); | ||
decryptUsername(): string; | ||
} | ||
export declare function decryptUsernameLink(usernameLink: UsernameLink): string; | ||
export declare function createUsernameLink(username: string): UsernameLink; | ||
export declare function verifyProof(proof: Buffer, hash: Buffer): void; |
@@ -7,3 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.verifyProof = exports.createUsernameLink = exports.UsernameLink = exports.generateProofWithRandom = exports.generateProof = exports.hash = exports.generateCandidates = void 0; | ||
exports.verifyProof = exports.createUsernameLink = exports.decryptUsernameLink = exports.generateProofWithRandom = exports.generateProof = exports.hash = exports.generateCandidates = void 0; | ||
/* eslint @typescript-eslint/no-shadow: ["error", { "allow": ["hash"] }] */ | ||
@@ -30,12 +30,6 @@ const crypto_1 = require("crypto"); | ||
exports.generateProofWithRandom = generateProofWithRandom; | ||
class UsernameLink { | ||
constructor(entropy, encryptedUsername) { | ||
this.entropy = entropy; | ||
this.encryptedUsername = encryptedUsername; | ||
} | ||
decryptUsername() { | ||
return Native.UsernameLink_DecryptUsername(this.entropy, this.encryptedUsername); | ||
} | ||
function decryptUsernameLink(usernameLink) { | ||
return Native.UsernameLink_DecryptUsername(usernameLink.entropy, usernameLink.encryptedUsername); | ||
} | ||
exports.UsernameLink = UsernameLink; | ||
exports.decryptUsernameLink = decryptUsernameLink; | ||
function createUsernameLink(username) { | ||
@@ -45,3 +39,3 @@ const usernameLinkData = Native.UsernameLink_Create(username); | ||
const encryptedUsername = usernameLinkData.slice(32); | ||
return new UsernameLink(entropy, encryptedUsername); | ||
return { entropy, encryptedUsername }; | ||
} | ||
@@ -48,0 +42,0 @@ exports.createUsernameLink = createUsernameLink; |
{ | ||
"name": "@signalapp/libsignal-client", | ||
"version": "0.28.0", | ||
"version": "0.29.0", | ||
"license": "AGPL-3.0-only", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36873142
4358