INNER CODE UNIT · TypeScript
declared
aws-devtools-labs/aws-blocks · packages/bb-auth-cognito/src/index.ts:1908
const declared = new Set((this.options.userAttributes ?? []).map((a) => a.name));
for (const [key, value] of Object.entries(attrs)) {
if (value === undefined) continue;
if (key.startsWith('custom:')) out[key] = value;
else if (isStandardAttribute(key)) out[key] = value;
else if (declared.has(key)) out[`custom:${key}`] = value;
else out[key] = value;
}
return out;
}
private async generateCode(
purpose: 'signUp' | 'resetPassword' | 'mfa' | 'attribute',
username: string,
): Promise<string> {
const code = String(crypto.randomInt(100000, 1000000));
this.state.codes[`${purpose}:${username}`] = {
code,