UNPKG

@aws-amplify/auth

Version:
1 lines 2.31 kB
{"version":3,"file":"deleteWebAuthnCredential.mjs","sources":["../../../../src/foundation/apis/deleteWebAuthnCredential.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AuthAction, assertTokenProviderConfig, } from '@aws-amplify/core/internals/utils';\nimport { assertAuthTokens } from '../../providers/cognito/utils/types';\nimport { createCognitoUserPoolEndpointResolver } from '../../providers/cognito/factories';\nimport { getRegionFromUserPoolId } from '../parsers';\nimport { getAuthUserAgentValue } from '../../utils';\nimport { createDeleteWebAuthnCredentialClient } from '../factories/serviceClients/cognitoIdentityProvider';\nexport async function deleteWebAuthnCredential(amplify, input) {\n const authConfig = amplify.getConfig().Auth?.Cognito;\n assertTokenProviderConfig(authConfig);\n const { userPoolEndpoint, userPoolId } = authConfig;\n const { tokens } = await amplify.Auth.fetchAuthSession();\n assertAuthTokens(tokens);\n const deleteWebAuthnCredentialResult = createDeleteWebAuthnCredentialClient({\n endpointResolver: createCognitoUserPoolEndpointResolver({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await deleteWebAuthnCredentialResult({\n region: getRegionFromUserPoolId(userPoolId),\n userAgentValue: getAuthUserAgentValue(AuthAction.DeleteWebAuthnCredential),\n }, {\n AccessToken: tokens.accessToken.toString(),\n CredentialId: input.credentialId,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AAOO,eAAe,wBAAwB,CAAC,OAAO,EAAE,KAAK,EAAE;AAC/D,IAAI,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO;AACxD,IAAI,yBAAyB,CAAC,UAAU,CAAC;AACzC,IAAI,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,UAAU;AACvD,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE;AAC5D,IAAI,gBAAgB,CAAC,MAAM,CAAC;AAC5B,IAAI,MAAM,8BAA8B,GAAG,oCAAoC,CAAC;AAChF,QAAQ,gBAAgB,EAAE,qCAAqC,CAAC;AAChE,YAAY,gBAAgB,EAAE,gBAAgB;AAC9C,SAAS,CAAC;AACV,KAAK,CAAC;AACN,IAAI,MAAM,8BAA8B,CAAC;AACzC,QAAQ,MAAM,EAAE,uBAAuB,CAAC,UAAU,CAAC;AACnD,QAAQ,cAAc,EAAE,qBAAqB,CAAC,UAAU,CAAC,wBAAwB,CAAC;AAClF,KAAK,EAAE;AACP,QAAQ,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;AAClD,QAAQ,YAAY,EAAE,KAAK,CAAC,YAAY;AACxC,KAAK,CAAC;AACN;;;;"}