@@ -141,9 +141,11 @@ const orgRepo = sdsRepo.repo(organizationDid);
141141// Teammate can now access orgRepo and create hypercerts
142142```
143143
144- ### 2. Authentication
144+ ### 2. Authentication & OAuth Permissions
145145
146- The SDK uses OAuth 2.0 for authentication with support for both PDS (Personal Data Server) and SDS (Shared Data Server).
146+ The SDK uses OAuth 2.0 for authentication with granular permission control.
147+
148+ #### Basic Authentication
147149
148150``` typescript
149151// First-time user authentication
@@ -164,6 +166,48 @@ const session = await sdk.restoreSession("did:plc:user123");
164166const repo = sdk .getRepository (session );
165167```
166168
169+ #### OAuth Scopes & Permissions
170+
171+ Control exactly what your app can access using type-safe permission builders:
172+
173+ ``` typescript
174+ import { PermissionBuilder , ScopePresets , buildScope } from ' @hypercerts-org/sdk-core' ;
175+
176+ // Use ready-made presets
177+ const scope = ScopePresets .EMAIL_AND_PROFILE ; // Request email + profile access
178+ const scope = ScopePresets .POSTING_APP ; // Full posting capabilities
179+
180+ // Or build custom permissions
181+ const scope = buildScope (
182+ new PermissionBuilder ()
183+ .accountEmail (' read' ) // Read user's email
184+ .repoWrite (' app.bsky.feed.post' ) // Create/update posts
185+ .blob ([' image/*' , ' video/*' ]) // Upload media
186+ .build ()
187+ );
188+
189+ // Use in OAuth configuration
190+ const sdk = createATProtoSDK ({
191+ oauth: {
192+ clientId: ' your-client-id' ,
193+ redirectUri: ' https://your-app.com/callback' ,
194+ scope: scope , // Your custom scope
195+ // ... other config
196+ }
197+ });
198+ ```
199+
200+ ** Available Presets:**
201+ - ` EMAIL_READ ` - User's email address
202+ - ` PROFILE_READ ` / ` PROFILE_WRITE ` - Profile access
203+ - ` POST_WRITE ` - Create posts
204+ - ` SOCIAL_WRITE ` - Likes, reposts, follows
205+ - ` MEDIA_UPLOAD ` - Image and video uploads
206+ - ` POSTING_APP ` - Full posting with media
207+ - ` EMAIL_AND_PROFILE ` - Common combination
208+
209+ See [ OAuth Permissions Documentation] ( ./docs/implementations/atproto_oauth_scopes.md ) for detailed usage.
210+
167211### 3. Working with Hypercerts
168212
169213#### Creating a Hypercert
0 commit comments