Skip to content

Commit

Permalink
fix crypto import (#161)
Browse files Browse the repository at this point in the history
i missed fixing this breaking change when i bumped web5 dids

- added an assertion that would have caught the bug
- added explicit dependency on web5/crypto because its there and was
hidden
  • Loading branch information
shamilovtim committed Aug 16, 2024
1 parent 1c6246f commit c84699e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"dependencies": {
"@tbd54566975/dwn-sdk-js": "0.4.5",
"@tbd54566975/dwn-sql-store": "0.6.5",
"@web5/crypto": "^1.0.3",
"better-sqlite3": "^8.5.0",
"body-parser": "^1.20.2",
"bytes": "3.1.2",
Expand Down
4 changes: 2 additions & 2 deletions src/web5-connect/web5-connect-server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getDialectFromUrl } from "../storage.js";
import { randomUuid } from '@web5/crypto/utils';
import { CryptoUtils } from '@web5/crypto';
import { SqlTtlCache } from "./sql-ttl-cache.js";

/**
Expand Down Expand Up @@ -67,7 +67,7 @@ export class Web5ConnectServer {
*/
public async setWeb5ConnectRequest(request: Web5ConnectRequest): Promise<SetWeb5ConnectRequestResult> {
// Generate a request URI
const requestId = randomUuid();
const requestId = CryptoUtils.randomUuid();
const request_uri = `${this.baseUrl}/connect/authorize/${requestId}.jwt`;

// Store the Request Object.
Expand Down
2 changes: 2 additions & 0 deletions tests/scenarios/web5-connect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ describe('Web5 Connect scenarios', function () {

// 2. Identity Provider (wallet) fetches the Web5 Connect Request object from the Web5 Connect server.
const requestUrl = (await postWeb5ConnectRequestResult.json() as any).request_uri;
const regex = /^http:\/\/localhost:3000\/connect\/authorize\/[a-zA-Z0-9\-]{21,}\.jwt$/;
expect(requestUrl).to.match(regex);

let getWeb5ConnectRequestResult;
await Poller.pollUntilSuccessOrTimeout(async () => {
Expand Down

0 comments on commit c84699e

Please sign in to comment.