-
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.
fix: reuse code instead of duplicating it (#82)
## fixes KILTprotocol/ticket#3094 - Stop having duplicates. - Imports the types and functions necessary for set-up from the backend. - Corrects some comments. ## How to test: 1. Delete all your all environment variables and domain linkage credential 2. run `yarn environment` and follow the instructions until you have all constants defined. 3. run `yarn did-configuration` to make a new domain linkage credential 4. run `yarn start` 5. login on the browser. ## 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
- Loading branch information
1 parent
2ee5d7d
commit dde33e7
Showing
13 changed files
with
111 additions
and
248 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
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
20 changes: 20 additions & 0 deletions
20
launchScripts/launchUtils/recycledUtils/postEnvironment.ts
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,20 @@ | ||
/** | ||
* Most of the utilities needed during the set-up that are also needed by the backend. | ||
* It is important that this utilities correlate so that the backend can use what was configured during set-up (launch). | ||
* To avoid duplicated code and discrepancies, it is better to import from the backend the utilities needed for the set-up. | ||
* That is what is done here on the 'recycledUtils' folder. | ||
*/ | ||
|
||
// | ||
// Import and Export Functions: | ||
// | ||
|
||
// This two functions from the Backend use the backend-config directly or indirectly. | ||
// The config from the backend try to loads all the env-constants and throws if one is missing. | ||
// That's why they are imported in a separated file. | ||
// This file should only be loaded after all environment constants are defined; e.g. while generating the Domain-Linkage-Credential, but not the Environment Variables. | ||
|
||
import { fetchDidDocument } from '../../../backend/src/utils/fetchDidDocument' | ||
import { validateOurKeys } from '../../../backend/src/config' | ||
|
||
export { validateOurKeys, fetchDidDocument } |
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,32 @@ | ||
/** | ||
* Most of the utilities needed during the set-up that are also needed by the backend. | ||
* It is important that this utilities correlate so that the backend can use what was configured during set-up (launch). | ||
* To avoid duplicated code and discrepancies, it is better to import from the backend the utilities needed for the set-up. | ||
* That is what is done here on the 'recycledUtils' folder. | ||
*/ | ||
|
||
// | ||
// Import and Export Types: | ||
// | ||
|
||
import { | ||
CredentialSubject, | ||
DomainLinkageCredential, | ||
VerifiableDomainLinkagePresentation | ||
} from '../../../backend/src/utils/types' | ||
|
||
export type This = typeof globalThis | ||
export { | ||
CredentialSubject, | ||
DomainLinkageCredential, | ||
VerifiableDomainLinkagePresentation | ||
} | ||
|
||
// | ||
// Import and Export Functions: | ||
// | ||
|
||
import { generateKeyPairs } from '../../../backend/src/utils/generateKeyPairs' | ||
import { generateAccount } from '../../../backend/src/utils/generateAccount' | ||
|
||
export { generateAccount, generateKeyPairs } |
File renamed without changes.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.