From be94864fd71112e50f8d216bae06b48483e3d563 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 4 Oct 2021 21:18:47 -0400 Subject: [PATCH] Adding a Trust Registry for CRED credentials --- app/components/CouponCard.js | 14 +++++++++++++- app/components/PassKeyCard.js | 14 +++++++++++++- app/components/StatusCard.js | 14 +++++++++++++- app/components/VaccineCard.js | 14 +++++++++++++- 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/app/components/CouponCard.js b/app/components/CouponCard.js index fa5927e..f320fee 100644 --- a/app/components/CouponCard.js +++ b/app/components/CouponCard.js @@ -7,6 +7,11 @@ import Moment from 'moment'; import { CardStyles as styles } from '../themes/CardStyles' +const TRUST_REGISTRY = { + "k1.pathcheck.org": "State of Massachusetts", + "keys.gov.bm": "Country of Barbados" +} + export default class CouponCard extends Component { showQR = (card) => { @@ -52,12 +57,19 @@ export default class CouponCard extends Component { - Signed by {this.props.detail.pub_key.toLowerCase()} + Signed by the {this.issuerName(this.props.detail)} ) } + issuerName = (card) => { + if (TRUST_REGISTRY[card.pub_key.toLowerCase()]) { + return TRUST_REGISTRY[card.pub_key.toLowerCase()] + } + return card.pub_key.toLowerCase(); + } + render() { return this.props.pressable ? ( this.showQR(this.props.detail)}> diff --git a/app/components/PassKeyCard.js b/app/components/PassKeyCard.js index b01bc2d..08c4013 100644 --- a/app/components/PassKeyCard.js +++ b/app/components/PassKeyCard.js @@ -7,6 +7,11 @@ import Moment from 'moment'; import { CardStyles as styles } from '../themes/CardStyles' +const TRUST_REGISTRY = { + "k1.pathcheck.org": "State of Massachusetts", + "keys.gov.bm": "Country of Barbados" +} + export default class PassKeyCard extends Component { showQR = (card) => { @@ -28,6 +33,13 @@ export default class PassKeyCard extends Component { return this.props.detail.cert ? this.props.detail.cert : this.props.detail; } + issuerName = (card) => { + if (TRUST_REGISTRY[card.pub_key.toLowerCase()]) { + return TRUST_REGISTRY[card.pub_key.toLowerCase()] + } + return card.pub_key.toLowerCase(); + } + renderCard = () => { return ( @@ -52,7 +64,7 @@ export default class PassKeyCard extends Component { - Signed by {this.props.detail.pub_key.toLowerCase()} + Signed by {this.issuerName(this.props.detail)} ); diff --git a/app/components/StatusCard.js b/app/components/StatusCard.js index cd064ea..249a324 100644 --- a/app/components/StatusCard.js +++ b/app/components/StatusCard.js @@ -7,6 +7,11 @@ import Moment from 'moment'; import { CardStyles as styles } from '../themes/CardStyles' +const TRUST_REGISTRY = { + "k1.pathcheck.org": "State of Massachusetts", + "keys.gov.bm": "Country of Barbados" +} + export default class StatusCard extends Component { showQR = (card) => { @@ -49,6 +54,13 @@ export default class StatusCard extends Component { return "User: " + simpleHash; } } + + issuerName = (card) => { + if (TRUST_REGISTRY[card.pub_key.toLowerCase()]) { + return TRUST_REGISTRY[card.pub_key.toLowerCase()] + } + return card.pub_key.toLowerCase(); + } renderCard = () => { return ( @@ -78,7 +90,7 @@ export default class StatusCard extends Component { - Signed by {this.props.detail.pub_key.toLowerCase()} + Signed by {this.issuerName(this.props.detail)} ); diff --git a/app/components/VaccineCard.js b/app/components/VaccineCard.js index 67bc0c1..17a779e 100644 --- a/app/components/VaccineCard.js +++ b/app/components/VaccineCard.js @@ -7,6 +7,11 @@ import { CardStyles as styles } from '../themes/CardStyles' import Moment from 'moment'; +const TRUST_REGISTRY = { + "k1.pathcheck.org": "State of Massachusetts", + "keys.gov.bm": "Country of Barbados" +} + export default class VaccineCard extends Component { showQR = (card) => { @@ -49,6 +54,13 @@ export default class VaccineCard extends Component { } } + issuerName = (card) => { + if (TRUST_REGISTRY[card.pub_key.toLowerCase()]) { + return TRUST_REGISTRY[card.pub_key.toLowerCase()] + } + return card.pub_key.toLowerCase(); + } + renderCard = () => { return ( @@ -101,7 +113,7 @@ export default class VaccineCard extends Component { - Signed by {this.props.detail.pub_key.toLowerCase()} + Signed by {this.issuerName(this.props.detail)} );