Skip to content

Commit be94864

Browse files
committed
Adding a Trust Registry for CRED credentials
1 parent 75fade4 commit be94864

4 files changed

Lines changed: 52 additions & 4 deletions

File tree

app/components/CouponCard.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import Moment from 'moment';
77

88
import { CardStyles as styles } from '../themes/CardStyles'
99

10+
const TRUST_REGISTRY = {
11+
"k1.pathcheck.org": "State of Massachusetts",
12+
"keys.gov.bm": "Country of Barbados"
13+
}
14+
1015
export default class CouponCard extends Component {
1116

1217
showQR = (card) => {
@@ -52,12 +57,19 @@ export default class CouponCard extends Component {
5257

5358
<View style={{flexDirection:'row', alignItems: 'center'}}>
5459
<FontAwesome5 style={styles.icon} name={'check-circle'} solid/>
55-
<Text style={styles.notes}>Signed by {this.props.detail.pub_key.toLowerCase()}</Text>
60+
<Text style={styles.notes}>Signed by the {this.issuerName(this.props.detail)}</Text>
5661
</View>
5762
</View>
5863
)
5964
}
6065

66+
issuerName = (card) => {
67+
if (TRUST_REGISTRY[card.pub_key.toLowerCase()]) {
68+
return TRUST_REGISTRY[card.pub_key.toLowerCase()]
69+
}
70+
return card.pub_key.toLowerCase();
71+
}
72+
6173
render() {
6274
return this.props.pressable ?
6375
( <TouchableOpacity onPress={() => this.showQR(this.props.detail)}>

app/components/PassKeyCard.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import Moment from 'moment';
77

88
import { CardStyles as styles } from '../themes/CardStyles'
99

10+
const TRUST_REGISTRY = {
11+
"k1.pathcheck.org": "State of Massachusetts",
12+
"keys.gov.bm": "Country of Barbados"
13+
}
14+
1015
export default class PassKeyCard extends Component {
1116

1217
showQR = (card) => {
@@ -28,6 +33,13 @@ export default class PassKeyCard extends Component {
2833
return this.props.detail.cert ? this.props.detail.cert : this.props.detail;
2934
}
3035

36+
issuerName = (card) => {
37+
if (TRUST_REGISTRY[card.pub_key.toLowerCase()]) {
38+
return TRUST_REGISTRY[card.pub_key.toLowerCase()]
39+
}
40+
return card.pub_key.toLowerCase();
41+
}
42+
3143
renderCard = () => {
3244
return (
3345
<View style={[styles.card, {backgroundColor:this.props.colors.primary}]}>
@@ -52,7 +64,7 @@ export default class PassKeyCard extends Component {
5264

5365
<View style={{flexDirection:'row', alignItems: 'center'}}>
5466
<FontAwesome5 style={styles.icon} name={'check-circle'} solid/>
55-
<Text style={styles.notes}>Signed by {this.props.detail.pub_key.toLowerCase()}</Text>
67+
<Text style={styles.notes}>Signed by {this.issuerName(this.props.detail)}</Text>
5668
</View>
5769
</View>
5870
);

app/components/StatusCard.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import Moment from 'moment';
77

88
import { CardStyles as styles } from '../themes/CardStyles'
99

10+
const TRUST_REGISTRY = {
11+
"k1.pathcheck.org": "State of Massachusetts",
12+
"keys.gov.bm": "Country of Barbados"
13+
}
14+
1015
export default class StatusCard extends Component {
1116

1217
showQR = (card) => {
@@ -49,6 +54,13 @@ export default class StatusCard extends Component {
4954
return "User: " + simpleHash;
5055
}
5156
}
57+
58+
issuerName = (card) => {
59+
if (TRUST_REGISTRY[card.pub_key.toLowerCase()]) {
60+
return TRUST_REGISTRY[card.pub_key.toLowerCase()]
61+
}
62+
return card.pub_key.toLowerCase();
63+
}
5264

5365
renderCard = () => {
5466
return (
@@ -78,7 +90,7 @@ export default class StatusCard extends Component {
7890

7991
<View style={{flexDirection:'row', alignItems: 'center'}}>
8092
<FontAwesome5 style={styles.icon} name={'check-circle'} solid/>
81-
<Text style={styles.notes}>Signed by {this.props.detail.pub_key.toLowerCase()}</Text>
93+
<Text style={styles.notes}>Signed by {this.issuerName(this.props.detail)}</Text>
8294
</View>
8395
</View>
8496
);

app/components/VaccineCard.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import { CardStyles as styles } from '../themes/CardStyles'
77

88
import Moment from 'moment';
99

10+
const TRUST_REGISTRY = {
11+
"k1.pathcheck.org": "State of Massachusetts",
12+
"keys.gov.bm": "Country of Barbados"
13+
}
14+
1015
export default class VaccineCard extends Component {
1116

1217
showQR = (card) => {
@@ -49,6 +54,13 @@ export default class VaccineCard extends Component {
4954
}
5055
}
5156

57+
issuerName = (card) => {
58+
if (TRUST_REGISTRY[card.pub_key.toLowerCase()]) {
59+
return TRUST_REGISTRY[card.pub_key.toLowerCase()]
60+
}
61+
return card.pub_key.toLowerCase();
62+
}
63+
5264
renderCard = () => {
5365
return (
5466
<View style={[styles.card, {backgroundColor:this.props.colors.primary}]}>
@@ -101,7 +113,7 @@ export default class VaccineCard extends Component {
101113

102114
<View style={{flexDirection:'row', alignItems: 'center'}}>
103115
<FontAwesome5 style={styles.icon} name={'check-circle'} solid/>
104-
<Text style={styles.notes}>Signed by {this.props.detail.pub_key.toLowerCase()}</Text>
116+
<Text style={styles.notes}>Signed by {this.issuerName(this.props.detail)}</Text>
105117
</View>
106118
</View>
107119
);

0 commit comments

Comments
 (0)