Skip to content

Commit a88d9b3

Browse files
committed
fix: normalize emails
1 parent 4dbc9c3 commit a88d9b3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

devices/publicDevicesRepo.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb'
99
import { randomWords } from '@bifravst/random-words'
1010
import { models } from '@hello.nrfcloud.com/proto-map/models'
11+
import { normalizeEmail } from '../users/normalizeEmail.js'
1112
import { consentDurationSeconds } from './consentDuration.js'
1213

1314
export type PublicDeviceRecord = {
@@ -138,7 +139,7 @@ export const publicDevicesRepo = ({
138139
Math.round((now ?? new Date()).getTime() / 1000) +
139140
consentDurationSeconds,
140141
model,
141-
ownerEmail: email,
142+
ownerEmail: normalizeEmail(email),
142143
},
143144
{
144145
removeUndefinedValues: true,

jwt/userJWT.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Context } from '@hello.nrfcloud.com/proto-map/api'
22

33
import jwt from 'jsonwebtoken'
4+
import { normalizeEmail } from '../users/normalizeEmail.js'
45

56
export const userJWT = (
67
email: string,
@@ -15,7 +16,7 @@ export const userJWT = (
1516
jwt.sign(
1617
{
1718
'@context': Context.userJWT.toString(),
18-
email,
19+
email: normalizeEmail(email),
1920
},
2021
privateKey,
2122
{

0 commit comments

Comments
 (0)