-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: relocation of ctype config (#78)
## fixes KILTprotocol/ticket#2911 The 'Ctype Hash' and 'Attester DID' have been moved to the .env file. Additionally, if a user does not specify one, it will automatically use the email ctype. A new ticket has been opened to list valid Ctype hashes in the readme.md file. See Ticket [#3103](KILTprotocol/ticket#3103). Additionally added functionality to use multiple Ctypes added. ## How to test: Please provide a brief step-by-step instruction. If necessary provide information about dependencies (specific configuration, branches, database dumps, etc.) - Step 1 - Step 2 - etc. ## Checklist: - [X] I have verified that the code works - [X] I have verified that the code is easy to understand - [ ] If not, I have left a well-balanced amount of inline comments - [x] I have [left the code in a better state](https://deviq.com/principles/boy-scout-rule) - [x] I have documented the changes (where applicable) * Either PR or Ticket to update [the Docs](https://github.com/KILTprotocol/docs) * Link the PR/Ticket here --------- Co-authored-by: Aybars Göktuğ Ayan <[email protected]>
- Loading branch information
1 parent
2782fe6
commit 0882d58
Showing
12 changed files
with
169 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"semi": false, | ||
"trailingComma": "none", | ||
"singleQuote": true, | ||
"tabWidth": 2 | ||
} | ||
"semi": false, | ||
"trailingComma": "none", | ||
"singleQuote": true, | ||
"tabWidth": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as Kilt from '@kiltprotocol/sdk-js' | ||
|
||
import { CTYPE_HASH, REQUIRED_PROPERTIES, TRUSTED_ATTESTERS } from '../config' | ||
|
||
/** Establish the types of credentials (cTypes) that our dApp will request from users to log in, | ||
* identify which properties are necessary, and specify which attesters we trust. | ||
* | ||
* These settings are defined by the constants imported from the config file. | ||
* Modify the `env` file to adapt it to your preferences. | ||
*/ | ||
|
||
const cTypeHashes = CTYPE_HASH.split('/').map((s) => s.trim()) | ||
|
||
const trustedAttesterList = TRUSTED_ATTESTERS.split('/').map((s) => s.trim()) | ||
|
||
const requiredPropertiesList = REQUIRED_PROPERTIES.split('/').map((s) => | ||
s.trim() | ||
) | ||
|
||
const cTypes: { | ||
cTypeHash: `0x${string}` | ||
trustedAttesters: Kilt.DidUri[] | ||
requiredProperties: string[] | ||
}[] = [] | ||
|
||
for (let i = 0; i < cTypeHashes.length; i++) { | ||
const trustedAttesters = trustedAttesterList[i].split(',').map((s) => { | ||
const trimmed = s.trim() | ||
Kilt.Did.validateUri(trimmed) | ||
return trimmed as Kilt.DidUri | ||
}) | ||
const requiredProperties = requiredPropertiesList[i] | ||
.split(',') | ||
.map((s) => s.trim()) | ||
const cType = { | ||
cTypeHash: cTypeHashes[i] as `0x${string}`, | ||
trustedAttesters, | ||
requiredProperties | ||
} | ||
cTypes.push(cType) | ||
} | ||
export const cTypesToRequest: Kilt.IRequestCredentialContent = { | ||
cTypes | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{ | ||
"short_name": "Web3 Login", | ||
"name": "KILT Web3 Login", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} | ||
"short_name": "Web3 Login", | ||
"name": "KILT Web3 Login", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ | |
display: inline-block; | ||
color: white; | ||
font-size: 18px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters