@openverifiable/connector-bluesky 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/lib/__fixtures__/did-documents.d.ts +54 -0
  2. package/lib/__fixtures__/did-documents.d.ts.map +1 -0
  3. package/lib/__fixtures__/did-documents.js +56 -0
  4. package/lib/__fixtures__/metadata.d.ts +70 -0
  5. package/lib/__fixtures__/metadata.d.ts.map +1 -0
  6. package/lib/__fixtures__/metadata.js +56 -0
  7. package/lib/__fixtures__/oauth-errors.d.ts +42 -0
  8. package/lib/__fixtures__/oauth-errors.d.ts.map +1 -0
  9. package/lib/__fixtures__/oauth-errors.js +41 -0
  10. package/lib/__fixtures__/profile-responses.d.ts +34 -0
  11. package/lib/__fixtures__/profile-responses.d.ts.map +1 -0
  12. package/lib/__fixtures__/profile-responses.js +28 -0
  13. package/lib/__fixtures__/token-responses.d.ts +38 -0
  14. package/lib/__fixtures__/token-responses.d.ts.map +1 -0
  15. package/lib/__fixtures__/token-responses.js +33 -0
  16. package/lib/__tests__/integration/real-account-helpers.d.ts +43 -0
  17. package/lib/__tests__/integration/real-account-helpers.d.ts.map +1 -0
  18. package/lib/__tests__/integration/real-account-helpers.js +84 -0
  19. package/lib/__tests__/integration/real-account.test.d.ts +12 -0
  20. package/lib/__tests__/integration/real-account.test.d.ts.map +1 -0
  21. package/lib/__tests__/integration/real-account.test.js +118 -0
  22. package/lib/client-assertion.d.ts +19 -0
  23. package/lib/client-assertion.d.ts.map +1 -0
  24. package/lib/client-assertion.js +50 -0
  25. package/lib/client-assertion.test.d.ts +6 -0
  26. package/lib/client-assertion.test.d.ts.map +1 -0
  27. package/lib/client-assertion.test.js +234 -0
  28. package/lib/constant.d.ts +24 -0
  29. package/lib/constant.d.ts.map +1 -0
  30. package/lib/constant.js +77 -0
  31. package/lib/dpop.d.ts +24 -0
  32. package/lib/dpop.d.ts.map +1 -0
  33. package/lib/dpop.js +138 -0
  34. package/lib/dpop.test.d.ts +6 -0
  35. package/lib/dpop.test.d.ts.map +1 -0
  36. package/lib/dpop.test.js +266 -0
  37. package/lib/index.d.ts +12 -0
  38. package/lib/index.d.ts.map +1 -0
  39. package/lib/index.js +1129 -0
  40. package/lib/index.test.d.ts +7 -0
  41. package/lib/index.test.d.ts.map +1 -0
  42. package/lib/index.test.js +329 -0
  43. package/lib/mock.d.ts +5 -0
  44. package/lib/mock.d.ts.map +1 -0
  45. package/lib/mock.js +24 -0
  46. package/lib/pds-discovery.d.ts +18 -0
  47. package/lib/pds-discovery.d.ts.map +1 -0
  48. package/lib/pds-discovery.js +248 -0
  49. package/lib/pds-discovery.test.d.ts +6 -0
  50. package/lib/pds-discovery.test.d.ts.map +1 -0
  51. package/lib/pds-discovery.test.js +281 -0
  52. package/lib/pkce.d.ts +16 -0
  53. package/lib/pkce.d.ts.map +1 -0
  54. package/lib/pkce.js +46 -0
  55. package/lib/pkce.test.d.ts +6 -0
  56. package/lib/pkce.test.d.ts.map +1 -0
  57. package/lib/pkce.test.js +117 -0
  58. package/lib/test-utils.d.ts +65 -0
  59. package/lib/test-utils.d.ts.map +1 -0
  60. package/lib/test-utils.js +132 -0
  61. package/lib/types.d.ts +221 -0
  62. package/lib/types.d.ts.map +1 -0
  63. package/lib/types.js +95 -0
  64. package/package.json +96 -0
@@ -0,0 +1,54 @@
1
+ /**
2
+ * DID Document Fixtures
3
+ * Valid DID documents for testing DID resolution and PDS discovery
4
+ */
5
+ export declare const didPlcDocument: {
6
+ id: string;
7
+ '@context': string[];
8
+ service: {
9
+ id: string;
10
+ type: string;
11
+ serviceEndpoint: string;
12
+ }[];
13
+ verificationMethod: {
14
+ id: string;
15
+ type: string;
16
+ controller: string;
17
+ publicKeyMultibase: string;
18
+ }[];
19
+ };
20
+ export declare const didWebDocument: {
21
+ id: string;
22
+ '@context': string[];
23
+ service: {
24
+ id: string;
25
+ type: string;
26
+ serviceEndpoint: string;
27
+ }[];
28
+ verificationMethod: {
29
+ id: string;
30
+ type: string;
31
+ controller: string;
32
+ publicKeyMultibase: string;
33
+ }[];
34
+ };
35
+ export declare const didDocumentWithHandle: {
36
+ alsoKnownAs: string[];
37
+ id: string;
38
+ '@context': string[];
39
+ service: {
40
+ id: string;
41
+ type: string;
42
+ serviceEndpoint: string;
43
+ }[];
44
+ verificationMethod: {
45
+ id: string;
46
+ type: string;
47
+ controller: string;
48
+ publicKeyMultibase: string;
49
+ }[];
50
+ };
51
+ export declare const invalidDidDocument: {
52
+ id: string;
53
+ };
54
+ //# sourceMappingURL=did-documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did-documents.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/did-documents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;CAqB1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;CAqB1B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;CAGjC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;CAG9B,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * DID Document Fixtures
3
+ * Valid DID documents for testing DID resolution and PDS discovery
4
+ */
5
+ export const didPlcDocument = {
6
+ id: 'did:plc:example123456789',
7
+ '@context': [
8
+ 'https://www.w3.org/ns/did/v1',
9
+ 'https://w3id.org/security/multikey/v1',
10
+ ],
11
+ service: [
12
+ {
13
+ id: '#atproto_pds',
14
+ type: 'AtprotoPersonalDataServer',
15
+ serviceEndpoint: 'https://bsky.social',
16
+ },
17
+ ],
18
+ verificationMethod: [
19
+ {
20
+ id: '#atproto',
21
+ type: 'Multikey',
22
+ controller: 'did:plc:example123456789',
23
+ publicKeyMultibase: 'z1234567890abcdef',
24
+ },
25
+ ],
26
+ };
27
+ export const didWebDocument = {
28
+ id: 'did:web:example.com',
29
+ '@context': [
30
+ 'https://www.w3.org/ns/did/v1',
31
+ 'https://w3id.org/security/multikey/v1',
32
+ ],
33
+ service: [
34
+ {
35
+ id: '#atproto_pds',
36
+ type: 'AtprotoPersonalDataServer',
37
+ serviceEndpoint: 'https://pds.example.com',
38
+ },
39
+ ],
40
+ verificationMethod: [
41
+ {
42
+ id: '#atproto',
43
+ type: 'Multikey',
44
+ controller: 'did:web:example.com',
45
+ publicKeyMultibase: 'zabcdef1234567890',
46
+ },
47
+ ],
48
+ };
49
+ export const didDocumentWithHandle = {
50
+ ...didPlcDocument,
51
+ alsoKnownAs: ['at://example.bsky.social'],
52
+ };
53
+ export const invalidDidDocument = {
54
+ id: 'did:plc:invalid',
55
+ // Missing required service field
56
+ };
@@ -0,0 +1,70 @@
1
+ /**
2
+ * OAuth Metadata Fixtures
3
+ * Authorization server and resource server metadata for testing
4
+ */
5
+ export declare const authorizationServerMetadata: {
6
+ issuer: string;
7
+ pushed_authorization_request_endpoint: string;
8
+ authorization_endpoint: string;
9
+ token_endpoint: string;
10
+ scopes_supported: string;
11
+ response_types_supported: string[];
12
+ grant_types_supported: string[];
13
+ code_challenge_methods_supported: string[];
14
+ dpop_signing_alg_values_supported: string[];
15
+ };
16
+ export declare const authorizationServerMetadataWithoutAtproto: {
17
+ scopes_supported: string;
18
+ issuer: string;
19
+ pushed_authorization_request_endpoint: string;
20
+ authorization_endpoint: string;
21
+ token_endpoint: string;
22
+ response_types_supported: string[];
23
+ grant_types_supported: string[];
24
+ code_challenge_methods_supported: string[];
25
+ dpop_signing_alg_values_supported: string[];
26
+ };
27
+ export declare const resourceServerMetadata: {
28
+ resource: string;
29
+ authorization_servers: string[];
30
+ };
31
+ export declare const resourceServerMetadataWithEntryway: {
32
+ resource: string;
33
+ authorization_servers: string[];
34
+ };
35
+ export declare const clientMetadata: {
36
+ client_id: string;
37
+ application_type: string;
38
+ client_name: string;
39
+ client_uri: string;
40
+ dpop_bound_access_tokens: boolean;
41
+ grant_types: string[];
42
+ redirect_uris: string[];
43
+ response_types: string[];
44
+ scope: string;
45
+ token_endpoint_auth_method: string;
46
+ };
47
+ export declare const confidentialClientMetadata: {
48
+ token_endpoint_auth_method: string;
49
+ token_endpoint_auth_signing_alg: string;
50
+ jwks_uri: string;
51
+ jwks: {
52
+ keys: {
53
+ kty: string;
54
+ crv: string;
55
+ x: string;
56
+ y: string;
57
+ kid: string;
58
+ }[];
59
+ };
60
+ client_id: string;
61
+ application_type: string;
62
+ client_name: string;
63
+ client_uri: string;
64
+ dpop_bound_access_tokens: boolean;
65
+ grant_types: string[];
66
+ redirect_uris: string[];
67
+ response_types: string[];
68
+ scope: string;
69
+ };
70
+ //# sourceMappingURL=metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/metadata.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;CAUvC,CAAC;AAEF,eAAO,MAAM,yCAAyC;;;;;;;;;;CAGrD,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;CAGlC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;CAG9C,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;CAW1B,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;CAgBtC,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * OAuth Metadata Fixtures
3
+ * Authorization server and resource server metadata for testing
4
+ */
5
+ export const authorizationServerMetadata = {
6
+ issuer: 'https://bsky.social',
7
+ pushed_authorization_request_endpoint: 'https://bsky.social/oauth/par',
8
+ authorization_endpoint: 'https://bsky.social/oauth/authorize',
9
+ token_endpoint: 'https://bsky.social/oauth/token',
10
+ scopes_supported: 'atproto transition:generic',
11
+ response_types_supported: ['code'],
12
+ grant_types_supported: ['authorization_code', 'refresh_token'],
13
+ code_challenge_methods_supported: ['S256'],
14
+ dpop_signing_alg_values_supported: ['ES256'],
15
+ };
16
+ export const authorizationServerMetadataWithoutAtproto = {
17
+ ...authorizationServerMetadata,
18
+ scopes_supported: 'openid profile email',
19
+ };
20
+ export const resourceServerMetadata = {
21
+ resource: 'https://bsky.social',
22
+ authorization_servers: ['https://bsky.social'],
23
+ };
24
+ export const resourceServerMetadataWithEntryway = {
25
+ resource: 'https://pds.example.com',
26
+ authorization_servers: ['https://entryway.example.com'],
27
+ };
28
+ export const clientMetadata = {
29
+ client_id: 'https://app.example.com/oauth/client-metadata.json',
30
+ application_type: 'web',
31
+ client_name: 'Example Browser App',
32
+ client_uri: 'https://app.example.com',
33
+ dpop_bound_access_tokens: true,
34
+ grant_types: ['authorization_code', 'refresh_token'],
35
+ redirect_uris: ['https://app.example.com/oauth/callback'],
36
+ response_types: ['code'],
37
+ scope: 'atproto transition:generic',
38
+ token_endpoint_auth_method: 'none',
39
+ };
40
+ export const confidentialClientMetadata = {
41
+ ...clientMetadata,
42
+ token_endpoint_auth_method: 'private_key_jwt',
43
+ token_endpoint_auth_signing_alg: 'ES256',
44
+ jwks_uri: 'https://app.example.com/.well-known/jwks.json',
45
+ jwks: {
46
+ keys: [
47
+ {
48
+ kty: 'EC',
49
+ crv: 'P-256',
50
+ x: 'example_x',
51
+ y: 'example_y',
52
+ kid: 'key-1',
53
+ },
54
+ ],
55
+ },
56
+ };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * OAuth Error Response Fixtures
3
+ * Standard OAuth error responses for testing error handling
4
+ */
5
+ export declare const useDpopNonceError: {
6
+ error: string;
7
+ error_description: string;
8
+ nonce: string;
9
+ };
10
+ export declare const invalidRequestError: {
11
+ error: string;
12
+ error_description: string;
13
+ };
14
+ export declare const invalidClientError: {
15
+ error: string;
16
+ error_description: string;
17
+ };
18
+ export declare const invalidGrantError: {
19
+ error: string;
20
+ error_description: string;
21
+ };
22
+ export declare const invalidScopeError: {
23
+ error: string;
24
+ error_description: string;
25
+ };
26
+ export declare const unauthorizedClientError: {
27
+ error: string;
28
+ error_description: string;
29
+ };
30
+ export declare const unsupportedGrantTypeError: {
31
+ error: string;
32
+ error_description: string;
33
+ };
34
+ export declare const serverError: {
35
+ error: string;
36
+ error_description: string;
37
+ };
38
+ export declare const temporarilyUnavailableError: {
39
+ error: string;
40
+ error_description: string;
41
+ };
42
+ //# sourceMappingURL=oauth-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-errors.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/oauth-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,iBAAiB;;;;CAI7B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;CAG9B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAG7B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAG7B,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;CAGnC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;CAGrC,CAAC;AAEF,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;CAGvC,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * OAuth Error Response Fixtures
3
+ * Standard OAuth error responses for testing error handling
4
+ */
5
+ export const useDpopNonceError = {
6
+ error: 'use_dpop_nonce',
7
+ error_description: 'Resource server requires nonce in DPoP proof',
8
+ nonce: 'eyJ7S_zG.eyJH0-Z.HX4w-7v',
9
+ };
10
+ export const invalidRequestError = {
11
+ error: 'invalid_request',
12
+ error_description: 'The request is missing a required parameter',
13
+ };
14
+ export const invalidClientError = {
15
+ error: 'invalid_client',
16
+ error_description: 'Client authentication failed',
17
+ };
18
+ export const invalidGrantError = {
19
+ error: 'invalid_grant',
20
+ error_description: 'The provided authorization grant is invalid',
21
+ };
22
+ export const invalidScopeError = {
23
+ error: 'invalid_scope',
24
+ error_description: 'The requested scope is invalid',
25
+ };
26
+ export const unauthorizedClientError = {
27
+ error: 'unauthorized_client',
28
+ error_description: 'The client is not authorized to request an authorization code',
29
+ };
30
+ export const unsupportedGrantTypeError = {
31
+ error: 'unsupported_grant_type',
32
+ error_description: 'The authorization grant type is not supported',
33
+ };
34
+ export const serverError = {
35
+ error: 'server_error',
36
+ error_description: 'The authorization server encountered an error',
37
+ };
38
+ export const temporarilyUnavailableError = {
39
+ error: 'temporarily_unavailable',
40
+ error_description: 'The authorization server is temporarily unavailable',
41
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Profile Response Fixtures
3
+ * AT Protocol profile responses from PDS for testing
4
+ */
5
+ export declare const profileResponse: {
6
+ did: string;
7
+ handle: string;
8
+ displayName: string;
9
+ avatar: string;
10
+ email: string;
11
+ description: string;
12
+ createdAt: string;
13
+ };
14
+ export declare const profileResponseMinimal: {
15
+ did: string;
16
+ handle: string;
17
+ };
18
+ export declare const profileResponseWithoutEmail: {
19
+ did: string;
20
+ handle: string;
21
+ displayName: string;
22
+ avatar: string;
23
+ description: string;
24
+ };
25
+ export declare const profileResponseWithDifferentDID: {
26
+ did: string;
27
+ handle: string;
28
+ displayName: string;
29
+ avatar: string;
30
+ email: string;
31
+ description: string;
32
+ createdAt: string;
33
+ };
34
+ //# sourceMappingURL=profile-responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-responses.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/profile-responses.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,eAAe;;;;;;;;CAQ3B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;CAGlC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;CAMvC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;CAG3C,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Profile Response Fixtures
3
+ * AT Protocol profile responses from PDS for testing
4
+ */
5
+ export const profileResponse = {
6
+ did: 'did:plc:example123456789',
7
+ handle: 'example.bsky.social',
8
+ displayName: 'Example User',
9
+ avatar: 'https://cdn.bsky.app/avatar/example.jpg',
10
+ email: 'user@example.com',
11
+ description: 'This is an example user profile',
12
+ createdAt: '2024-01-01T00:00:00.000Z',
13
+ };
14
+ export const profileResponseMinimal = {
15
+ did: 'did:plc:example123456789',
16
+ handle: 'example.bsky.social',
17
+ };
18
+ export const profileResponseWithoutEmail = {
19
+ did: 'did:plc:example123456789',
20
+ handle: 'example.bsky.social',
21
+ displayName: 'Example User',
22
+ avatar: 'https://cdn.bsky.app/avatar/example.jpg',
23
+ description: 'This is an example user profile',
24
+ };
25
+ export const profileResponseWithDifferentDID = {
26
+ ...profileResponse,
27
+ did: 'did:plc:different123456',
28
+ };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Token Response Fixtures
3
+ * OAuth token exchange responses for testing
4
+ */
5
+ export declare const tokenResponse: {
6
+ access_token: string;
7
+ refresh_token: string;
8
+ token_type: string;
9
+ expires_in: number;
10
+ scope: string;
11
+ sub: string;
12
+ did: string;
13
+ };
14
+ export declare const tokenResponseWithoutRefresh: {
15
+ access_token: string;
16
+ token_type: string;
17
+ expires_in: number;
18
+ scope: string;
19
+ sub: string;
20
+ };
21
+ export declare const tokenResponseWithDifferentDID: {
22
+ sub: string;
23
+ did: string;
24
+ access_token: string;
25
+ refresh_token: string;
26
+ token_type: string;
27
+ expires_in: number;
28
+ scope: string;
29
+ };
30
+ export declare const refreshTokenResponse: {
31
+ access_token: string;
32
+ refresh_token: string;
33
+ token_type: string;
34
+ expires_in: number;
35
+ scope: string;
36
+ sub: string;
37
+ };
38
+ //# sourceMappingURL=token-responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-responses.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/token-responses.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,aAAa;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;CAMvC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;CAIzC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;CAOhC,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Token Response Fixtures
3
+ * OAuth token exchange responses for testing
4
+ */
5
+ export const tokenResponse = {
6
+ access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example',
7
+ refresh_token: 'refresh_token_12345',
8
+ token_type: 'Bearer',
9
+ expires_in: 3600,
10
+ scope: 'atproto transition:generic',
11
+ sub: 'did:plc:example123456789',
12
+ did: 'did:plc:example123456789',
13
+ };
14
+ export const tokenResponseWithoutRefresh = {
15
+ access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example',
16
+ token_type: 'Bearer',
17
+ expires_in: 3600,
18
+ scope: 'atproto transition:generic',
19
+ sub: 'did:plc:example123456789',
20
+ };
21
+ export const tokenResponseWithDifferentDID = {
22
+ ...tokenResponse,
23
+ sub: 'did:plc:different123456',
24
+ did: 'did:plc:different123456',
25
+ };
26
+ export const refreshTokenResponse = {
27
+ access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.new_token',
28
+ refresh_token: 'new_refresh_token_67890',
29
+ token_type: 'Bearer',
30
+ expires_in: 3600,
31
+ scope: 'atproto transition:generic',
32
+ sub: 'did:plc:example123456789',
33
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Real Account Test Helpers
3
+ * Utilities for testing with real AT Protocol accounts
4
+ *
5
+ * Note: For full token verification, you may need @atproto/api
6
+ * Install it as a dev dependency if needed: npm install --save-dev @atproto/api
7
+ */
8
+ import type { BlueskyConfig } from '../../types.js';
9
+ export interface TestAccount {
10
+ handle: string;
11
+ did: string;
12
+ pdsUrl: string;
13
+ }
14
+ export interface TestSession {
15
+ accessToken: string;
16
+ refreshToken?: string;
17
+ did: string;
18
+ expiresAt: number;
19
+ }
20
+ /**
21
+ * Get test account from environment variables
22
+ */
23
+ export declare function getTestAccount(): TestAccount;
24
+ /**
25
+ * Verify access token is valid by making an authenticated request
26
+ *
27
+ * Note: This requires @atproto/api. For a simpler check, you can verify
28
+ * the token structure or make a direct HTTP request with DPoP.
29
+ */
30
+ export declare function verifyAccessToken(accessToken: string, did: string, pdsUrl: string): Promise<boolean>;
31
+ /**
32
+ * Create test config from environment variables
33
+ */
34
+ export declare function getTestConfig(): BlueskyConfig;
35
+ /**
36
+ * Check if integration tests should run
37
+ */
38
+ export declare function shouldRunIntegrationTests(): boolean;
39
+ /**
40
+ * Get test redirect URI
41
+ */
42
+ export declare function getTestRedirectUri(): string;
43
+ //# sourceMappingURL=real-account-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"real-account-helpers.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/real-account-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAa5C;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAmBlB;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,aAAa,CA0B7C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAMnD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Real Account Test Helpers
3
+ * Utilities for testing with real AT Protocol accounts
4
+ *
5
+ * Note: For full token verification, you may need @atproto/api
6
+ * Install it as a dev dependency if needed: npm install --save-dev @atproto/api
7
+ */
8
+ /**
9
+ * Get test account from environment variables
10
+ */
11
+ export function getTestAccount() {
12
+ const handle = process.env.TEST_BLUESKY_HANDLE;
13
+ const did = process.env.TEST_BLUESKY_DID;
14
+ const pdsUrl = process.env.TEST_BLUESKY_PDS || 'https://bsky.social';
15
+ if (!handle || !did) {
16
+ throw new Error('TEST_BLUESKY_HANDLE and TEST_BLUESKY_DID must be set for integration tests. ' +
17
+ 'Create a test account at https://bsky.app and set these environment variables.');
18
+ }
19
+ return { handle, did, pdsUrl };
20
+ }
21
+ /**
22
+ * Verify access token is valid by making an authenticated request
23
+ *
24
+ * Note: This requires @atproto/api. For a simpler check, you can verify
25
+ * the token structure or make a direct HTTP request with DPoP.
26
+ */
27
+ export async function verifyAccessToken(accessToken, did, pdsUrl) {
28
+ try {
29
+ // Simple validation: check token structure
30
+ // In production, you'd make an actual API call with DPoP
31
+ if (!accessToken || accessToken.length < 10) {
32
+ return false;
33
+ }
34
+ // For full verification, you would:
35
+ // 1. Create DPoP proof for the request
36
+ // 2. Make authenticated request to PDS
37
+ // 3. Verify response is successful
38
+ // For now, just check basic structure
39
+ return typeof accessToken === 'string' && accessToken.length > 0;
40
+ }
41
+ catch (error) {
42
+ console.error('Token verification failed:', error);
43
+ return false;
44
+ }
45
+ }
46
+ /**
47
+ * Create test config from environment variables
48
+ */
49
+ export function getTestConfig() {
50
+ const clientMetadataUri = process.env.TEST_CLIENT_METADATA_URI;
51
+ const clientId = process.env.TEST_CLIENT_ID || clientMetadataUri;
52
+ const jwksUri = process.env.TEST_JWKS_URI;
53
+ if (!clientMetadataUri) {
54
+ throw new Error('TEST_CLIENT_METADATA_URI must be set. ' +
55
+ 'This should be a publicly accessible URL to your OAuth client metadata JSON file.');
56
+ }
57
+ if (!jwksUri) {
58
+ throw new Error('TEST_JWKS_URI must be set for confidential clients. ' +
59
+ 'This should be a publicly accessible URL to your JWKS JSON file.');
60
+ }
61
+ return {
62
+ clientMetadataUri,
63
+ clientId: clientId,
64
+ jwksUri: jwksUri,
65
+ scope: process.env.TEST_SCOPE || 'atproto transition:generic',
66
+ tokenEndpointAuthMethod: 'private_key_jwt',
67
+ };
68
+ }
69
+ /**
70
+ * Check if integration tests should run
71
+ */
72
+ export function shouldRunIntegrationTests() {
73
+ return !!(process.env.TEST_BLUESKY_HANDLE &&
74
+ process.env.TEST_BLUESKY_DID &&
75
+ process.env.TEST_CLIENT_METADATA_URI);
76
+ }
77
+ /**
78
+ * Get test redirect URI
79
+ */
80
+ export function getTestRedirectUri() {
81
+ return (process.env.TEST_REDIRECT_URI ||
82
+ process.env.PUBLIC_URL + '/oauth/callback' ||
83
+ 'https://example.com/oauth/callback');
84
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Real Account Integration Tests
3
+ *
4
+ * These tests require:
5
+ * 1. A real Bluesky test account
6
+ * 2. Publicly accessible client metadata and JWKS
7
+ * 3. Environment variables configured (see INTEGRATION_TESTING.md)
8
+ *
9
+ * These tests are skipped if TEST_BLUESKY_HANDLE is not set.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=real-account.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"real-account.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/real-account.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}