Skip to content

Commit

Permalink
Merge branch 'tim/new_verif_method_oidc' into 'master'
Browse files Browse the repository at this point in the history
feat: Upgrade verif method with new OIDC provider fields (BREAKING)

See merge request TankerHQ/sdk-js!986
  • Loading branch information
tux3 committed Sep 19, 2023
2 parents a74318b + 3c03e61 commit 0d8cfd5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/LocalUser/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ export class LocalUserManager extends EventEmitter {
return { type: 'passphrase' };
}
case 'oidc_id_token': {
return { type: 'oidcIdToken' };
const providerId = method.provider_id;
const providerDisplayName = method.provider_display_name;
return { type: 'oidcIdToken', providerId, providerDisplayName };
}
case 'phone_number': {
const encryptedPhoneNumber = utils.fromBase64(method.encrypted_phone_number);
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/LocalUser/SessionCertificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ function verificationToVerificationMethod(verification: VerificationWithToken):
if ('oidcIdToken' in verification)
return {
type: 'oidcIdToken',
// NOTE: We can't know these here, but we also don't need them for session certificates
providerId: '',
providerDisplayName: '',
};
if ('e2ePassphrase' in verification)
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/LocalUser/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type EmailVerificationMethod = { type: 'email'; email: string; };
export type PassphraseVerificationMethod = { type: 'passphrase'; };
export type E2ePassphraseVerificationMethod = { type: 'e2ePassphrase'; };
export type KeyVerificationMethod = { type: 'verificationKey'; };
export type OidcVerificationMethod = { type: 'oidcIdToken'; };
export type OidcVerificationMethod = { type: 'oidcIdToken'; providerId: string; providerDisplayName: string; };
export type PhoneNumberVerificationMethod = { type: 'phoneNumber'; phoneNumber: string; };
export type PreverifiedEmailVerificationMethod = { type: 'preverifiedEmail'; preverifiedEmail: string; };
export type PreverifiedPhoneNumberVerificationMethod = { type: 'preverifiedPhoneNumber'; preverifiedPhoneNumber: string; };
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Network/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type VerificationMethodResponse = Array<(
| { type: 'phone_number'; encrypted_phone_number: string; is_preverified: boolean; }
| { type: 'passphrase'; }
| { type: 'e2e_passphrase'; }
| { type: 'oidc_id_token'; }
| { type: 'oidc_id_token'; provider_id: string; provider_display_name: string; }
)>;

export type E2eVerificationKeyResponse = {
Expand Down

0 comments on commit 0d8cfd5

Please sign in to comment.