Skip to content

Commit

Permalink
build: Added deep pass-through options on verification actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Eengineer1 committed Dec 30, 2023
1 parent 455fbe8 commit 2d85323
Show file tree
Hide file tree
Showing 3 changed files with 761 additions and 297 deletions.
23 changes: 15 additions & 8 deletions packages/node/src/SDJwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ export class SDJwt extends Object {
/**
* Verify SD-JWT by checking the signature and matching the disclosures against the digests in the payload.
* @param jwtCryptoProvider synchronous JWT crypto provider to use for signature verification, that implements standard JWT signing and verification.
* @param options optional pass-through options.
*/
verify(jwtCryptoProvider: JWTCryptoProvider): VerificationResult<SDJwt> {
const jwtVerificationResult = jwtCryptoProvider.verify(this.jwt);
verify(jwtCryptoProvider: JWTCryptoProvider, options?: any): VerificationResult<SDJwt> {
const jwtVerificationResult = jwtCryptoProvider.verify(this.jwt, options);
return defaultVerificationResult(
this,
jwtVerificationResult.verified,
Expand All @@ -123,9 +124,10 @@ export class SDJwt extends Object {
/**
* Verify SD-JWT by checking the signature and matching the disclosures against the digests in the payload.
* @param jwtCryptoProvider asynchronous JWT crypto provider to use for signature verification, that implements standard JWT signing and verification.
* @param options optional pass-through options.
*/
async verifyAsync(jwtCryptoProvider: AsyncJWTCryptoProvider): Promise<VerificationResult<SDJwt>> {
const jwtVerificationResult = await jwtCryptoProvider.verifyAsync(this.jwt);
async verifyAsync(jwtCryptoProvider: AsyncJWTCryptoProvider, options?: any): Promise<VerificationResult<SDJwt>> {
const jwtVerificationResult = await jwtCryptoProvider.verifyAsync(this.jwt, options);

return defaultVerificationResult(
this,
Expand Down Expand Up @@ -156,21 +158,24 @@ export class SDJwt extends Object {
* Parse SD-JWT from string and verify it.
* @param sdJwt SD-JWT string to parse and verify.
* @param jwtCryptoProvider synchronous JWT crypto provider to use for signature verification, that implements standard JWT signing and verification.
* @param options optional pass-through options.
*/
static parseAndVerify(sdJwt: string, jwtCryptoProvider: JWTCryptoProvider): VerificationResult<SDJwt> {
return SDJwt.parse(sdJwt).verify(jwtCryptoProvider);
static parseAndVerify(sdJwt: string, jwtCryptoProvider: JWTCryptoProvider, options?: any): VerificationResult<SDJwt> {
return SDJwt.parse(sdJwt).verify(jwtCryptoProvider, options);
}

/**
* Parse SD-JWT from string and verify it.
* @param sdJwt SD-JWT string to parse and verify.
* @param jwtCryptoProvider asynchronous JWT crypto provider to use for signature verification, that implements standard JWT signing and verification.
* @param options optional pass-through options.
*/
static async parseAndVerifyAsync(
sdJwt: string,
jwtCryptoProvider: AsyncJWTCryptoProvider
jwtCryptoProvider: AsyncJWTCryptoProvider,
options?: any
): Promise<VerificationResult<SDJwt>> {
return await SDJwt.parse(sdJwt).verifyAsync(jwtCryptoProvider);
return await SDJwt.parse(sdJwt).verifyAsync(jwtCryptoProvider, options);
}

private static createFromSignedJWT(signedJwt: string, sdPayload: SDPayload, withHolderJwt?: string | null): SDJwt {
Expand All @@ -184,6 +189,7 @@ export class SDJwt extends Object {
* @param jwtCryptoProvider synchronous JWT crypto provider to use for signing, that implements standard JWT signing and verification.
* @param keyId optional key ID of the signing key to be used, if required by the underlying crypto library.
* @param withHolderJwt optional holder JWT as holder binding to include in the SD-JWT.
* @param options optional pass-through options.
*/
static sign(
sdPayload: SDPayload,
Expand All @@ -206,6 +212,7 @@ export class SDJwt extends Object {
* @param jwtCryptoProvider asynchronous JWT crypto provider to use for signing, that implements standard JWT signing and verification.
* @param keyId optional key ID of the signing key to be used, if required by the underlying crypto library.
* @param withHolderJwt optional holder JWT as holder binding to include in the SD-JWT.
* @param options optional pass-through options.
*/
static async signAsync(
sdPayload: SDPayload,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

# [1.0.0-develop.3](https://github.com/Eengineer1/sd-jwt-ts/compare/@eengineer1/sd-jwt-ts-react-native@1.0.0-develop.2...@eengineer1/sd-jwt-ts-react-native@1.0.0-develop.3) (2023-12-27)
## [1.0.0-develop.3](https://github.com/Eengineer1/sd-jwt-ts/compare/@eengineer1/sd-jwt-ts-react-native@1.0.0-develop.2...@eengineer1/sd-jwt-ts-react-native@1.0.0-develop.3) (2023-12-27)

## [1.0.0-develop.2](https://github.com/Eengineer1/sd-jwt-ts/compare/@eengineer1/sd-jwt-ts-react-native@1.0.0-develop.1...@eengineer1/sd-jwt-ts-react-native@1.0.0-develop.2) (2023-12-05)

Expand Down
Loading

0 comments on commit 2d85323

Please sign in to comment.