Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crypto import #161

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading