feat(pq-jws/ts): phase 1 - define public contracts (ENG-1640)#18
feat(pq-jws/ts): phase 1 - define public contracts (ENG-1640)#18
Conversation
|
@codex review |
Greptile SummaryThis PR establishes the TypeScript type contracts and function signatures for the Key changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
Class Diagram%%{init: {'theme': 'neutral'}}%%
classDiagram
class JwsProtectedHeader {
+string alg
+string? kid
+string? typ
+string? cty
+string[]? crit
+boolean? b64
}
class CompactJwsSegments {
+string protectedHeader
+string payload
+string signature
}
class ParsedCompactJws {
+string compact
+CompactJwsSegments segments
+JwsProtectedHeader protectedHeader
+string encodedProtectedHeader
+string encodedPayload
+Uint8Array payload
+Uint8Array signature
+Uint8Array signingInput
}
class JwsSignerContext {
+JwsProtectedHeader protectedHeader
+Uint8Array payload
+string encodedProtectedHeader
+string encodedPayload
}
class JwsVerifierContext {
Extends JwsSignerContext
}
class SignJwsCompactInput {
+JwsProtectedHeader protectedHeader
+Uint8Array|string payload
+JwsSigner signer
}
class JwsError {
+string name
+string message
}
class JwsFormatError {
Extends JwsError
}
class JwsValidationError {
Extends JwsError
}
ParsedCompactJws --> CompactJwsSegments
ParsedCompactJws --> JwsProtectedHeader
SignJwsCompactInput --> JwsProtectedHeader
JwsSignerContext --> JwsProtectedHeader
JwsVerifierContext --|> JwsSignerContext
JwsFormatError --|> JwsError
JwsValidationError --|> JwsError
Last reviewed commit: 04a7709 |
| export interface JwsProtectedHeader { | ||
| alg: string; | ||
| kid?: string; | ||
| typ?: string; | ||
| cty?: string; | ||
| crit?: string[]; | ||
| b64?: boolean; | ||
| [name: string]: unknown; | ||
| } |
There was a problem hiding this comment.
Use type instead of interface per project convention. These definitions don't use interface-specific features like extension or implementation.
| export interface JwsProtectedHeader { | |
| alg: string; | |
| kid?: string; | |
| typ?: string; | |
| cty?: string; | |
| crit?: string[]; | |
| b64?: boolean; | |
| [name: string]: unknown; | |
| } | |
| export type JwsProtectedHeader = { | |
| alg: string; | |
| kid?: string; | |
| typ?: string; | |
| cty?: string; | |
| crit?: string[]; | |
| b64?: boolean; | |
| [name: string]: unknown; | |
| }; |
Context Used: Rule from dashboard - Use type by default in TypeScript unless you specifically need interface features like extension... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/pq-jws/ts/src/types.ts
Line: 1-9
Comment:
Use `type` instead of `interface` per project convention. These definitions don't use interface-specific features like extension or implementation.
```suggestion
export type JwsProtectedHeader = {
alg: string;
kid?: string;
typ?: string;
cty?: string;
crit?: string[];
b64?: boolean;
[name: string]: unknown;
};
```
**Context Used:** Rule from `dashboard` - Use `type` by default in TypeScript unless you specifically need `interface` features like extension... ([source](https://app.greptile.com/review/custom-context?memory=c862f053-5655-4b41-be69-c840e3c9f280))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| export interface CompactJwsSegments { | ||
| protectedHeader: string; | ||
| payload: string; | ||
| signature: string; | ||
| } |
There was a problem hiding this comment.
Use type instead of interface per project convention.
| export interface CompactJwsSegments { | |
| protectedHeader: string; | |
| payload: string; | |
| signature: string; | |
| } | |
| export type CompactJwsSegments = { | |
| protectedHeader: string; | |
| payload: string; | |
| signature: string; | |
| }; |
Context Used: Rule from dashboard - Use type by default in TypeScript unless you specifically need interface features like extension... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/pq-jws/ts/src/types.ts
Line: 11-15
Comment:
Use `type` instead of `interface` per project convention.
```suggestion
export type CompactJwsSegments = {
protectedHeader: string;
payload: string;
signature: string;
};
```
**Context Used:** Rule from `dashboard` - Use `type` by default in TypeScript unless you specifically need `interface` features like extension... ([source](https://app.greptile.com/review/custom-context?memory=c862f053-5655-4b41-be69-c840e3c9f280))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| export interface ParsedCompactJws { | ||
| compact: string; | ||
| segments: CompactJwsSegments; | ||
| protectedHeader: JwsProtectedHeader; | ||
| encodedProtectedHeader: string; | ||
| encodedPayload: string; | ||
| payload: Uint8Array; | ||
| signature: Uint8Array; | ||
| signingInput: Uint8Array; | ||
| } |
There was a problem hiding this comment.
Use type instead of interface per project convention.
| export interface ParsedCompactJws { | |
| compact: string; | |
| segments: CompactJwsSegments; | |
| protectedHeader: JwsProtectedHeader; | |
| encodedProtectedHeader: string; | |
| encodedPayload: string; | |
| payload: Uint8Array; | |
| signature: Uint8Array; | |
| signingInput: Uint8Array; | |
| } | |
| export type ParsedCompactJws = { | |
| compact: string; | |
| segments: CompactJwsSegments; | |
| protectedHeader: JwsProtectedHeader; | |
| encodedProtectedHeader: string; | |
| encodedPayload: string; | |
| payload: Uint8Array; | |
| signature: Uint8Array; | |
| signingInput: Uint8Array; | |
| }; |
Context Used: Rule from dashboard - Use type by default in TypeScript unless you specifically need interface features like extension... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/pq-jws/ts/src/types.ts
Line: 17-26
Comment:
Use `type` instead of `interface` per project convention.
```suggestion
export type ParsedCompactJws = {
compact: string;
segments: CompactJwsSegments;
protectedHeader: JwsProtectedHeader;
encodedProtectedHeader: string;
encodedPayload: string;
payload: Uint8Array;
signature: Uint8Array;
signingInput: Uint8Array;
};
```
**Context Used:** Rule from `dashboard` - Use `type` by default in TypeScript unless you specifically need `interface` features like extension... ([source](https://app.greptile.com/review/custom-context?memory=c862f053-5655-4b41-be69-c840e3c9f280))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| export interface JwsSignerContext { | ||
| protectedHeader: JwsProtectedHeader; | ||
| payload: Uint8Array; | ||
| encodedProtectedHeader: string; | ||
| encodedPayload: string; | ||
| } |
There was a problem hiding this comment.
Use type instead of interface per project convention.
| export interface JwsSignerContext { | |
| protectedHeader: JwsProtectedHeader; | |
| payload: Uint8Array; | |
| encodedProtectedHeader: string; | |
| encodedPayload: string; | |
| } | |
| export type JwsSignerContext = { | |
| protectedHeader: JwsProtectedHeader; | |
| payload: Uint8Array; | |
| encodedProtectedHeader: string; | |
| encodedPayload: string; | |
| }; |
Context Used: Rule from dashboard - Use type by default in TypeScript unless you specifically need interface features like extension... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/pq-jws/ts/src/types.ts
Line: 28-33
Comment:
Use `type` instead of `interface` per project convention.
```suggestion
export type JwsSignerContext = {
protectedHeader: JwsProtectedHeader;
payload: Uint8Array;
encodedProtectedHeader: string;
encodedPayload: string;
};
```
**Context Used:** Rule from `dashboard` - Use `type` by default in TypeScript unless you specifically need `interface` features like extension... ([source](https://app.greptile.com/review/custom-context?memory=c862f053-5655-4b41-be69-c840e3c9f280))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| encodedPayload: string; | ||
| } | ||
|
|
||
| export interface JwsVerifierContext extends JwsSignerContext {} |
There was a problem hiding this comment.
Since JwsVerifierContext is identical to JwsSignerContext, just use a type alias instead of interface extension.
| export interface JwsVerifierContext extends JwsSignerContext {} | |
| export type JwsVerifierContext = JwsSignerContext; |
Context Used: Rule from dashboard - Use type by default in TypeScript unless you specifically need interface features like extension... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/pq-jws/ts/src/types.ts
Line: 35
Comment:
Since `JwsVerifierContext` is identical to `JwsSignerContext`, just use a type alias instead of interface extension.
```suggestion
export type JwsVerifierContext = JwsSignerContext;
```
**Context Used:** Rule from `dashboard` - Use `type` by default in TypeScript unless you specifically need `interface` features like extension... ([source](https://app.greptile.com/review/custom-context?memory=c862f053-5655-4b41-be69-c840e3c9f280))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| export interface SignJwsCompactInput { | ||
| protectedHeader: JwsProtectedHeader; | ||
| payload: Uint8Array | string; | ||
| signer: JwsSigner; | ||
| } |
There was a problem hiding this comment.
Use type instead of interface per project convention.
| export interface SignJwsCompactInput { | |
| protectedHeader: JwsProtectedHeader; | |
| payload: Uint8Array | string; | |
| signer: JwsSigner; | |
| } | |
| export type SignJwsCompactInput = { | |
| protectedHeader: JwsProtectedHeader; | |
| payload: Uint8Array | string; | |
| signer: JwsSigner; | |
| }; |
Context Used: Rule from dashboard - Use type by default in TypeScript unless you specifically need interface features like extension... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/pq-jws/ts/src/types.ts
Line: 48-52
Comment:
Use `type` instead of `interface` per project convention.
```suggestion
export type SignJwsCompactInput = {
protectedHeader: JwsProtectedHeader;
payload: Uint8Array | string;
signer: JwsSigner;
};
```
**Context Used:** Rule from `dashboard` - Use `type` by default in TypeScript unless you specifically need `interface` features like extension... ([source](https://app.greptile.com/review/custom-context?memory=c862f053-5655-4b41-be69-c840e3c9f280))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| "dependencies": { | ||
| "pq-oid": "^1.0.1" | ||
| }, |
There was a problem hiding this comment.
The pq-oid dependency is added but not yet imported or used in any source files. Consider adding this dependency when it's actually needed in phase 2, or document why it's added now.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/pq-jws/ts/package.json
Line: 24-26
Comment:
The `pq-oid` dependency is added but not yet imported or used in any source files. Consider adding this dependency when it's actually needed in phase 2, or document why it's added now.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/pq-jws/ts/tsconfig.json
Line: 2-12
Comment:
Add `"composite": true` to enable proper TypeScript project references. This is required when using project references and allows other packages to reference this one.
```suggestion
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"declaration": true,
"composite": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
},
```
How can I resolve this? If you propose a fix, please make it concise. |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |

Summary
Package(s)
Languages
Checklist
biome check,cargo fmt)Related Issues