-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
2,262 additions
and
53 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
3 changes: 3 additions & 0 deletions
3
...706201208594_alter_table_public_team_integrations_add_column_staging_bops_secret/down.sql
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,3 @@ | ||
ALTER TABLE "public"."team_integrations" DROP COLUMN "staging_bops_secret"; | ||
ALTER TABLE "public"."team_integrations" DROP COLUMN "production_bops_secret"; | ||
|
9 changes: 9 additions & 0 deletions
9
.../1706201208594_alter_table_public_team_integrations_add_column_staging_bops_secret/up.sql
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,9 @@ | ||
alter table "public"."team_integrations" add column "staging_bops_secret" text | ||
null; | ||
|
||
comment on column "public"."team_integrations"."staging_bops_secret" is E'Secret required for BOPS submission in the format <API_KEY>:<INITIALIZATION_VECTOR>'; | ||
|
||
alter table "public"."team_integrations" add column "production_bops_secret" text | ||
null; | ||
|
||
comment on column "public"."team_integrations"."production_bops_secret" is E'Secret required for BOPS submission in the format <API_KEY>:<INITIALIZATION_VECTOR>'; |
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,33 @@ | ||
import { encrypt } from "@opensystemslab/planx-core"; | ||
|
||
/** | ||
* Encrypt a secret | ||
* Currently used to generate secure secrets for the team_integrations table | ||
* e.g converting plain text 3rd-part API keys (such as BOPS tokens) to encrypted strings | ||
* | ||
* @param secret - The secret to be encrypted. | ||
* @param encryptionKey - The encryption key - a 32-byte string | ||
* @returns The encrypted secret and initialization vector in the format ${secret}:${iv} | ||
* @example pnpm encode <secret> <encryptionKey> | ||
*/ | ||
function main() { | ||
try { | ||
if (process.argv.length < 4) { | ||
console.error("Usage: pnpm encode <secret> <encryptionKey>"); | ||
process.exit(1); | ||
} | ||
|
||
const secret = process.argv[2]; | ||
const encryptionKey = process.argv[3]; | ||
const encrypted = encrypt(secret, encryptionKey); | ||
|
||
console.log("Success!"); | ||
console.log(encrypted); | ||
} catch (error) { | ||
console.log("Error!") | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
main(); |
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,17 @@ | ||
{ | ||
"name": "encrypt", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.ts", | ||
"scripts": { | ||
"encrypt": "ts-node index.ts" | ||
}, | ||
"keywords": [], | ||
"dependencies": { | ||
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#02c3999", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.3.3" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
Oops, something went wrong.