sd-jwt-js icon indicating copy to clipboard operation
sd-jwt-js copied to clipboard

Feat: add zod for object validation

Open cre8 opened this issue 1 year ago • 2 comments

Using zod could help to validate objects before dealing with them. This should be implemented for all packages where required

cre8 avatar May 07 '24 18:05 cre8

Can you tell me what examples there are?

lukasjhan avatar May 29 '24 05:05 lukasjhan

It would help to validate variables. So instead of

if(jwk.exp && typeof jwk.exp === number) {

}

you could go with

const schema = z.number();
schema.parse(jwk.exp)

While I think ZOD is nice, I do not see so many values that we need to type check for validation (Timo brought the topic up in one of the issues)

cre8 avatar May 29 '24 07:05 cre8