Skip to content

Commit

Permalink
share type
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonstreator committed Dec 28, 2024
1 parent 582e6a0 commit 955b51a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
28 changes: 4 additions & 24 deletions packages/core/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
import { z } from 'zod';
import { vaultValueSchema } from './vault';

export const createVaultRequestSchema = z.object({
c: z.string().describe('encrypted content'),
h: z.string().describe('sha256 hash of the encryption key + optional password'),
b: z.boolean().default(true).describe('burn after reading'),
ttl: z.number().describe('time to live (TTL) in milliseconds'),
ips: z.string().default('').optional().describe('IP address or CIDR block restrictions'),
rc: z.number().optional().describe('maximum number of times the secret can be read'),
wh: z
.object({
u: z.string().url().describe('url of the webhook'),
n: z.string().describe('name of the secret').optional(),
r: z.boolean().default(true).describe('should the webhook be called on read'),
fpk: z
.boolean()
.default(false)
.describe('should the webhook be called for failure to read based on password or key'),
fip: z
.boolean()
.default(false)
.describe('should the webhook be called for failure to read based on ip address'),
b: z.boolean().default(false).describe('should the webhook be called for secret burn'),
})
.describe('webhook configuration')
.optional(),
export const createVaultRequestSchema = vaultValueSchema.omit({
cd: true,
dt: true,
});
export type CreateVaultRequest = z.infer<typeof createVaultRequestSchema>;

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/vault.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import z from 'zod';
import { z } from 'zod';

export const vaultValueSchema = z.object({
c: z.string().describe('encrypted content'),
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
validatorCompiler,
ZodTypeProvider,
} from 'fastify-type-provider-zod';
import z from 'zod';
import { z } from 'zod';
import fastifySwagger from '@fastify/swagger';
import fastifySwaggerUI from '@fastify/swagger-ui';
import fastifyRateLimit from '@fastify/rate-limit';
Expand Down

0 comments on commit 955b51a

Please sign in to comment.