Skip to content

Commit

Permalink
fix: set userPin back to fix current implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Mirko Mollik <[email protected]>
  • Loading branch information
cre8 committed Jul 16, 2024
1 parent e264b44 commit 43e7988
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/common/lib/types/StateManager.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export interface CredentialOfferSession extends StateType {
clientId?: string;
credentialOffer: AssertedUniformCredentialOffer;
credentialDataSupplierInput?: CredentialDataSupplierInput; // Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on
txCode?: string; // in here we only store the txCode, previously < V13 this was the userPin. We map the userPin onto this value
//txCode?: string; // in here we only store the txCode, previously < V13 this was the userPin. We map the userPin onto this value
userPin?: string; // in here we only store the userPin, previously < V13 this was the txCode. We map the txCode onto this value
status: IssueStatus;
error?: string;
lastUpdatedAt: number;
Expand Down
4 changes: 2 additions & 2 deletions packages/issuer/lib/tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ export const assertValidAccessTokenRequest = async (
throw new TokenError(400, TokenErrorResponse.invalid_grant, `${PIN_VALIDATION_ERROR} ${txCodeOffer.length}`)
}
}
if (request.tx_code !== credentialOfferSession.txCode) {
if (request.tx_code !== credentialOfferSession.userPin) {
throw new TokenError(400, TokenErrorResponse.invalid_grant, PIN_NOT_MATCH_ERROR)
}
} else if (request.user_pin) {
if (!/[\\d]{1,8}/.test(request.user_pin)) {
throw new TokenError(400, TokenErrorResponse.invalid_grant, `${PIN_VALIDATION_ERROR} 1-8`)
} else if (request.user_pin !== credentialOfferSession.txCode) {
} else if (request.user_pin !== credentialOfferSession.userPin) {
throw new TokenError(400, TokenErrorResponse.invalid_grant, PIN_NOT_MATCH_ERROR)
}
}
Expand Down

0 comments on commit 43e7988

Please sign in to comment.