-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* porting over changes related to jwt creation/verification in pr 122 * fixing rfq creation in client.spec.ts per protocol changes * using devtools in client.spec.ts * using devtools for tests * adding changeset * removing todos waiting on a merged PR * removing some stale / irrelevant todos * removing unused error from index import. changed DevTools.getOffering() to allow passing in of offering creator did * removing an error import * removing a test that is no longer needed * updating tbdex submodule commit pointer to latest in main Co-authored-by: Moe Jangda <[email protected]>
- Loading branch information
Showing
9 changed files
with
344 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@tbdex/http-client": minor | ||
"@tbdex/http-server": minor | ||
--- | ||
|
||
JWT creation and verification |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { RequestError } from './request-error.js' | ||
export { ResponseError } from './response-error.js' | ||
export { ValidationError, InvalidDidError, MissingServiceEndpointError } from './validation-error.js' | ||
export { ValidationError, InvalidDidError, MissingServiceEndpointError } from './validation-error.js' | ||
export { RequestTokenError, RequestTokenSigningError, RequestTokenVerificationError, RequestTokenMissingClaimsError, RequestTokenAudienceMismatchError } from './request-token-error.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// TODO: decide whether this should be a ValidationError | ||
|
||
export type RequestTokenErrorParams = { | ||
message: string | ||
cause?: unknown | ||
} | ||
|
||
/** | ||
* Error thrown for request token related things | ||
* @beta | ||
*/ | ||
export class RequestTokenError extends Error { | ||
constructor(params: RequestTokenErrorParams) { | ||
super(params.message, { cause: params.cause }) | ||
|
||
this.name = this.constructor.name | ||
|
||
Object.setPrototypeOf(this, RequestTokenError.prototype) | ||
} | ||
} | ||
|
||
/** | ||
* Error thrown when a request token cannot be signed | ||
* @beta | ||
*/ | ||
export class RequestTokenSigningError extends RequestTokenError { | ||
constructor(params: RequestTokenErrorParams) { | ||
super(params) | ||
|
||
Object.setPrototypeOf(this, RequestTokenSigningError.prototype) | ||
} | ||
} | ||
|
||
/** | ||
* Error thrown when a request token cannot be verified | ||
* @beta | ||
*/ | ||
export class RequestTokenVerificationError extends RequestTokenError { | ||
constructor(params: RequestTokenErrorParams) { | ||
super(params) | ||
|
||
Object.setPrototypeOf(this, RequestTokenVerificationError.prototype) | ||
} | ||
} | ||
|
||
/** | ||
* Error thrown when a request token is missing required claims | ||
* @beta | ||
*/ | ||
export class RequestTokenMissingClaimsError extends RequestTokenError { | ||
constructor(params: RequestTokenErrorParams) { | ||
super(params) | ||
|
||
Object.setPrototypeOf(this, RequestTokenMissingClaimsError.prototype) | ||
} | ||
} | ||
|
||
/** | ||
* Error thrown when a request token aud does not match the PFI did for which its intended | ||
* @beta | ||
*/ | ||
export class RequestTokenAudienceMismatchError extends RequestTokenError { | ||
constructor(params: RequestTokenErrorParams) { | ||
super(params) | ||
|
||
Object.setPrototypeOf(this, RequestTokenAudienceMismatchError.prototype) | ||
} | ||
} |
Oops, something went wrong.