-
Notifications
You must be signed in to change notification settings - Fork 15
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
Merging Process #1 from sd-jwt-ts #60
Conversation
…e64url-encoded. (openwallet-foundation#57)" This reverts commit 025786b. Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
@@ -33,11 +33,13 @@ | |||
"@types/jest": "^29.5.11", | |||
"@types/node": "^20.10.2", | |||
"jest": "^29.7.0", | |||
"jose": "^5.1.3", |
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.
jose is here for testing purpose
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.
It's devdependencies
export type Signer = (data: string) => OrPromise<string>; | ||
export type Verifier = (data: string, sig: string) => OrPromise<boolean>; | ||
export type Hasher = (data: string) => Promise<string>; | ||
export type SaltGenerator = (length: number) => string; | ||
export type Hasher = (data: string, alg: string) => OrPromise<Uint8Array>; | ||
export type SaltGenerator = (length: number) => OrPromise<string>; | ||
export type HasherAndAlg = { | ||
hasher: Hasher; | ||
alg: string; | ||
}; |
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.
Mostly I followed the type from sd-jwt-ts
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
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.
Have to get a bit more familiar with the code base but these seem like good changes! Some minor code style comments only.
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.3.2" | ||
}, | ||
"dependencies": { | ||
"jose": "^5.1.3" | ||
"@noble/hashes": "1.0.0", | ||
"js-base64": "^3.7.6" |
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.
nice! Better solution IMO compared to using buffer
.
src/base64url.ts
Outdated
const decode = (input: string): string => { | ||
return Base64.decode(input); | ||
}; |
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.
const decode = (input: string): string => { | |
return Base64.decode(input); | |
}; | |
const decode = (input: string): string => Base64.decode(input); |
Can also do const decode = Base64.decode;
but there might be some overloading that we do not want to re-expose.
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.
That's right. But this was created for consistency in case anyone gets confused with base64.
I think it can be reduced a bit by not wrapping it in a Base64Url
object. Please check the change and tell me what you think :) @berendsliedrecht
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.
Fix looks good!
src/index.ts
Outdated
if (!this.userConfig.kbSigner) { | ||
throw new SDJWTException('Key Binding Signer not found'); | ||
} | ||
if (!this.userConfig.kb_sign_alg) { |
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.
Why is the casing of this.userConfig.kb_sign_alg
different?
src/index.ts
Outdated
throw new SDJWTException('SaltGenerator not found'); | ||
} | ||
|
||
if (!this.userConfig.sign_alg) { |
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.
Same here re the casing.
disclosureFrame?: DisclosureFrame<T>, | ||
hasher: Hasher = hash, | ||
saltGenerator: SaltGenerator = generateSalt, | ||
disclosureFrame: DisclosureFrame<T> | undefined, |
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.
disclosureFrame: DisclosureFrame<T> | undefined, | |
disclosureFrame?: DisclosureFrame<T>, |
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.
It can't be optional because its not the last parameter.
Signed-off-by: Lukas <Lukas@hopae.io>
Signed-off-by: Lukas <Lukas@hopae.io>
in sha256 function the text to uint8array method only works in ASCII char. we should find another way to convert. |
Signed-off-by: Lukas <Lukas@hopae.io>
I fixed the issue |
expect(s1).toStrictEqual(s2); | ||
}); | ||
|
||
test('test#13', async () => { |
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.
Isn't this a duplicate test with test#14?
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.
Yes It's dup. my mistake
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.
@berendsliedrecht removed.
Signed-off-by: Lukas <Lukas@hopae.io>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com> Signed-off-by: Lukas <Lukas@hopae.io> Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com> Signed-off-by: Lukas <Lukas@hopae.io> Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
I'm working on merging with https://github.com/berendsliedrecht/sd-jwt-ts which is berend's work.
Due to the huge PR, I'm going to add sd-jwt-vc & splitting into multiple package in next PR.
What's included