-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKPassMetadata.js
115 lines (104 loc) · 4.09 KB
/
KPassMetadata.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
* TODO(KimlikDAO-bot): Move prompts to a component library and out of kimlikdao-js
*
* @author KimlikDAO
*/
import { ChainId } from "../crosschain/chains";
import "../ethereum/ERC721Unlockable.d";
import KPass from "../ethereum/KPassLite";
import dom from "../util/dom";
import { I18nString } from "../util/i18n";
import { hex } from "../util/çevir";
import { SectionGroup } from "./KPass";
/**
* @const {string}
* @noinline
*/
const KIMLIKDAO_URL = "https://kimlikdao.org";
/**
* @param {!Array<string>} sections
* @return {string}
*/
const userPrompt = (sections) => {
/** @const {string} */
const sectionText = sections.join(",\n ");
/**
* @const
* @type {I18nString} */
const prompt = {
tr: `KPass Erişim İsteği:
-------------------------------------------------
Bu mesajı imzaladığınızda, bağlı uygulama KPass’inizin
${sectionText}
bölüm${sections.length == 1 ? "ü" : "leri"}ne erişebilecek. Bu mesajı sadece bu bilgileri paylaşmak istiyorsanız imzalayın.\n\n\n`,
en: `KPass Access Request:
-------------------------------------------------
When you sign this message, the connected app will have access to
${sectionText}
section${sections.length == 1 ? "" : "s"} of your KPass. Only sign this message if you would like to share this information.\n\n\n`
};
return dom.i18n(prompt);
}
/**
* @param {!Array<string>} sections
* @param {ChainId} chainId
* @return {!SectionGroup}
*/
const sectionGroup = (sections, chainId) => /** @type {!SectionGroup} */({
sectionNames: sections,
userPrompt: userPrompt(sections)
+ "Nonce: " + hex(/** @type {!Uint8Array} */(crypto.getRandomValues(new Uint8Array(8))))
+ "\nChainId: " + chainId
+ "\nNFT: " + KPass.getAddress(chainId)
});
/**
* @param {ChainId} chainId
* @return {{
* metadata: !eth.ERC721Metadata,
* sections: !Array<SectionGroup>
* }}
*/
const metadataAndSections = (chainId) => ({
metadata: /** @type {!eth.ERC721Metadata} */({
name: "KPass",
description: "KPass",
image: KIMLIKDAO_URL + "/KPASS.svg",
external_url: KIMLIKDAO_URL,
}),
sections: [
sectionGroup(["personInfo", "contactInfo", "addressInfo", "kütükBilgileri"], chainId),
sectionGroup(["contactInfo", "humanID"], chainId),
sectionGroup(["humanID"], chainId),
sectionGroup(["exposureReport"], chainId)
]
});
/** @const {!Object<string, string>} */
const VerificationKeys = {
"exposureReport":
"MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAx6RG1FTAvyuNi4Hd5+o6muaVPgF12CN97J50" +
"YHpHkcEfe3zYMnun/OT1o4fkPidoTgh7PbTOiPvsu6yTVenCjV3PCuwUoKniPCjq0sPMCOgQNTAsOjFg" +
"vfz+5RQjJ8jUkmiG+qpg0XEM4KTIwHCG0x2QYdd+IaSO44/EYSbfStFxhSyk5Izdl7gff1V96eI/OFAV" +
"xx0VGSVqP3yAFCCEHvOY+lXj+eYKr4gZymqKL2kmjP1FBAeetJHXdBJiU1uqot25hv3+xaKTriQENuAW" +
"QZ+Zuy7J+1LXMvCmoE3VXToqOApYv1kCl3dzEB+XWeADAVJzEe5hphicmfUWi8+iKNSMlgwoxjvNugql" +
"enTj41akWnhFCJkCnSJ3sIfGPUrqrd3CPmjdNFwZB0ZmdvhBC4irstxdd+ealyRYZUaepfzfy5QGV4fs" +
"hvcfbkXh3aJkx9jFU5nIRBzCmXPO+mi1f5SOFJrKhxjOB93rj+x/wclaPF3a9HfKrifh7FsfSKVZxz8D" +
"dtMClaKS6D3EyiqNOpYs0zC3kqOXkskA+MQsSsx9LahIOf/htOviEk41hMMMhtZ4kE52mngUEr1DnO9C" +
"eknHqugo6ib4OZQwvoUtEk/pV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