a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
101
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(oauth-crypto): address type errors

Mary 13f6c34f aed9f4d6

+14 -15
+2 -2
packages/oauth/crypto/lib/client-assertion/create-client-assertion.ts
··· 10 10 client_id: string; 11 11 /** authorization server issuer */ 12 12 aud: string; 13 - /** JWK thumbprint of the DPoP key to bind to */ 14 - jkt: string; 13 + /** JWK thumbprint of the DPoP key to bind to (for CAB pattern) */ 14 + jkt?: string; 15 15 /** client assertion signing key */ 16 16 key: ClientAssertionPrivateJwk; 17 17 }
+8 -4
packages/oauth/crypto/lib/dpop/generate-key.test.ts
··· 8 8 9 9 expect(key.alg).toBe('ES256'); 10 10 expect(key.kty).toBe('EC'); 11 - expect(key.crv).toBe('P-256'); 11 + if (key.kty === 'EC') { 12 + expect(key.crv).toBe('P-256'); 13 + } 12 14 expect(key.d).toBeDefined(); 13 15 }); 14 16 ··· 31 33 it('should include all required JWK fields', async () => { 32 34 const key = await generateDpopKey(); 33 35 34 - expect(key.kty).toBeDefined(); 36 + expect(key.kty).toBe('EC'); 35 37 expect(key.alg).toBeDefined(); 36 - expect(key.x).toBeDefined(); 37 - expect(key.y).toBeDefined(); 38 38 expect(key.d).toBeDefined(); 39 + if (key.kty === 'EC') { 40 + expect(key.x).toBeDefined(); 41 + expect(key.y).toBeDefined(); 42 + } 39 43 }); 40 44 });
-2
packages/oauth/node-client/lib/index.ts
··· 9 9 10 10 export { 11 11 buildClientMetadata, 12 - CLIENT_ASSERTION_TYPE_JWT_BEARER, 13 - FALLBACK_ALG, 14 12 scope, 15 13 type AtprotoAuthorizationServerMetadata, 16 14 type AtprotoProtectedResourceMetadata,
+4 -7
packages/oauth/node-client/lib/oauth-client-auth.ts
··· 1 - import { createClientAssertion as createClientAssertionJwt } from '@atcute/oauth-crypto'; 2 - import type { ClientAssertionPrivateJwk } from '@atcute/oauth-crypto'; 1 + import { createClientAssertion, type ClientAssertionPrivateJwk } from '@atcute/oauth-crypto'; 3 2 import type { Keyset } from '@atcute/oauth-keyset'; 4 3 import { 5 4 CLIENT_ASSERTION_TYPE_JWT_BEARER, 6 5 FALLBACK_ALG, 7 6 type OAuthAuthorizationServerMetadata, 8 7 } from '@atcute/oauth-types'; 9 - 10 - export { CLIENT_ASSERTION_TYPE_JWT_BEARER }; 11 8 12 9 /** 13 10 * client authentication method. only `private_key_jwt` is supported. ··· 115 112 clientId: string, 116 113 audience: string, 117 114 ): Promise<ClientCredentials> => { 118 - const assertion = await createClientAssertionJwt({ 119 - clientId, 120 - audience, 115 + const assertion = await createClientAssertion({ 116 + client_id: clientId, 117 + aud: audience, 121 118 key, 122 119 }); 123 120