Skip to content

Commit

Permalink
Adding a Trust Registry for CRED credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Oct 5, 2021
1 parent 75fade4 commit be94864
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
14 changes: 13 additions & 1 deletion app/components/CouponCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -52,12 +57,19 @@ export default class CouponCard extends Component {

<View style={{flexDirection:'row', alignItems: 'center'}}>
<FontAwesome5 style={styles.icon} name={'check-circle'} solid/>
<Text style={styles.notes}>Signed by {this.props.detail.pub_key.toLowerCase()}</Text>
<Text style={styles.notes}>Signed by the {this.issuerName(this.props.detail)}</Text>
</View>
</View>
)
}

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 ?
( <TouchableOpacity onPress={() => this.showQR(this.props.detail)}>
Expand Down
14 changes: 13 additions & 1 deletion app/components/PassKeyCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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 (
<View style={[styles.card, {backgroundColor:this.props.colors.primary}]}>
Expand All @@ -52,7 +64,7 @@ export default class PassKeyCard extends Component {

<View style={{flexDirection:'row', alignItems: 'center'}}>
<FontAwesome5 style={styles.icon} name={'check-circle'} solid/>
<Text style={styles.notes}>Signed by {this.props.detail.pub_key.toLowerCase()}</Text>
<Text style={styles.notes}>Signed by {this.issuerName(this.props.detail)}</Text>
</View>
</View>
);
Expand Down
14 changes: 13 additions & 1 deletion app/components/StatusCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -78,7 +90,7 @@ export default class StatusCard extends Component {

<View style={{flexDirection:'row', alignItems: 'center'}}>
<FontAwesome5 style={styles.icon} name={'check-circle'} solid/>
<Text style={styles.notes}>Signed by {this.props.detail.pub_key.toLowerCase()}</Text>
<Text style={styles.notes}>Signed by {this.issuerName(this.props.detail)}</Text>
</View>
</View>
);
Expand Down
14 changes: 13 additions & 1 deletion app/components/VaccineCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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 (
<View style={[styles.card, {backgroundColor:this.props.colors.primary}]}>
Expand Down Expand Up @@ -101,7 +113,7 @@ export default class VaccineCard extends Component {

<View style={{flexDirection:'row', alignItems: 'center'}}>
<FontAwesome5 style={styles.icon} name={'check-circle'} solid/>
<Text style={styles.notes}>Signed by {this.props.detail.pub_key.toLowerCase()}</Text>
<Text style={styles.notes}>Signed by {this.issuerName(this.props.detail)}</Text>
</View>
</View>
);
Expand Down

0 comments on commit be94864

Please sign in to comment.