Skip to content

Commit 8bada43

Browse files
committed
feat(oauth): enhance OAuth config schema with permissions documentation
- Add comprehensive JSDoc examples for scope field - Document usage with PermissionBuilder and ScopePresets - Add validation: scope must be non-empty string - Link to atproto permission specs - Build and lint successful
1 parent c1128f1 commit 8bada43

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

packages/sdk-core/src/core/config.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,34 @@ export const OAuthConfigSchema = z.object({
2525

2626
/**
2727
* OAuth scopes to request, space-separated.
28-
* Common scopes: "atproto", "transition:generic"
28+
*
29+
* Can be a string of space-separated permissions or use the permission system:
30+
*
31+
* @example Using presets
32+
* ```typescript
33+
* import { ScopePresets } from '@hypercerts-org/sdk-core';
34+
* scope: ScopePresets.EMAIL_AND_PROFILE
35+
* ```
36+
*
37+
* @example Building custom scopes
38+
* ```typescript
39+
* import { PermissionBuilder, buildScope } from '@hypercerts-org/sdk-core';
40+
* scope: buildScope(
41+
* new PermissionBuilder()
42+
* .accountEmail('read')
43+
* .repoWrite('app.bsky.feed.post')
44+
* .build()
45+
* )
46+
* ```
47+
*
48+
* @example Legacy scopes
49+
* ```typescript
50+
* scope: "atproto transition:generic"
51+
* ```
52+
*
53+
* @see https://atproto.com/specs/permission for permission details
2954
*/
30-
scope: z.string(),
55+
scope: z.string().min(1, "OAuth scope is required"),
3156

3257
/**
3358
* URL to your public JWKS (JSON Web Key Set) endpoint.

0 commit comments

Comments
 (0)