fix user schema in `encode-url-data.ts` (#550)

* Update encode-url-data.ts

* f

* Create stale-yaks-appear.md
This commit is contained in:
Felicio Mununga 2024-04-22 17:19:08 +02:00 committed by GitHub
parent 13f7ed5415
commit 18504de67c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"@status-im/js": patch
---
fix user schema in `encode-url-data.ts`

View File

@ -60,7 +60,7 @@ export function decodeChannelURLData(data: string) {
const userSchema = z.object({
displayName: z.string().max(24).nonempty(),
description: z.string().max(240).nonempty(),
description: z.string().max(240).optional(),
// fixme: await integration in native platforms
color: colorSchema.optional().default('#ffffff'),
})
@ -69,7 +69,7 @@ export function encodeUserURLData(data: PlainMessage<User>): EncodedURLData {
return encodeURLData(new User(data).toBinary()) as EncodedURLData
}
export function decodeUserURLData(data: string): PlainMessage<User> {
export function decodeUserURLData(data: string) {
const deserialized = decodeURLData(data)
const user = User.fromBinary(deserialized.content).toJson()