@signalapp/mock-server
Advanced tools
Comparing version 6.2.0 to 6.3.0
{ | ||
"name": "@signalapp/mock-server", | ||
"version": "6.2.0", | ||
"version": "6.3.0", | ||
"description": "Mock Signal Server for writing tests", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -12,7 +12,7 @@ import z from 'zod'; | ||
}, "strip", z.ZodTypeAny, { | ||
publicKey: string; | ||
keyId: number; | ||
}, { | ||
publicKey: string; | ||
}, { | ||
keyId: number; | ||
publicKey: string; | ||
}>; | ||
@@ -25,8 +25,8 @@ export type ServerPreKey = z.infer<typeof PreKeySchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -40,7 +40,7 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
publicKey: string; | ||
keyId: number; | ||
}, { | ||
publicKey: string; | ||
}, { | ||
keyId: number; | ||
publicKey: string; | ||
}>, "many">; | ||
@@ -52,8 +52,8 @@ pqPreKeys: z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
}, "strip", z.ZodTypeAny, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -66,8 +66,8 @@ }>, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -80,8 +80,8 @@ }>>; | ||
}, "strip", z.ZodTypeAny, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -91,18 +91,18 @@ }>>; | ||
preKeys: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
}[]; | ||
pqPreKeys?: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}[] | undefined; | ||
pqLastResortPreKey?: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
} | undefined; | ||
signedPreKey?: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -112,18 +112,18 @@ } | undefined; | ||
preKeys: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
}[]; | ||
pqPreKeys?: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}[] | undefined; | ||
pqLastResortPreKey?: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
} | undefined; | ||
signedPreKey?: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -139,2 +139,3 @@ } | undefined; | ||
}, "strip", z.ZodTypeAny, { | ||
content: string; | ||
type: number; | ||
@@ -147,8 +148,7 @@ destinationDeviceId: number & { | ||
}; | ||
}, { | ||
content: string; | ||
}, { | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}>; | ||
@@ -163,2 +163,3 @@ export type Message = z.infer<typeof MessageSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
content: string; | ||
type: number; | ||
@@ -171,12 +172,13 @@ destinationDeviceId: number & { | ||
}; | ||
}, { | ||
content: string; | ||
}, { | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}>, "many">; | ||
timestamp: z.ZodNumber; | ||
}, "strip", z.ZodTypeAny, { | ||
timestamp: number; | ||
messages: { | ||
content: string; | ||
type: number; | ||
@@ -189,13 +191,11 @@ destinationDeviceId: number & { | ||
}; | ||
content: string; | ||
}[]; | ||
}, { | ||
timestamp: number; | ||
}, { | ||
messages: { | ||
content: string; | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}[]; | ||
timestamp: number; | ||
}>; | ||
@@ -211,4 +211,2 @@ export type MessageList = z.infer<typeof MessageListSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
name: string; | ||
fetchesMessages: boolean; | ||
registrationId: number & { | ||
@@ -220,7 +218,9 @@ __reg_id: never; | ||
}; | ||
fetchesMessages: boolean; | ||
name: string; | ||
}, { | ||
name: string; | ||
fetchesMessages: boolean; | ||
registrationId: number; | ||
pniRegistrationId: number; | ||
fetchesMessages: boolean; | ||
name: string; | ||
}>; | ||
@@ -232,8 +232,8 @@ aciSignedPreKey: z.ZodObject<{ | ||
}, "strip", z.ZodTypeAny, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -246,8 +246,8 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -260,8 +260,8 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -274,8 +274,8 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}, { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -286,4 +286,2 @@ }>; | ||
accountAttributes: { | ||
name: string; | ||
fetchesMessages: boolean; | ||
registrationId: number & { | ||
@@ -295,21 +293,23 @@ __reg_id: never; | ||
}; | ||
fetchesMessages: boolean; | ||
name: string; | ||
}; | ||
aciSignedPreKey: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}; | ||
pniSignedPreKey: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}; | ||
aciPqLastResortPreKey: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}; | ||
pniPqLastResortPreKey: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -320,25 +320,25 @@ }; | ||
accountAttributes: { | ||
name: string; | ||
fetchesMessages: boolean; | ||
registrationId: number; | ||
pniRegistrationId: number; | ||
fetchesMessages: boolean; | ||
name: string; | ||
}; | ||
aciSignedPreKey: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}; | ||
pniSignedPreKey: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}; | ||
aciPqLastResortPreKey: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
}; | ||
pniPqLastResortPreKey: { | ||
publicKey: string; | ||
keyId: number; | ||
publicKey: string; | ||
signature: string; | ||
@@ -345,0 +345,0 @@ }; |
@@ -24,2 +24,5 @@ /// <reference types="node" /> | ||
}>; | ||
export type GroupCredentialsFlags = Readonly<{ | ||
zkc: boolean | undefined; | ||
}>; | ||
export type StorageCredentials = Readonly<{ | ||
@@ -179,3 +182,3 @@ username: string; | ||
getSenderCertificate(device: Device): Promise<SenderCertificate>; | ||
getGroupCredentials({ aci, pni }: Device, { from, to }: GroupCredentialsRange): Promise<GroupCredentials>; | ||
getGroupCredentials({ aci, pni }: Device, { from, to }: GroupCredentialsRange, flags?: GroupCredentialsFlags): Promise<GroupCredentials>; | ||
verifyGroupCredentials(publicParams: Buffer, credential: Buffer): Promise<AuthCredentialPresentation>; | ||
@@ -182,0 +185,0 @@ getCallLinkAuthCredentials({ aci }: Device, { from, to }: GroupCredentialsRange): Promise<GroupCredentials>; |
@@ -645,3 +645,3 @@ "use strict"; | ||
} | ||
async getGroupCredentials({ aci, pni }, { from, to }) { | ||
async getGroupCredentials({ aci, pni }, { from, to }, flags = { zkc: false }) { | ||
const today = (0, util_1.getTodayInSeconds)(); | ||
@@ -655,5 +655,9 @@ if (from > to || | ||
const result = []; | ||
const { zkc } = flags; | ||
const issueCredential = zkc ? | ||
auth.issueAuthCredentialWithPniZkc.bind(auth) : | ||
auth.issueAuthCredentialWithPniAsServiceId.bind(auth); | ||
for (let redemptionTime = from; redemptionTime <= to; redemptionTime += constants_1.DAY_IN_SECONDS) { | ||
result.push({ | ||
credential: auth.issueAuthCredentialWithPniAsServiceId(libsignal_client_1.Aci.parseFromServiceIdString(aci), libsignal_client_1.Pni.parseFromServiceIdString(pni), redemptionTime) | ||
credential: issueCredential(libsignal_client_1.Aci.parseFromServiceIdString(aci), libsignal_client_1.Pni.parseFromServiceIdString(pni), redemptionTime) | ||
.serialize().toString('base64'), | ||
@@ -660,0 +664,0 @@ redemptionTime, |
@@ -282,3 +282,3 @@ "use strict"; | ||
} | ||
const { redemptionStartSeconds: from, redemptionEndSeconds: to, } = query; | ||
const { redemptionStartSeconds: from, redemptionEndSeconds: to, zkcCredential, } = query; | ||
return [ | ||
@@ -290,3 +290,3 @@ 200, | ||
to: parseInt(to, 10), | ||
}), | ||
}, { zkc: zkcCredential === 'true' }), | ||
callLinkAuthCredentials: await this.server.getCallLinkAuthCredentials(device, { | ||
@@ -293,0 +293,0 @@ from: parseInt(from, 10), |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3611322
66761
1