@learncard/create-http-bridge 1.1.251 → 1.1.253

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,10 +15,10 @@ https://docs.learncard.com
15
15
 
16
16
  ## Install
17
17
 
18
- - Clone this repo
19
- - Set up AWS CLI
20
- - Add a .env file exporting a wallet seed (e.g. `WALLET_SEED=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`)
21
- - Run `bun run serverless-deploy`
18
+ - Clone this repo
19
+ - Set up AWS CLI
20
+ - Add a .env file exporting a wallet seed (e.g. `WALLET_SEED=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`)
21
+ - Run `bun run serverless-deploy`
22
22
 
23
23
  ## Local VC-API conformance testing
24
24
 
@@ -34,8 +34,12 @@ bun --cwd ../../../../packages/plugins/didkit run build
34
34
 
35
35
  Stop and restart any running bridge after rebuilding; it loads the DIDKit WASM during
36
36
  initialization.
37
- When intentionally rebuilding DIDKit, review the new binary and update
38
- `EXPECTED_DIDKIT_SHA256` in `scripts/sync-didkit.ts`. To test an unreviewed local artifact
37
+ When intentionally rebuilding DIDKit, review the new binary and run
38
+ `bun scripts/sync-didkit.ts --update-integrity` from this package. Commit the updated
39
+ `EXPECTED_DIDKIT_SHA256` guard together with the plugin artifact. The repository's
40
+ `build-wasm-from-submodules.sh` helper does this explicitly after generation, and the
41
+ WASM update automation includes the guard and artifacts in its PR. Ordinary builds only verify
42
+ the pin; they never update it. To test an unreviewed local artifact
39
43
  without changing that pin, set `LOCAL_DIDKIT_PATH` as described below.
40
44
 
41
45
  Start the LearnCard HTTP bridge in the first terminal:
package/dist/index.js CHANGED
@@ -416,7 +416,7 @@ const App = ({ name = "LearnCardHTTPBridge" }) => {
416
416
  };
417
417
 
418
418
  var name = "@learncard/create-http-bridge";
419
- var version = "1.1.251";
419
+ var version = "1.1.253";
420
420
  var description = "Instantly create and deploy a Learn Card Bridge HTTP API via AWS Lambda!";
421
421
  var main = "dist/index.js";
422
422
  var bin = "dist/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/create-http-bridge",
3
- "version": "1.1.251",
3
+ "version": "1.1.253",
4
4
  "description": "Instantly create and deploy a Learn Card Bridge HTTP API via AWS Lambda!",
5
5
  "main": "dist/index.js",
6
6
  "bin": "dist/index.js",
@@ -14,8 +14,8 @@
14
14
  "author": "Learning Economy Foundation (www.learningeconomy.io)",
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@learncard/init": "2.4.12",
18
- "@learncard/types": "5.18.2",
17
+ "@learncard/init": "2.4.13",
18
+ "@learncard/types": "5.18.3",
19
19
  "@rollup/plugin-json": "^4.1.0",
20
20
  "commander": "^9.3.0",
21
21
  "cors": "^2.8.5",
@@ -1,20 +1,42 @@
1
1
  import { createHash } from 'crypto';
2
2
  import { readFile, writeFile } from 'fs/promises';
3
3
 
4
- const EXPECTED_DIDKIT_SHA256 = '60efb6027699fda135db0d817f7a541bbd660ae88bec9cbec9796feeb3740b96';
4
+ const EXPECTED_DIDKIT_SHA256 = 'a058bcc6f5e9f037c26e1b29d81dfc8ac94c8e4593ce39fa78f3c2f810796c2e';
5
5
  const sourceUrl = new URL(
6
6
  '../../plugins/didkit/src/didkit/pkg/didkit_wasm_bg.wasm',
7
7
  import.meta.url
8
8
  );
9
9
  const destinationUrl = new URL('../src/didkit_wasm_bg.wasm', import.meta.url);
10
+ const args = process.argv.slice(2);
11
+ const updateIntegrity = args.length === 1 && args[0] === '--update-integrity';
12
+
13
+ if (args.length > 0 && !updateIntegrity) {
14
+ throw new Error('Usage: bun scripts/sync-didkit.ts [--update-integrity]');
15
+ }
16
+ if (updateIntegrity && process.env.LOCAL_DIDKIT_PATH) {
17
+ throw new Error('Unset LOCAL_DIDKIT_PATH before updating the canonical DIDKit integrity pin.');
18
+ }
19
+
10
20
  if (!process.env.LOCAL_DIDKIT_PATH) {
11
21
  const didkit = await readFile(sourceUrl);
12
22
  const actualHash = createHash('sha256').update(didkit).digest('hex');
13
23
 
14
- if (actualHash !== EXPECTED_DIDKIT_SHA256) {
24
+ if (updateIntegrity && actualHash !== EXPECTED_DIDKIT_SHA256) {
25
+ // Only intentional artifact generation/review may change the committed guard.
26
+ const scriptUrl = new URL(import.meta.url);
27
+ const script = await readFile(scriptUrl, 'utf8');
28
+ const declaration = `const EXPECTED_DIDKIT_SHA256 = '${EXPECTED_DIDKIT_SHA256}';`;
29
+ if (!script.includes(declaration)) {
30
+ throw new Error('Could not locate the DIDKit integrity pin to update.');
31
+ }
32
+ await writeFile(
33
+ scriptUrl,
34
+ script.replace(declaration, `const EXPECTED_DIDKIT_SHA256 = '${actualHash}';`)
35
+ );
36
+ } else if (actualHash !== EXPECTED_DIDKIT_SHA256) {
15
37
  throw new Error(
16
38
  `DIDKit WASM hash changed: expected ${EXPECTED_DIDKIT_SHA256}, received ${actualHash}. ` +
17
- 'Review the rebuilt artifact and update EXPECTED_DIDKIT_SHA256 intentionally.'
39
+ 'Review the rebuilt artifact, then run sync-didkit.ts --update-integrity intentionally.'
18
40
  );
19
41
  }
20
42
 
Binary file
package/tsconfig.json CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "extends": "../../tsconfig.library.json",
2
3
  "compilerOptions": {
3
4
  "lib": ["es2017"],
4
5
  "module": "esnext",