Skip to content

Commit 7101a87

Browse files
committed
resolve structural issues
1 parent 8c3ef69 commit 7101a87

File tree

1 file changed

+10
-38
lines changed
  • src/pages/[platform]/build-a-backend/auth/manage-users/manage-webauthn-credentials

1 file changed

+10
-38
lines changed

src/pages/[platform]/build-a-backend/auth/manage-users/manage-webauthn-credentials/index.mdx

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ You can associate a passkey using the following API:
4949
import { associateWebAuthnCredential} from 'aws-amplify/auth';
5050

5151
await associateWebAuthnCredential();
52+
5253
```
5354

5455
</InlineFilter>
@@ -105,34 +106,16 @@ You can list registered passkeys using the following API:
105106
```ts
106107
import { listWebAuthnCredentials } from 'aws-amplify/auth';
107108

108-
await listWebAuthnCredentials();
109-
```
110-
111-
The list passkeys API takes optional parameters `pageSize` and `nextToken` which may be used to paginate the list request.
112-
113-
The API returns a list of `AuthWebAuthnCredential` objects, which define the properties of a passkey, as well as a `nextToken` to be used in subsequent list requests.
114-
115-
```ts
116-
interface ListWebAuthnCredentialInput {
117-
pageSize?: number;
118-
nextToken?: string;
119-
}
109+
const result = await listWebAuthnCredentials();
120110

121-
interface ListWebAuthnCredentialOutput {
122-
credentials: AuthWebAuthnCredential[];
123-
nextToken?: string;
111+
for (const credential of result.credentials) {
112+
console.log(`Credential ID: ${credential.credentialId}`);
113+
console.log(`Friendly Name: ${credential.friendlyCredentialName}`);
114+
console.log(`Relying Party ID: ${credential.relyingPartyId}`);
115+
console.log(`Created At: ${credential.createdAt}`);
124116
}
125117

126-
interface AuthWebAuthnCredential {
127-
credentialId: string | undefined;
128-
friendlyCredentialName: string | undefined;
129-
relyingPartyId: string | undefined;
130-
authenticatorAttachment?: string;
131-
authenticatorTransports: string[] | undefined;
132-
createdAt: Date | undefined;
133-
}
134118
```
135-
136119
</InlineFilter>
137120
<InlineFilter filters={["android"]}>
138121

@@ -220,15 +203,6 @@ await deleteWebAuthnCredential({
220203
credentialId: id
221204
});
222205
```
223-
224-
The delete passkey API has only the required `credentialId` as input.
225-
226-
```ts
227-
interface DeleteWebAuthnCredentialInput {
228-
credentialId: string;
229-
}
230-
```
231-
232206
</InlineFilter>
233207
<InlineFilter filters={["android"]}>
234208

@@ -269,12 +243,11 @@ func deleteWebAuthNCredentials(credentialId: String) -> AnyCancellable {
269243

270244
</Block>
271245
</BlockSwitcher>
272-
273-
<InlineFilter filters={["angular", "javascript", "nextjs", "react", "react-native", "vue"]}>
246+
</InlineFilter>
247+
274248

275-
## Practical example
276-
277249
<InlineFilter filters={["angular", "javascript", "nextjs", "react", "react-native", "vue"]}>
250+
## Practical example
278251

279252
Here is a code example that uses the list and delete APIs together. In this example, the user has 3 passkeys registered. They want to list all passkeys while using a `pageSize` of 2 as well as delete the first passkey in the list.
280253

@@ -305,4 +278,3 @@ await deleteWebAuthnCredential({
305278
```
306279

307280
</InlineFilter>
308-
</InlineFilter>

0 commit comments

Comments
 (0)