本文整理汇总了TypeScript中klay-db/lib/password.createNewPasswordHashSalt函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createNewPasswordHashSalt函数的具体用法?TypeScript createNewPasswordHashSalt怎么用?TypeScript createNewPasswordHashSalt使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createNewPasswordHashSalt函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should fail when not given current password', async () => {
const hashedPassword = await createNewPasswordHashSalt('password', passwordOptions)
const middleware = createMiddleware({kiln, databaseExtensionName: 'db'})
req.grants.userContext.password = hashedPassword
const {next, err} = await utils.runMiddleware([middleware], req)
expect(next).toHaveBeenCalled()
expect(err.message).toMatchSnapshot()
})
示例2: it
it('should set cookie', async () => {
const handler = createHandler({secret: 'secret', kiln, databaseExtensionName: 'db'})
const body = {username: 'klay', password: 'rocko'}
const hashedPassword = createNewPasswordHashSalt('rocko', passwordModel.spec.db.password)
const cookie = jest.fn()
jest.spyOn(executor, 'findOne').mockReturnValue({password: hashedPassword})
await handler({body}, {json, cookie}, next)
expect(next).not.toHaveBeenCalled()
expect(cookie).toHaveBeenCalled()
})