-
Notifications
You must be signed in to change notification settings - Fork 19
feat: add experimental vcld implementation #317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Lukas.J.Han <[email protected]>
Signed-off-by: Lukas.J.Han <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an experimental implementation of SD-JWT VCLD (Verifiable Credentials with JSON-LD), which extends IETF SD-JWT VC to incorporate Linked Data models while enabling selective disclosure capabilities.
- Implements a complete SD-JWT VCLD library including signing, verification, presentation, and decoding functionality
- Provides support for multiple cryptographic algorithms (RSA, ECDSA, EdDSA) with proper signature verification
- Includes comprehensive test coverage for the signing and decoding operations
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
packages/vcld/package.json | Package configuration with dependencies and build scripts |
packages/vcld/README.md | Documentation and installation instructions |
packages/vcld/tsconfig.json | TypeScript configuration extending project defaults |
packages/vcld/vitest.config.mts | Test configuration setup |
packages/vcld/src/index.ts | Main entry point exporting the VCld API with detailed specification comments |
packages/vcld/src/type.ts | Algorithm definitions and type declarations for supported cryptographic algorithms |
packages/vcld/src/sign.ts | Core signing functionality with Signer class and JWT creation logic |
packages/vcld/src/verify.ts | JWT verification implementation with x5c certificate chain validation |
packages/vcld/src/present.ts | Presentation functionality for selective disclosure |
packages/vcld/src/test/index.spec.ts | Basic test placeholder |
packages/vcld/src/test/sign.spec.ts | Comprehensive tests for signing and decoding functionality |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -0,0 +1,4 @@ | |||
// vite.config.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment refers to 'vite.config.ts' but the file is named 'vitest.config.mts'. This should be corrected to match the actual filename.
// vite.config.ts | |
// vitest.config.mts |
Copilot uses AI. Check for mistakes.
createEdDSASignature( | ||
signingInput: string, | ||
privateKey: KeyObject, | ||
options: { curves: string[] }, | ||
) { | ||
const signer = createSign(options.curves[0]); | ||
signer.update(signingInput); | ||
const signature = signer.sign({ | ||
key: privateKey, | ||
}); | ||
return signature.toString('base64url'); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The EdDSA signature creation incorrectly uses options.curves[0]
as the hash algorithm in createSign()
. For EdDSA, the algorithm should be 'ed25519' or 'ed448' directly, not used as a hash. EdDSA doesn't use a separate hash algorithm parameter.
Copilot uses AI. Check for mistakes.
): boolean { | ||
try { | ||
if (!x5c || x5c.length === 0) { | ||
console.error('x5c certificate chain is missing'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using console.error
for error logging in a library is not recommended. Consider using a proper logging framework or throwing an error that can be handled by the consuming application.
Copilot uses AI. Check for mistakes.
|
||
return verifier.verify(publicKey, signatureUint8Array); | ||
} catch (error) { | ||
console.error('JWT verification error:', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using console.error
for error logging in a library is not recommended. Consider using a proper logging framework or throwing an error that can be handled by the consuming application.
Copilot uses AI. Check for mistakes.
No description provided.