From d699b54ff66d8fb66adbad036bde44eddfddd74c Mon Sep 17 00:00:00 2001 From: Shibo Lyu Date: Thu, 5 Dec 2024 17:21:15 +0800 Subject: [PATCH] fix(identity): validate profile on creating identity --- identity/identity.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/identity/identity.ts b/identity/identity.ts index 2612980..afd2562 100644 --- a/identity/identity.ts +++ b/identity/identity.ts @@ -6,7 +6,7 @@ import { import { type ActKeyUpdate, BlahActKey } from "./actKey.ts"; import { blahIdentityDescriptionSchema } from "./identityDescription.ts"; import type { BlahIdentityDescription } from "./mod.ts"; -import type { BlahProfile } from "./profile.ts"; +import { type BlahProfile, blahProfileSchema } from "./profile.ts"; export class BlahIdentity { private internalIdKey: BlahPublicKey | BlahKeyPair; @@ -105,7 +105,8 @@ export class BlahIdentity { firstActKeyConfig, ); - const profileRecord = await firstActKey.signPayload(profile); + const parsedProfile = blahProfileSchema.parse(profile); + const profileRecord = await firstActKey.signPayload(parsedProfile); return new BlahIdentity(idKeyPair, [actKey], profileRecord, true); }