feat(identity): export schema

This commit is contained in:
Shibo Lyu 2024-10-17 12:39:00 +08:00
parent c0627b5d96
commit e39152d49c
2 changed files with 27 additions and 5 deletions

View file

@ -51,8 +51,8 @@ export class BlahPublicKey {
signedPayload: unknown,
): Promise<{ payload: P; key: BlahPublicKey }> {
const signedPayloadSchema = blahSignedPayloadSchemaOf(schema);
const parsed = signedPayloadSchema.parse(signedPayload);
return await BlahPublicKey.verifyPayload(parsed as BlahSignedPayload<P>);
const parsed = signedPayloadSchema.parse(signedPayload) as z.infer<P>;
return await BlahPublicKey.verifyPayload(parsed);
}
async verifyPayload<P>(signedPayload: BlahSignedPayload<P>): Promise<P> {

View file

@ -1,4 +1,26 @@
export type { BlahActKeyRecord } from "./actKey.ts";
export type { BlahIdentityFile } from "./identityFile.ts";
export type { BlahProfile } from "./profile.ts";
import type z from "zod";
export * from "./identity.ts";
import {
type BlahProfile,
blahProfileSchema as internalBlahProfileSchema,
} from "./profile.ts";
const blahProfileSchema: z.ZodType<BlahProfile> = internalBlahProfileSchema;
export { type BlahProfile, blahProfileSchema };
import {
type BlahIdentityFile,
blahIdentityFileSchema as internalBlahIdentityFileSchema,
} from "./identityFile.ts";
const blahIdentityFileSchema: z.ZodType<BlahIdentityFile> =
internalBlahIdentityFileSchema;
export { type BlahIdentityFile, blahIdentityFileSchema };
import {
type BlahActKeyRecord,
blahActKeyRecordSchema as internalBlahActKeyRecordSchema,
} from "./actKey.ts";
const blahActKeyRecordSchema: z.ZodType<BlahActKeyRecord> =
internalBlahActKeyRecordSchema;
export { type BlahActKeyRecord, blahActKeyRecordSchema };