Skip to content

Commit

Permalink
dom.adla() varolan element döndürme garantisi ver
Browse files Browse the repository at this point in the history
  • Loading branch information
KimlikDAO-bot committed Apr 25, 2024
1 parent 21a6cf6 commit 8f0e5bb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
48 changes: 24 additions & 24 deletions did/KPassData.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const KIMLIKDAO_URL = "https://kimlikdao.org";
/** @const {string} */
const SignPromptTR = `KimlikDAO Pass Erişim İsteği:
-------------------------------------------------
()Bu mesajı imzaladığınızda, bağlı uygulama KimlikDAO Pass’inizin
()Bu mesajı imzaladığınızda, bağlı uygulama KPass’inizin
{}
Expand All @@ -30,40 +30,40 @@ const SignPromptEN = `KimlikDAO Pass Access Request:
{}
section<> of your KimlikDAO Pass. Only sign this message if you would like to share this information.\n\n\n`
section<> of your KPass. Only sign this message if you would like to share this information.\n\n\n`

/**
* @param {!Array<string>} bölümler
* @param {string=} girişTr
* @param {string=} girişEn
* @param {!Array<string>} sections
* @param {string=} introTr
* @param {string=} introEn
* @return {string}
*/
const signPrompt = (bölümler, girişTr, girişEn) => {
const signPrompt = (sections, introTr, introEn) => {
/** @const {string} */
const tr = SignPromptTR
.replace("()", girişTr || "")
.replace("<>", bölümler.length == 1 ? "ü" : "leri");
.replace("()", introTr || "")
.replace("<>", sections.length == 1 ? "ü" : "leri");
/** @const {string} */
const en = SignPromptEN
.replace("()", girişEn || "")
.replace("<>", bölümler.length == 1 ? "" : "s");
.replace("()", introEn || "")
.replace("<>", sections.length == 1 ? "" : "s");
return (dom.TR ? tr + en : en + tr)
.replace(/{}/g, bölümler.join(",\n "));
.replace(/{}/g, sections.join(",\n "));
}

/**
* @param {!Array<string>} bölümler
* @param {ChainId}
* @param {string=} girişTr
* @param {string=} girişEn
* @param {!Array<string>} sections
* @param {ChainId} chainId
* @param {string=} introTr
* @param {string=} introEn
* @return {!SectionGroup}
*/
const section = (bölümler, , girişTr, girişEn) => /** @type {!SectionGroup} */({
sectionNames: bölümler,
userPrompt: imzaMetni(bölümler, girişTr, girişEn)
const section = (sections, chainId, introTr, introEn) => /** @type {!SectionGroup} */({
sectionNames: sections,
userPrompt: signPrompt(sections, introTr, introEn)
+ "Nonce: " + hex(/** @type {!Uint8Array} */(crypto.getRandomValues(new Uint8Array(8))))
+ "\nChainId: " +
+ "\nNFT: " + KPass.getAddress()
+ "\nChainId: " + chainId
+ "\nNFT: " + KPass.getAddress(chainId)
});

/**
Expand All @@ -81,10 +81,10 @@ const metadataAndSections = (chainId) => ({
external_url: KIMLIKDAO_URL,
}),
sections: [
section(["personInfo", "contactInfo", "addressInfo", "kütükBilgileri"], ),
section(["contactInfo", "humanID"], ),
section(["humanID"], ),
section(["exposureReport"], ,
section(["personInfo", "contactInfo", "addressInfo", "kütükBilgileri"], chainId),
section(["contactInfo", "humanID"], chainId),
section(["humanID"], chainId),
section(["exposureReport"], chainId,
"https://kimlikdao.org adresinde olduğunuzdan emin olun! Bu adreste değilseniz bu metni imzalamayın.\n\n",
"Ensure that you're on https://kimlikdao.org. If not, don't sign this message!\n\n"
)
Expand Down
2 changes: 1 addition & 1 deletion util/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const TR = true;
* @param {string} ad DOM biriminin adı.
* @return {!Element}
*/
const adla = (ad) => document.getElementById(ad);
const adla = (ad) => /** @type {!Element} */(document.getElementById(ad));

/**
* @noinline
Expand Down

0 comments on commit 8f0e5bb

Please sign in to comment.