Skip to content

Commit

Permalink
Merge pull request #190 from ong-bitcoin-argentina/VUS-159-Boot_token…
Browse files Browse the repository at this point in the history
…_solution

Boot_token_solution
  • Loading branch information
farpires authored May 3, 2022
2 parents 4b522e4 + 8b24ae2 commit ecb96e2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
8 changes: 7 additions & 1 deletion src/src/presentation/common/WarningModalVersion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ export default class WarningModalVersion extends Component<WarningModalProps, {
});
}
}


componentWillUnmount() {
// fix Warning: Can't perform a React state update on an unmounted component
this.setState = ()=>{
return;
};
}

render() {
const { modal } = commonStyles;
Expand Down
2 changes: 1 addition & 1 deletion src/src/presentation/dashboard/common/CredentialCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default class CredentialCard extends Component<CredentialCardProps, {}> {
);

return rowData.map((row, i) => (
<View style={styles.keyValueContainer}>
<View key={i} style={styles.keyValueContainer}>
{row.data?.map((item, index) => {
const effectiveValue = strings.credentialCard.formatValue(item.value);
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,10 @@ class VuIdentitySubmitScreen extends NavigationEnabledComponent<VuIdentitySubmit
<DidiText.ValidateIdentity.Normal style={styles.descriptionHeader}>
Estos son los datos que van a conformar su credencial de DNI.</DidiText.ValidateIdentity.Normal>
{documentDataKeys.map((key, index) => (
<>
<View key={index}>
<Text style={styles.itemTxt} >{strings.vuIdentity.submit.items[key]}</Text>
<Text style={styles.resultItemTxt}>{documentData[key]}</Text>
</View>

</>
))}
</View>

Expand Down
14 changes: 14 additions & 0 deletions src/src/presentation/util/appRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,18 @@ export const createTokenAuthorization = async (did: ActiveDid):Promise<string> =
"iss": did.did()
});

};



export const tokenAuthorization = async (did: ActiveDid):Promise<string> => {
const {address} = did;
const didEthr = `did:ethr:${address}`
const credentialsParams: Settings = {};
credentialsParams.signer = getSignerForHDPath(address);
credentialsParams.did = didEthr;
const cred = new Credentials(credentialsParams);
return cred.createVerification({
"iss": didEthr
});
};
8 changes: 4 additions & 4 deletions src/src/services/vuSecurity/checkValidateDni.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { VUSecurityApiClient} from '@proyecto-didi/app-sdk';
import { AppConfig } from '../../AppConfig';
import { IReturnCheckValidateDni } from '../../model/VuCheckValidateDni';
import { createTokenAuthorization } from '../../presentation/util/appRouter';
import { tokenAuthorization } from '../../presentation/util/appRouter';
import { ActiveDid } from '../../store/reducers/didReducer';


const VUSecurity = ():VUSecurityApiClient => ( new VUSecurityApiClient(AppConfig.defaultServiceSettings.urlSecurity));

export async function checkValidateDniVU(did: ActiveDid): Promise<IReturnCheckValidateDni> {
const token = await createTokenAuthorization(did);
const didActived = await did?.did();
try {
return await VUSecurity().checkValidateDni(didActived as string,token);
const token = await tokenAuthorization(did);
const {address} = await did;
return await VUSecurity().checkValidateDni(`did:ethr:${address}`,token);
} catch (error) {
return {
status: "error",
Expand Down

0 comments on commit ecb96e2

Please sign in to comment.