Skip to content

Commit

Permalink
chore: Add a default clientId
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Feb 7, 2024
1 parent 3684b1e commit 6ddf9b0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/client/lib/OpenID4VCIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ export class OpenID4VCIClient {
this._credentialIssuer = issuer;
this._kid = kid;
this._alg = alg;
this._clientId = clientId ?? (credentialOffer ? getClientIdFromCredentialOfferPayload(credentialOffer.credential_offer) : undefined);
// TODO: We need to refactor this and always explicitly call createAuthorizationRequestUrl, so we can have a credential selection first and use the kid as a default for the client id
this._clientId =
clientId ??
(credentialOffer && getClientIdFromCredentialOfferPayload(credentialOffer.credential_offer)) ??
kid?.split('#')[0] ??
'com.sphereon.ssi.wallet';
this._pkce = { ...this._pkce, ...pkce };
this._authorizationRequestOpts = this.syncAuthorizationRequestOpts(authorizationRequest);
console.log(`Authorization req options: ${JSON.stringify(this._authorizationRequestOpts, null, 2)}`);
Expand Down Expand Up @@ -548,6 +553,7 @@ export class OpenID4VCIClient {
authorizationRequestOpts = { redirectUri: `${DefaultURISchemes.CREDENTIAL_OFFER}://` };
}
const clientId = authorizationRequestOpts.clientId ?? this._clientId;
// sync clientId
this._clientId = clientId;
authorizationRequestOpts.clientId = clientId;
return authorizationRequestOpts;
Expand Down

0 comments on commit 6ddf9b0

Please sign in to comment.