@signalapp/mock-server
Advanced tools
Comparing version 6.10.0 to 6.10.1
{ | ||
"name": "@signalapp/mock-server", | ||
"version": "6.10.0", | ||
"version": "6.10.1", | ||
"description": "Mock Signal Server for writing tests", | ||
@@ -22,3 +22,4 @@ "main": "src/index.js", | ||
"lint": "eslint --cache src test", | ||
"test": "npm run mocha && npm run lint" | ||
"test": "npm run mocha && npm run lint", | ||
"prepublish": "npm run build" | ||
}, | ||
@@ -25,0 +26,0 @@ "repository": { |
@@ -1,2 +0,1 @@ | ||
export declare const ATTACHMENT_PREFIX = "af/"; | ||
export declare const PRIMARY_DEVICE_ID = 1; | ||
@@ -3,0 +2,0 @@ export declare const PRIMARY_SIGNED_PREKEY_ID = 1; |
@@ -5,4 +5,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PROFILE_KEY_CREDENTIAL_EXPIRATION = exports.DAY_IN_SECONDS = exports.MAX_GROUP_CREDENTIALS_DAYS = exports.NEVER_EXPIRES = exports.SERVER_CERTIFICATE_ID = exports.PRIMARY_SIGNED_PREKEY_ID = exports.PRIMARY_DEVICE_ID = exports.ATTACHMENT_PREFIX = void 0; | ||
exports.ATTACHMENT_PREFIX = 'af/'; | ||
exports.PROFILE_KEY_CREDENTIAL_EXPIRATION = exports.DAY_IN_SECONDS = exports.MAX_GROUP_CREDENTIALS_DAYS = exports.NEVER_EXPIRES = exports.SERVER_CERTIFICATE_ID = exports.PRIMARY_SIGNED_PREKEY_ID = exports.PRIMARY_DEVICE_ID = void 0; | ||
exports.PRIMARY_DEVICE_ID = 1; | ||
@@ -9,0 +8,0 @@ exports.PRIMARY_SIGNED_PREKEY_ID = 1; |
@@ -13,7 +13,7 @@ import z from 'zod'; | ||
}, "strip", z.ZodTypeAny, { | ||
keyId: number; | ||
publicKey: string; | ||
}, { | ||
keyId: number; | ||
}, { | ||
publicKey: string; | ||
keyId: number; | ||
}>; | ||
@@ -26,8 +26,8 @@ export type ServerPreKey = z.infer<typeof PreKeySchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -41,7 +41,7 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
keyId: number; | ||
publicKey: string; | ||
}, { | ||
keyId: number; | ||
}, { | ||
publicKey: string; | ||
keyId: number; | ||
}>, "many">; | ||
@@ -53,8 +53,8 @@ pqPreKeys: z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
}, "strip", z.ZodTypeAny, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -67,8 +67,8 @@ }>, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -81,8 +81,8 @@ }>>; | ||
}, "strip", z.ZodTypeAny, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -92,18 +92,18 @@ }>>; | ||
preKeys: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
}[]; | ||
pqPreKeys?: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}[] | undefined; | ||
pqLastResortPreKey?: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
} | undefined; | ||
signedPreKey?: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -113,18 +113,18 @@ } | undefined; | ||
preKeys: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
}[]; | ||
pqPreKeys?: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}[] | undefined; | ||
pqLastResortPreKey?: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
} | undefined; | ||
signedPreKey?: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -140,3 +140,2 @@ } | undefined; | ||
}, "strip", z.ZodTypeAny, { | ||
content: string; | ||
type: number; | ||
@@ -149,7 +148,8 @@ destinationDeviceId: number & { | ||
}; | ||
content: string; | ||
}, { | ||
content: string; | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}>; | ||
@@ -164,3 +164,2 @@ export type Message = z.infer<typeof MessageSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
content: string; | ||
type: number; | ||
@@ -173,13 +172,12 @@ destinationDeviceId: number & { | ||
}; | ||
content: string; | ||
}, { | ||
content: string; | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}>, "many">; | ||
timestamp: z.ZodNumber; | ||
}, "strip", z.ZodTypeAny, { | ||
timestamp: number; | ||
messages: { | ||
content: string; | ||
type: number; | ||
@@ -192,11 +190,13 @@ destinationDeviceId: number & { | ||
}; | ||
content: string; | ||
}[]; | ||
timestamp: number; | ||
}, { | ||
timestamp: number; | ||
messages: { | ||
content: string; | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}[]; | ||
timestamp: number; | ||
}>; | ||
@@ -212,2 +212,3 @@ export type MessageList = z.infer<typeof MessageListSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
fetchesMessages: boolean; | ||
registrationId: number & { | ||
@@ -220,8 +221,7 @@ __reg_id: never; | ||
name: string; | ||
}, { | ||
fetchesMessages: boolean; | ||
}, { | ||
registrationId: number; | ||
pniRegistrationId: number; | ||
name: string; | ||
fetchesMessages: boolean; | ||
}>; | ||
@@ -233,8 +233,8 @@ aciSignedPreKey: z.ZodObject<{ | ||
}, "strip", z.ZodTypeAny, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -247,8 +247,8 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -261,8 +261,8 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -275,8 +275,8 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}, { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -287,2 +287,3 @@ }>; | ||
accountAttributes: { | ||
fetchesMessages: boolean; | ||
registrationId: number & { | ||
@@ -295,22 +296,21 @@ __reg_id: never; | ||
name: string; | ||
fetchesMessages: boolean; | ||
}; | ||
aciSignedPreKey: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}; | ||
pniSignedPreKey: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}; | ||
aciPqLastResortPreKey: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}; | ||
pniPqLastResortPreKey: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -321,25 +321,25 @@ }; | ||
accountAttributes: { | ||
fetchesMessages: boolean; | ||
registrationId: number; | ||
pniRegistrationId: number; | ||
name: string; | ||
fetchesMessages: boolean; | ||
}; | ||
aciSignedPreKey: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}; | ||
pniSignedPreKey: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}; | ||
aciPqLastResortPreKey: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
}; | ||
pniPqLastResortPreKey: { | ||
keyId: number; | ||
publicKey: string; | ||
keyId: number; | ||
signature: string; | ||
@@ -356,8 +356,8 @@ }; | ||
}, "strip", z.ZodTypeAny, { | ||
attributes: number; | ||
members: number; | ||
attributes: number; | ||
addFromInviteLink: number; | ||
}, { | ||
attributes: number; | ||
members: number; | ||
attributes: number; | ||
addFromInviteLink: number; | ||
@@ -368,17 +368,17 @@ }>; | ||
publicKey: Uint8Array; | ||
version: 0; | ||
accessControl: { | ||
attributes: number; | ||
members: number; | ||
attributes: number; | ||
addFromInviteLink: number; | ||
}; | ||
version: 0; | ||
members: unknown[]; | ||
}, { | ||
publicKey: Uint8Array; | ||
version: 0; | ||
accessControl: { | ||
attributes: number; | ||
members: number; | ||
attributes: number; | ||
addFromInviteLink: number; | ||
}; | ||
version: 0; | ||
members: unknown[]; | ||
@@ -385,0 +385,0 @@ }>; |
@@ -241,4 +241,3 @@ "use strict"; | ||
async storeAttachment(attachment) { | ||
const id = (constants_1.ATTACHMENT_PREFIX + | ||
crypto_1.default.createHash('sha256').update(attachment).digest('hex')); | ||
const id = (crypto_1.default.createHash('sha256').update(attachment).digest('hex')); | ||
this.attachments.set(id, attachment); | ||
@@ -245,0 +244,0 @@ return id; |
@@ -131,5 +131,5 @@ "use strict"; | ||
}); | ||
const getAttachment = (0, microrouter_1.get)('/attachments/:key/:subkey', async (req, res) => { | ||
const { key, subkey } = req.params; | ||
const result = await server.fetchAttachment(`${key}/${subkey}`); | ||
const getAttachment = (0, microrouter_1.get)('/attachments/:key', async (req, res) => { | ||
const { key } = req.params; | ||
const result = await server.fetchAttachment(key); | ||
if (!result) { | ||
@@ -136,0 +136,0 @@ return (0, micro_1.send)(res, 404, { error: 'Attachment not found' }); |
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
3854321
70928