latchkey 0.1.0 → 0.1.2

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 (42) hide show
  1. package/package.json +8 -8
  2. package/.nvmrc +0 -1
  3. package/.pre-commit-config.yaml +0 -22
  4. package/.prettierignore +0 -4
  5. package/.prettierrc +0 -7
  6. package/CLAUDE.md +0 -13
  7. package/docs/development.md +0 -94
  8. package/eslint.config.js +0 -30
  9. package/integrations/SKILL.md +0 -62
  10. package/scripts/cryptFile.ts +0 -123
  11. package/scripts/recordBrowserSession.ts +0 -280
  12. package/scripts/tsconfig.json +0 -10
  13. package/src/apiCredentialStore.ts +0 -87
  14. package/src/apiCredentials.ts +0 -180
  15. package/src/cli.ts +0 -32
  16. package/src/cliCommands.ts +0 -321
  17. package/src/config.ts +0 -115
  18. package/src/curl.ts +0 -78
  19. package/src/encryptedStorage.ts +0 -161
  20. package/src/encryption.ts +0 -106
  21. package/src/index.ts +0 -65
  22. package/src/keychain.ts +0 -105
  23. package/src/playwrightUtils.ts +0 -143
  24. package/src/registry.ts +0 -35
  25. package/src/services/base.ts +0 -234
  26. package/src/services/discord.ts +0 -73
  27. package/src/services/dropbox.ts +0 -173
  28. package/src/services/github.ts +0 -139
  29. package/src/services/index.ts +0 -13
  30. package/src/services/linear.ts +0 -134
  31. package/src/services/slack.ts +0 -85
  32. package/tests/apiCredentialStore.test.ts +0 -162
  33. package/tests/apiCredentials.test.ts +0 -195
  34. package/tests/cli.test.ts +0 -798
  35. package/tests/encryptedStorage.test.ts +0 -173
  36. package/tests/encryption.test.ts +0 -169
  37. package/tests/lint.test.ts +0 -19
  38. package/tests/registry.test.ts +0 -103
  39. package/tests/servicesAgainstRecordings.test.ts +0 -230
  40. package/tests/typecheck.test.ts +0 -19
  41. package/tsconfig.json +0 -24
  42. package/vitest.config.ts +0 -13
@@ -1,195 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import {
3
- AuthorizationBearer,
4
- AuthorizationBare,
5
- SlackApiCredentials,
6
- deserializeCredentials,
7
- serializeCredentials,
8
- ApiCredentialsSchema,
9
- } from '../src/apiCredentials.js';
10
-
11
- describe('AuthorizationBearer', () => {
12
- it('should generate correct curl arguments', () => {
13
- const credentials = new AuthorizationBearer('test-token-123');
14
- expect(credentials.asCurlArguments()).toEqual(['-H', 'Authorization: Bearer test-token-123']);
15
- });
16
-
17
- it('should serialize to JSON', () => {
18
- const credentials = new AuthorizationBearer('test-token-123');
19
- expect(credentials.toJSON()).toEqual({
20
- objectType: 'authorizationBearer',
21
- token: 'test-token-123',
22
- });
23
- });
24
-
25
- it('should deserialize from JSON', () => {
26
- const data = {
27
- objectType: 'authorizationBearer' as const,
28
- token: 'test-token-123',
29
- };
30
- const credentials = AuthorizationBearer.fromJSON(data);
31
- expect(credentials.token).toBe('test-token-123');
32
- });
33
- });
34
-
35
- describe('AuthorizationBare', () => {
36
- it('should generate correct curl arguments', () => {
37
- const credentials = new AuthorizationBare('raw-token-456');
38
- expect(credentials.asCurlArguments()).toEqual(['-H', 'Authorization: raw-token-456']);
39
- });
40
-
41
- it('should serialize to JSON', () => {
42
- const credentials = new AuthorizationBare('raw-token-456');
43
- expect(credentials.toJSON()).toEqual({
44
- objectType: 'authorizationBare',
45
- token: 'raw-token-456',
46
- });
47
- });
48
-
49
- it('should deserialize from JSON', () => {
50
- const data = {
51
- objectType: 'authorizationBare' as const,
52
- token: 'raw-token-456',
53
- };
54
- const credentials = AuthorizationBare.fromJSON(data);
55
- expect(credentials.token).toBe('raw-token-456');
56
- });
57
- });
58
-
59
- describe('SlackApiCredentials', () => {
60
- it('should generate correct curl arguments with token and cookie', () => {
61
- const credentials = new SlackApiCredentials('xoxc-token', 'd-cookie-value');
62
- expect(credentials.asCurlArguments()).toEqual([
63
- '-H',
64
- 'Authorization: Bearer xoxc-token',
65
- '-H',
66
- 'Cookie: d=d-cookie-value',
67
- ]);
68
- });
69
-
70
- it('should serialize to JSON', () => {
71
- const credentials = new SlackApiCredentials('xoxc-token', 'd-cookie-value');
72
- expect(credentials.toJSON()).toEqual({
73
- objectType: 'slack',
74
- token: 'xoxc-token',
75
- dCookie: 'd-cookie-value',
76
- });
77
- });
78
-
79
- it('should deserialize from JSON', () => {
80
- const data = {
81
- objectType: 'slack' as const,
82
- token: 'xoxc-token',
83
- dCookie: 'd-cookie-value',
84
- };
85
- const credentials = SlackApiCredentials.fromJSON(data);
86
- expect(credentials.token).toBe('xoxc-token');
87
- expect(credentials.dCookie).toBe('d-cookie-value');
88
- });
89
- });
90
-
91
- describe('deserializeCredentials', () => {
92
- it('should deserialize AuthorizationBearer', () => {
93
- const data = {
94
- objectType: 'authorizationBearer' as const,
95
- token: 'bearer-token',
96
- };
97
- const credentials = deserializeCredentials(data);
98
- expect(credentials).toBeInstanceOf(AuthorizationBearer);
99
- expect((credentials as AuthorizationBearer).token).toBe('bearer-token');
100
- });
101
-
102
- it('should deserialize AuthorizationBare', () => {
103
- const data = {
104
- objectType: 'authorizationBare' as const,
105
- token: 'bare-token',
106
- };
107
- const credentials = deserializeCredentials(data);
108
- expect(credentials).toBeInstanceOf(AuthorizationBare);
109
- expect((credentials as AuthorizationBare).token).toBe('bare-token');
110
- });
111
-
112
- it('should deserialize SlackApiCredentials', () => {
113
- const data = {
114
- objectType: 'slack' as const,
115
- token: 'slack-token',
116
- dCookie: 'slack-cookie',
117
- };
118
- const credentials = deserializeCredentials(data);
119
- expect(credentials).toBeInstanceOf(SlackApiCredentials);
120
- expect((credentials as SlackApiCredentials).token).toBe('slack-token');
121
- expect((credentials as SlackApiCredentials).dCookie).toBe('slack-cookie');
122
- });
123
- });
124
-
125
- describe('serializeCredentials', () => {
126
- it('should serialize AuthorizationBearer', () => {
127
- const credentials = new AuthorizationBearer('test-token');
128
- const data = serializeCredentials(credentials);
129
- expect(data).toEqual({
130
- objectType: 'authorizationBearer',
131
- token: 'test-token',
132
- });
133
- });
134
-
135
- it('should serialize AuthorizationBare', () => {
136
- const credentials = new AuthorizationBare('test-token');
137
- const data = serializeCredentials(credentials);
138
- expect(data).toEqual({
139
- objectType: 'authorizationBare',
140
- token: 'test-token',
141
- });
142
- });
143
-
144
- it('should serialize SlackApiCredentials', () => {
145
- const credentials = new SlackApiCredentials('token', 'cookie');
146
- const data = serializeCredentials(credentials);
147
- expect(data).toEqual({
148
- objectType: 'slack',
149
- token: 'token',
150
- dCookie: 'cookie',
151
- });
152
- });
153
- });
154
-
155
- describe('ApiCredentialsSchema', () => {
156
- it('should validate AuthorizationBearer', () => {
157
- const result = ApiCredentialsSchema.safeParse({
158
- objectType: 'authorizationBearer',
159
- token: 'test',
160
- });
161
- expect(result.success).toBe(true);
162
- });
163
-
164
- it('should validate AuthorizationBare', () => {
165
- const result = ApiCredentialsSchema.safeParse({
166
- objectType: 'authorizationBare',
167
- token: 'test',
168
- });
169
- expect(result.success).toBe(true);
170
- });
171
-
172
- it('should validate SlackApiCredentials', () => {
173
- const result = ApiCredentialsSchema.safeParse({
174
- objectType: 'slack',
175
- token: 'test',
176
- dCookie: 'cookie',
177
- });
178
- expect(result.success).toBe(true);
179
- });
180
-
181
- it('should reject invalid object type', () => {
182
- const result = ApiCredentialsSchema.safeParse({
183
- objectType: 'invalid',
184
- token: 'test',
185
- });
186
- expect(result.success).toBe(false);
187
- });
188
-
189
- it('should reject missing token', () => {
190
- const result = ApiCredentialsSchema.safeParse({
191
- objectType: 'authorizationBearer',
192
- });
193
- expect(result.success).toBe(false);
194
- });
195
- });