Skip to content

Commit 422c052

Browse files
docs: access keys and guards references in typescript
Signed-off-by: David Dal Busco <david.dalbusco@outlook.com>
1 parent 1290123 commit 422c052

1 file changed

Lines changed: 112 additions & 0 deletions

File tree

  • docs/reference/functions/typescript

docs/reference/functions/typescript/sdk.mdx

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,3 +541,115 @@ function getContentChunksStore(
541541

542542
- `ZodError` if the input schema is invalid.
543543
- `Error` if the operation fails.
544+
545+
---
546+
547+
## Access Keys
548+
549+
The following functions allow you to inspect and assert the access keys of your Satellite.
550+
551+
---
552+
553+
### getAccessKeys
554+
555+
Retrieves all access keys of the Satellite.
556+
557+
```typescript
558+
function getAccessKeys(): AccessKeys;
559+
```
560+
561+
📦 Import from `@junobuild/functions/sdk`
562+
563+
#### Returns:
564+
565+
- `AccessKeys`: The list of all access keys.
566+
567+
#### Throws:
568+
569+
- `ZodError` if the returned value does not match the expected schema.
570+
571+
---
572+
573+
### getAdminAccessKeys
574+
575+
Retrieves only the admin access keys of the Satellite.
576+
577+
```typescript
578+
function getAdminAccessKeys(): AccessKeys;
579+
```
580+
581+
📦 Import from `@junobuild/functions/sdk`
582+
583+
#### Returns:
584+
585+
- `AccessKeys`: The list of admin access keys.
586+
587+
#### Throws:
588+
589+
- `ZodError` if the returned value does not match the expected schema.
590+
591+
---
592+
593+
## Guards
594+
595+
The following guard functions can be used to validate the caller in your custom serverless functions.
596+
597+
---
598+
599+
### callerIsAdmin
600+
601+
Guards that the caller is an admin access key of this satellite. Admin access keys have full management privileges and never expire.
602+
603+
```typescript
604+
function callerIsAdmin(): void;
605+
```
606+
607+
📦 Import from `@junobuild/functions/sdk`
608+
609+
#### Returns:
610+
611+
- `void`
612+
613+
#### Throws:
614+
615+
- `ZodError` if the caller is not an admin access key.
616+
617+
---
618+
619+
### callerHasWritePermission
620+
621+
Guards that the caller has write permission. Admin and editor access keys pass; submitter access keys do not.
622+
623+
```typescript
624+
function callerHasWritePermission(): void;
625+
```
626+
627+
📦 Import from `@junobuild/functions/sdk`
628+
629+
#### Returns:
630+
631+
- `void`
632+
633+
#### Throws:
634+
635+
- `ZodError` if the caller does not have write permission.
636+
637+
---
638+
639+
### callerIsAccessKey
640+
641+
Guards that the caller is any recognized access key of this satellite. Accepts admin, editor, and submitter access keys alike.
642+
643+
```typescript
644+
function callerIsAccessKey(): void;
645+
```
646+
647+
📦 Import from `@junobuild/functions/sdk`
648+
649+
#### Returns:
650+
651+
- `void`
652+
653+
#### Throws:
654+
655+
- `ZodError` if the caller is not a recognized access key.

0 commit comments

Comments
 (0)