Skip to content

Commit

Permalink
pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
niftyvictor committed Oct 21, 2024
1 parent fbbed56 commit 64a4a6b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 34 deletions.
3 changes: 0 additions & 3 deletions lib/ts/recipe/multitenancy/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ export type APIInterface = {
passwordless: {
enabled: boolean;
};
webauthn: {
credentialIds: string[];
};
firstFactors: string[];
}
| GeneralErrorResponse
Expand Down
69 changes: 38 additions & 31 deletions lib/ts/recipe/webauthn/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ type ConsumeRecoverAccountTokenErrorResponse =
| RegisterCredentialErrorResponse
| { status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR" };

type AddCredentialErrorResponse = RegisterCredentialErrorResponse;

type RemoveCredentialErrorResponse = { status: "CREDENTIAL_NOT_FOUND_ERROR" };

export type RecipeInterface = {
Expand Down Expand Up @@ -390,44 +388,27 @@ export type RecipeInterface = {
userContext: UserContext;
}): Promise<{ status: "OK"; user: User; recipeUserId: RecipeUserId } | GetUserFromRecoverAccountTokenErrorResponse>;

// credentials CRUD

// this will call registerCredential internally
addCredential(input: {
webauthnGeneratedOptionsId: string;
credential: {
id: string;
rawId: string;
response: {
clientDataJSON: string;
attestationObject: string;
transports?: ("ble" | "cable" | "hybrid" | "internal" | "nfc" | "smart-card" | "usb")[];
userHandle: string;
};
authenticatorAttachment: "platform" | "cross-platform";
clientExtensionResults: Record<string, unknown>;
type: "public-key";
};
tenantId: string;
userContext: UserContext;
}): Promise<
| {
status: "OK";
}
| AddCredentialErrorResponse
>;

// credentials CRUD
removeCredential(input: {
webauthnCredentialId: string;
tenantId: string;
userContext: UserContext;
}): Promise<
| {
status: "OK";
}
| RemoveCredentialErrorResponse
>;

listCredentials(input: {
userContext: UserContext;
}): Promise<{
status: "OK";
credentials: {
id: string;
rp_id: string;
created_at: number;
}[];
}>;
};

export type APIOptions = {
Expand Down Expand Up @@ -478,14 +459,20 @@ type AddCredentialPOSTErrorResponse =
status: "ADD_CREDENTIAL_NOT_ALLOWED";
reason: string;
}
| AddCredentialErrorResponse;
| RegisterCredentialErrorResponse;

type RemoveCredentialPOSTErrorResponse =
| {
status: "REMOVE_CREDENTIAL_NOT_ALLOWED";
reason: string;
}
| RemoveCredentialErrorResponse;

type ListCredentialsPOSTErrorResponse = {
status: "LIST_CREDENTIALS_NOT_ALLOWED";
reason: string;
};

export type APIInterface = {
registerOptionsPOST:
| undefined
Expand Down Expand Up @@ -719,6 +706,26 @@ export type APIInterface = {
| RemoveCredentialPOSTErrorResponse
| GeneralErrorResponse
>);

listCredentialsPOST:
| undefined
| ((input: {
tenantId: string;
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
credentials: {
id: string;
rp_id: string;
created_at: number;
}[];
}
| ListCredentialsPOSTErrorResponse
| GeneralErrorResponse
>);
};

export type TypeWebauthnRecoverAccountEmailDeliveryInput = {
Expand Down

0 comments on commit 64a4a6b

Please sign in to comment.