@signalapp/mock-server
Advanced tools
Comparing version 2.18.0 to 2.19.0
{ | ||
"name": "@signalapp/mock-server", | ||
"version": "2.18.0", | ||
"version": "2.19.0", | ||
"description": "Mock Signal Server for writing tests", | ||
@@ -43,3 +43,3 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"@signalapp/libsignal-client": "^0.22.0", | ||
"@signalapp/libsignal-client": "^0.24.0", | ||
"debug": "^4.3.2", | ||
@@ -46,0 +46,0 @@ "long": "^4.0.0", |
@@ -41,5 +41,6 @@ /// <reference types="node" /> | ||
updatedPni?: UUID; | ||
distributionId?: UUID; | ||
group?: Group; | ||
}>; | ||
export type EncryptTextOptions = EncryptOptions & Readonly<{ | ||
group?: Group; | ||
withProfileKey?: boolean; | ||
@@ -200,2 +201,3 @@ withPniSignature?: boolean; | ||
sendRaw(target: Device, content: Proto.IContent, options?: EncryptOptions): Promise<void>; | ||
sendSenderKey(target: Device, options?: EncryptOptions): Promise<UUID>; | ||
receive(source: Device, encrypted: Buffer): Promise<void>; | ||
@@ -202,0 +204,0 @@ waitForMessage(): Promise<MessageQueueEntry>; |
@@ -692,2 +692,12 @@ "use strict"; | ||
} | ||
async sendSenderKey(target, options) { | ||
const distributionId = crypto_1.default.randomUUID(); | ||
const senderKeys = this.senderKeys.get(types_1.UUIDKind.ACI); | ||
(0, assert_1.default)(senderKeys, 'Should have a sender key store'); | ||
const skdm = await libsignal_client_1.SenderKeyDistributionMessage.create(target.address, distributionId, senderKeys); | ||
this.sendRaw(target, { | ||
senderKeyDistributionMessage: skdm.serialize(), | ||
}, options); | ||
return distributionId; | ||
} | ||
async receive(source, encrypted) { | ||
@@ -896,3 +906,3 @@ const envelope = compiled_1.signalservice.Envelope.decode(encrypted); | ||
} | ||
async encrypt(target, message, { timestamp = Date.now(), sealed = false, uuidKind = types_1.UUIDKind.ACI, updatedPni, } = {}) { | ||
async encrypt(target, message, { timestamp = Date.now(), sealed = false, uuidKind = types_1.UUIDKind.ACI, updatedPni, distributionId, group, } = {}) { | ||
assert_1.default.ok(this.isInitialized, 'Not initialized'); | ||
@@ -911,3 +921,15 @@ // "Pad" | ||
(0, assert_1.default)(uuidKind === types_1.UUIDKind.ACI, 'Can\'t send sealed sender to PNI'); | ||
content = await SignalClient.sealedSenderEncryptMessage(paddedMessage, target.getAddressByKind(uuidKind), this.senderCertificate, this.sessions, identity); | ||
if (distributionId) { | ||
(0, assert_1.default)(group, 'Should have a Group along with distributionId'); | ||
const senderKey = this.senderKeys.get(types_1.UUIDKind.ACI); | ||
(0, assert_1.default)(senderKey, 'Should have an ACI sender keys'); | ||
const ciphertext = await SignalClient.groupEncrypt(this.device.address, distributionId, senderKey, paddedMessage); | ||
const usmc = SignalClient.UnidentifiedSenderMessageContent.new(ciphertext, this.senderCertificate, SignalClient.ContentHint.Implicit, group.publicParams.getGroupIdentifier().serialize()); | ||
const multiRecipient = await SignalClient.sealedSenderMultiRecipientEncrypt(usmc, [target.getAddressByKind(uuidKind)], identity, this.sessions); | ||
content = | ||
SignalClient.sealedSenderMultiRecipientMessageForSingleRecipient(multiRecipient); | ||
} | ||
else { | ||
content = await SignalClient.sealedSenderEncryptMessage(paddedMessage, target.getAddressByKind(uuidKind), this.senderCertificate, this.sessions, identity); | ||
} | ||
envelopeType = compiled_1.signalservice.Envelope.Type.UNIDENTIFIED_SENDER; | ||
@@ -914,0 +936,0 @@ } |
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
3405055
66
62384
+ Added@signalapp/libsignal-client@0.24.0(transitive)
- Removed@signalapp/libsignal-client@0.22.2(transitive)