From 1288e3773cdc9219755fe1fee339d59e695a485c Mon Sep 17 00:00:00 2001 From: Henry Tsai Date: Thu, 3 Oct 2024 15:35:57 -0700 Subject: [PATCH 1/8] Added web5 connect client/app display name for dynamic rendering in the wallet --- packages/agent/src/connect.ts | 11 +++++++++-- packages/agent/src/oidc.ts | 25 +++++++++++++++++++++---- packages/agent/tests/connect.spec.ts | 8 ++++++++ packages/api/src/web5.ts | 8 +++++++- 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/packages/agent/src/connect.ts b/packages/agent/src/connect.ts index 68aff74e9..936ed2da1 100644 --- a/packages/agent/src/connect.ts +++ b/packages/agent/src/connect.ts @@ -17,6 +17,7 @@ import { DwnInterfaceName, DwnMethodName } from '@tbd54566975/dwn-sdk-js'; * a did from a provider. */ async function initClient({ + displayName, connectServerUrl, walletUri, permissionRequests, @@ -44,10 +45,12 @@ async function initClient({ const request = await Oidc.createAuthRequest({ client_id : clientDid.uri, scope : 'openid did:jwk', + redirect_uri : callbackEndpoint, + // custom properties: // code_challenge : codeChallengeBase64Url, // code_challenge_method : 'S256', permissionRequests : permissionRequests, - redirect_uri : callbackEndpoint, + displayName, }); // Sign the Request Object using the Client DID's signing key. @@ -91,6 +94,7 @@ async function initClient({ // a deeplink to a web5 compatible wallet. if the wallet scans this link it should receive // a route to its web5 connect provider flow and the params of where to fetch the auth request. + console.log('Wallet URI:', walletUri); const generatedWalletUri = new URL(walletUri); generatedWalletUri.searchParams.set('request_uri', parData.request_uri); generatedWalletUri.searchParams.set( @@ -133,7 +137,10 @@ async function initClient({ * a did from a provider. */ export type WalletConnectOptions = { - /** The URL of the intermediary server which relays messages between the client and provider */ + /** The user friendly name of the client/app to be displayed when prompting end-user with permission requests. */ + displayName: string; + + /** The URL of the intermediary server which relays messages between the client and provider. */ connectServerUrl: string; /** diff --git a/packages/agent/src/oidc.ts b/packages/agent/src/oidc.ts index e56e9eb1f..60a8252e3 100644 --- a/packages/agent/src/oidc.ts +++ b/packages/agent/src/oidc.ts @@ -128,6 +128,9 @@ export type SIOPv2AuthRequest = { * The contents of this are inserted into a JWT inside of the {@link PushedAuthRequest}. */ export type Web5ConnectAuthRequest = { + /** The user friendly name of the client/app to be displayed when prompting end-user with permission requests. */ + displayName: string; + /** PermissionGrants that are to be sent to the provider */ permissionRequests: ConnectPermissionRequest[]; } & SIOPv2AuthRequest; @@ -242,7 +245,7 @@ async function generateCodeChallenge() { async function createAuthRequest( options: RequireOnly< Web5ConnectAuthRequest, - 'client_id' | 'scope' | 'redirect_uri' | 'permissionRequests' + 'client_id' | 'scope' | 'redirect_uri' | 'permissionRequests' | 'displayName' > ) { // Generate a random state value to associate the authorization request with the response. @@ -628,6 +631,7 @@ async function createPermissionGrants( const permissionsApi = new AgentPermissionsApi({ agent }); // TODO: cleanup all grants if one fails by deleting them from the DWN: https://github.com/TBD54566975/web5-js/issues/849 + console.log(`Creating permission grants for ${scopes.length} scopes given...`); const permissionGrants = await Promise.all( scopes.map((scope) => { // check if the scope is a records permission scope, or a protocol configure scope, if so it should use a delegated permission. @@ -643,6 +647,7 @@ async function createPermissionGrants( }) ); + console.log(`Sending ${permissionGrants.length} permission grants to remote DWN...`); const messagePromises = permissionGrants.map(async (grant) => { // Quirk: we have to pull out encodedData out of the message the schema validator doesn't want it there const { encodedData, ...rawMessage } = grant.message; @@ -658,6 +663,8 @@ async function createPermissionGrants( // check if the message was sent successfully, if the remote returns 409 the message may have come through already via sync if (reply.status.code !== 202 && reply.status.code !== 409) { + console.log('Error sending RecordsWrite:', reply.status.detail); + console.log('RecordsWrite message:', rawMessage); throw new Error( `Could not send the message. Error details: ${reply.status.detail}` ); @@ -666,9 +673,13 @@ async function createPermissionGrants( return grant.message; }); - const messages = await Promise.all(messagePromises); - - return messages; + try { + const messages = await Promise.all(messagePromises); + return messages; + } catch (error) { + console.error('Error during batch-send of permission grants:', error instanceof Error ? error.message : error); + throw error; + } } /** @@ -693,6 +704,7 @@ async function prepareProtocol( `Could not fetch protocol: ${queryMessage.reply.status.detail}` ); } else if (queryMessage.reply.entries === undefined || queryMessage.reply.entries.length === 0) { + console.log('Protocol does not exist, creating:', protocolDefinition.protocol); // send the protocol definition to the remote DWN first, if it passes we can process it locally const { reply: sendReply, message: configureMessage } = await agent.sendDwnRequest({ @@ -716,6 +728,7 @@ async function prepareProtocol( }); } else { + console.log('Protocol already exists:', protocolDefinition.protocol); // the protocol already exists, let's make sure it exists on the remote DWN as the requesting app will need it const configureMessage = queryMessage.reply.entries![0]; @@ -776,6 +789,7 @@ async function submitAuthResponse( const delegateGrants = (await Promise.all(delegateGrantPromises)).flat(); + console.log('Generating auth response object...'); const responseObject = await Oidc.createResponseObject({ //* the IDP's did that was selected to be connected iss : selectedDid, @@ -790,6 +804,7 @@ async function submitAuthResponse( }); // Sign the Response Object using the ephemeral DID's signing key. + console.log('Signing auth response object...'); const responseObjectJwt = await Oidc.signJwt({ did : delegateBearerDid, data : responseObject, @@ -801,6 +816,7 @@ async function submitAuthResponse( clientDid?.didDocument! ); + console.log('Encrypting auth response object...'); const encryptedResponse = Oidc.encryptAuthResponse({ jwt : responseObjectJwt!, encryptionKey : sharedKey, @@ -813,6 +829,7 @@ async function submitAuthResponse( state : authRequest.state, }).toString(); + console.log(`Sending auth response object to Web5 Connect server: ${authRequest.redirect_uri}`); await fetch(authRequest.redirect_uri, { body : formEncodedRequest, method : 'POST', diff --git a/packages/agent/tests/connect.spec.ts b/packages/agent/tests/connect.spec.ts index f6a1b87cb..9f34a8e10 100644 --- a/packages/agent/tests/connect.spec.ts +++ b/packages/agent/tests/connect.spec.ts @@ -224,6 +224,7 @@ describe('web5 connect', function () { }); const options = { + displayName : 'Sample App', client_id : clientEphemeralPortableDid.uri, scope : 'openid did:jwk', // code_challenge : Convert.uint8Array(codeChallenge).toBase64Url(), @@ -457,6 +458,7 @@ describe('web5 connect', function () { fetchStub.callThrough(); const results = await WalletConnect.initClient({ + displayName : 'Sample App', walletUri : 'http://localhost:3000/', connectServerUrl : 'http://localhost:3000/connect', permissionRequests : [ @@ -505,6 +507,7 @@ describe('web5 connect', function () { }); const options = { + displayName : 'Sample App', client_id : clientEphemeralPortableDid.uri, scope : 'openid did:jwk', // code_challenge : Convert.uint8Array(codeChallenge).toBase64Url(), @@ -560,6 +563,7 @@ describe('web5 connect', function () { }); const options = { + displayName : 'Sample App', client_id : clientEphemeralPortableDid.uri, scope : 'openid did:jwk', // code_challenge : Convert.uint8Array(codeChallenge).toBase64Url(), @@ -632,6 +636,7 @@ describe('web5 connect', function () { }); const options = { + displayName : 'Sample App', client_id : clientEphemeralPortableDid.uri, scope : 'openid did:jwk', // code_challenge : Convert.uint8Array(codeChallenge).toBase64Url(), @@ -679,6 +684,7 @@ describe('web5 connect', function () { }); const options = { + displayName : 'Sample App', client_id : clientEphemeralPortableDid.uri, scope : 'openid did:jwk', // code_challenge : Convert.uint8Array(codeChallenge).toBase64Url(), @@ -730,6 +736,7 @@ describe('web5 connect', function () { }); const options = { + displayName : 'Sample App', client_id : clientEphemeralPortableDid.uri, scope : 'openid did:jwk', // code_challenge : Convert.uint8Array(codeChallenge).toBase64Url(), @@ -781,6 +788,7 @@ describe('web5 connect', function () { mismatchedScopes[0].protocol = 'http://profile-protocol.xyz/other'; const options = { + displayName : 'Sample App', client_id : clientEphemeralPortableDid.uri, scope : 'openid did:jwk', // code_challenge : Convert.uint8Array(codeChallenge).toBase64Url(), diff --git a/packages/api/src/web5.ts b/packages/api/src/web5.ts index 6636026f5..0eca66de4 100644 --- a/packages/api/src/web5.ts +++ b/packages/api/src/web5.ts @@ -44,6 +44,7 @@ export type ConnectPermissionRequest = { * The protocol definition for the protocol being requested. */ protocolDefinition: DwnProtocolDefinition; + /** * The permissions being requested for the protocol. If none are provided, the default is to request all permissions. */ @@ -51,9 +52,14 @@ export type ConnectPermissionRequest = { } /** - * Options for connecting to a Web5 agent. This includes the ability to connect to an external wallet + * Options for connecting to a Web5 agent. This includes the ability to connect to an external wallet. + * + * NOTE: the returned `ConnectPermissionRequest` type is different to the `ConnectPermissionRequest` type in the `@web5/agent` package. */ export type ConnectOptions = Omit & { + /** The user friendly name of the client/app to be displayed when prompting end-user with permission requests. */ + displayName: string; + /** * The permissions that are being requested for the connected DID. * This is used to create the {@link ConnectPermissionRequest} for the wallet connect flow. From 86749af38ec318e7b32b233a70ce0ac93a8cf2e6 Mon Sep 17 00:00:00 2001 From: Henry Tsai Date: Thu, 3 Oct 2024 16:43:31 -0700 Subject: [PATCH 2/8] lint --- packages/api/src/web5.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/api/src/web5.ts b/packages/api/src/web5.ts index 0eca66de4..bc5ee95bd 100644 --- a/packages/api/src/web5.ts +++ b/packages/api/src/web5.ts @@ -53,7 +53,7 @@ export type ConnectPermissionRequest = { /** * Options for connecting to a Web5 agent. This includes the ability to connect to an external wallet. - * + * * NOTE: the returned `ConnectPermissionRequest` type is different to the `ConnectPermissionRequest` type in the `@web5/agent` package. */ export type ConnectOptions = Omit & { From a832030d33670e132972a7c436a7669707a1bc1e Mon Sep 17 00:00:00 2001 From: Henry Tsai Date: Thu, 3 Oct 2024 16:53:52 -0700 Subject: [PATCH 3/8] Missed tests --- packages/api/tests/web5.spec.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/api/tests/web5.spec.ts b/packages/api/tests/web5.spec.ts index be0016963..4576989c4 100644 --- a/packages/api/tests/web5.spec.ts +++ b/packages/api/tests/web5.spec.ts @@ -455,6 +455,7 @@ describe('web5 api', () => { // connect to the app, the options don't matter because we're stubbing the initClient method const { web5, did, delegateDid } = await Web5.connect({ walletConnectOptions: { + displayName : 'Sample App', connectServerUrl : 'https://connect.example.com', walletUri : 'https://wallet.example.com', validatePin : async () => { return '1234'; }, @@ -675,6 +676,7 @@ describe('web5 api', () => { // connect to the app, the options don't matter because we're stubbing the initClient method await Web5.connect({ walletConnectOptions: { + displayName : 'Sample App', connectServerUrl : 'https://connect.example.com', walletUri : 'https://wallet.example.com', validatePin : async () => { return '1234'; }, @@ -735,6 +737,7 @@ describe('web5 api', () => { await Web5.connect({ sync : 'off', walletConnectOptions : { + displayName : 'Sample App', connectServerUrl : 'https://connect.example.com', walletUri : 'https://wallet.example.com', validatePin : async () => { return '1234'; }, @@ -779,6 +782,7 @@ describe('web5 api', () => { await Web5.connect({ sync : '1m', walletConnectOptions : { + displayName : 'Sample App', connectServerUrl : 'https://connect.example.com', walletUri : 'https://wallet.example.com', validatePin : async () => { return '1234'; }, @@ -822,6 +826,7 @@ describe('web5 api', () => { await Web5.connect({ walletConnectOptions: { + displayName : 'Sample App', connectServerUrl : 'https://connect.example.com', walletUri : 'https://wallet.example.com', validatePin : async () => { return '1234'; }, @@ -893,6 +898,7 @@ describe('web5 api', () => { await Web5.connect({ walletConnectOptions: { + displayName : 'Sample App', connectServerUrl : 'https://connect.example.com', walletUri : 'https://wallet.example.com', validatePin : async () => { return '1234'; }, From 369532e804d491418b5fed63893fda4756d74aa0 Mon Sep 17 00:00:00 2001 From: Henry Tsai Date: Thu, 3 Oct 2024 16:54:36 -0700 Subject: [PATCH 4/8] Create lemon-bees-yawn.md --- .changeset/lemon-bees-yawn.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lemon-bees-yawn.md diff --git a/.changeset/lemon-bees-yawn.md b/.changeset/lemon-bees-yawn.md new file mode 100644 index 000000000..cf7a444db --- /dev/null +++ b/.changeset/lemon-bees-yawn.md @@ -0,0 +1,5 @@ +--- +"@web5/agent": patch +--- + +Added parameter for app display name for dynamic rendering in the wallet during web5 connect flow From 7cabd6c2e9f55072e45692803de3fb48e63fc681 Mon Sep 17 00:00:00 2001 From: Henry Tsai Date: Thu, 3 Oct 2024 16:55:27 -0700 Subject: [PATCH 5/8] Create smooth-weeks-serve.md --- .changeset/smooth-weeks-serve.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/smooth-weeks-serve.md diff --git a/.changeset/smooth-weeks-serve.md b/.changeset/smooth-weeks-serve.md new file mode 100644 index 000000000..68eb4483c --- /dev/null +++ b/.changeset/smooth-weeks-serve.md @@ -0,0 +1,5 @@ +--- +"@web5/api": patch +--- + +Added parameter for app display name for dynamic rendering in the wallet during web5 connect flow From 959e342ec8709fd1725f8e315cf6f0d99d662be0 Mon Sep 17 00:00:00 2001 From: Henry Tsai Date: Fri, 4 Oct 2024 11:02:38 -0700 Subject: [PATCH 6/8] Introduced logger to have better control of logging --- packages/agent/src/connect.ts | 4 +- packages/agent/src/oidc.ts | 24 +++++----- packages/common/package.json | 3 +- packages/common/src/index.ts | 1 + packages/common/src/logger.ts | 73 +++++++++++++++++++++++++++++ pnpm-lock.yaml | 88 +++++++++++++++++++++++++++++++++++ 6 files changed, 178 insertions(+), 15 deletions(-) create mode 100644 packages/common/src/logger.ts diff --git a/packages/agent/src/connect.ts b/packages/agent/src/connect.ts index 936ed2da1..fb19b9983 100644 --- a/packages/agent/src/connect.ts +++ b/packages/agent/src/connect.ts @@ -7,7 +7,7 @@ import { } from './oidc.js'; import { pollWithTtl } from './utils.js'; -import { Convert } from '@web5/common'; +import { Convert, logger } from '@web5/common'; import { CryptoUtils } from '@web5/crypto'; import { DidJwk } from '@web5/dids'; import { DwnInterfaceName, DwnMethodName } from '@tbd54566975/dwn-sdk-js'; @@ -94,7 +94,7 @@ async function initClient({ // a deeplink to a web5 compatible wallet. if the wallet scans this link it should receive // a route to its web5 connect provider flow and the params of where to fetch the auth request. - console.log('Wallet URI:', walletUri); + logger.log(`Wallet URI: ${walletUri}`); const generatedWalletUri = new URL(walletUri); generatedWalletUri.searchParams.set('request_uri', parData.request_uri); generatedWalletUri.searchParams.set( diff --git a/packages/agent/src/oidc.ts b/packages/agent/src/oidc.ts index 60a8252e3..076a0b72a 100644 --- a/packages/agent/src/oidc.ts +++ b/packages/agent/src/oidc.ts @@ -1,4 +1,4 @@ -import { Convert, RequireOnly } from '@web5/common'; +import { Convert, logger, RequireOnly } from '@web5/common'; import { Ed25519, EdDsaAlgorithm, @@ -631,7 +631,7 @@ async function createPermissionGrants( const permissionsApi = new AgentPermissionsApi({ agent }); // TODO: cleanup all grants if one fails by deleting them from the DWN: https://github.com/TBD54566975/web5-js/issues/849 - console.log(`Creating permission grants for ${scopes.length} scopes given...`); + logger.log(`Creating permission grants for ${scopes.length} scopes given...`); const permissionGrants = await Promise.all( scopes.map((scope) => { // check if the scope is a records permission scope, or a protocol configure scope, if so it should use a delegated permission. @@ -647,7 +647,7 @@ async function createPermissionGrants( }) ); - console.log(`Sending ${permissionGrants.length} permission grants to remote DWN...`); + logger.log(`Sending ${permissionGrants.length} permission grants to remote DWN...`); const messagePromises = permissionGrants.map(async (grant) => { // Quirk: we have to pull out encodedData out of the message the schema validator doesn't want it there const { encodedData, ...rawMessage } = grant.message; @@ -663,8 +663,8 @@ async function createPermissionGrants( // check if the message was sent successfully, if the remote returns 409 the message may have come through already via sync if (reply.status.code !== 202 && reply.status.code !== 409) { - console.log('Error sending RecordsWrite:', reply.status.detail); - console.log('RecordsWrite message:', rawMessage); + logger.error(`Error sending RecordsWrite: ${reply.status.detail}`); + logger.error(`RecordsWrite message: ${rawMessage}`); throw new Error( `Could not send the message. Error details: ${reply.status.detail}` ); @@ -677,7 +677,7 @@ async function createPermissionGrants( const messages = await Promise.all(messagePromises); return messages; } catch (error) { - console.error('Error during batch-send of permission grants:', error instanceof Error ? error.message : error); + logger.error(`Error during batch-send of permission grants: ${error}`); throw error; } } @@ -704,7 +704,7 @@ async function prepareProtocol( `Could not fetch protocol: ${queryMessage.reply.status.detail}` ); } else if (queryMessage.reply.entries === undefined || queryMessage.reply.entries.length === 0) { - console.log('Protocol does not exist, creating:', protocolDefinition.protocol); + logger.log(`Protocol does not exist, creating: ${protocolDefinition.protocol}`); // send the protocol definition to the remote DWN first, if it passes we can process it locally const { reply: sendReply, message: configureMessage } = await agent.sendDwnRequest({ @@ -728,7 +728,7 @@ async function prepareProtocol( }); } else { - console.log('Protocol already exists:', protocolDefinition.protocol); + logger.log(`Protocol already exists: ${protocolDefinition.protocol}`); // the protocol already exists, let's make sure it exists on the remote DWN as the requesting app will need it const configureMessage = queryMessage.reply.entries![0]; @@ -789,7 +789,7 @@ async function submitAuthResponse( const delegateGrants = (await Promise.all(delegateGrantPromises)).flat(); - console.log('Generating auth response object...'); + logger.log('Generating auth response object...'); const responseObject = await Oidc.createResponseObject({ //* the IDP's did that was selected to be connected iss : selectedDid, @@ -804,7 +804,7 @@ async function submitAuthResponse( }); // Sign the Response Object using the ephemeral DID's signing key. - console.log('Signing auth response object...'); + logger.log('Signing auth response object...'); const responseObjectJwt = await Oidc.signJwt({ did : delegateBearerDid, data : responseObject, @@ -816,7 +816,7 @@ async function submitAuthResponse( clientDid?.didDocument! ); - console.log('Encrypting auth response object...'); + logger.log('Encrypting auth response object...'); const encryptedResponse = Oidc.encryptAuthResponse({ jwt : responseObjectJwt!, encryptionKey : sharedKey, @@ -829,7 +829,7 @@ async function submitAuthResponse( state : authRequest.state, }).toString(); - console.log(`Sending auth response object to Web5 Connect server: ${authRequest.redirect_uri}`); + logger.log(`Sending auth response object to Web5 Connect server: ${authRequest.redirect_uri}`); await fetch(authRequest.redirect_uri, { body : formEncodedRequest, method : 'POST', diff --git a/packages/common/package.json b/packages/common/package.json index b7449eb47..5af21e6d6 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -72,6 +72,7 @@ "@isaacs/ttlcache": "1.4.1", "level": "8.0.1", "multiformats": "13.1.0", + "pino": "9.4.0", "readable-stream": "4.5.2" }, "devDependencies": { @@ -99,4 +100,4 @@ "rimraf": "5.0.7", "typescript": "5.5.3" } -} +} \ No newline at end of file diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index 1a6095561..0f4b01691 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -2,6 +2,7 @@ export type * from './types.js'; export * from './cache.js'; export * from './convert.js'; +export * from './logger.js'; export * from './multicodec.js'; export * from './object.js'; export * from './stores.js'; diff --git a/packages/common/src/logger.ts b/packages/common/src/logger.ts new file mode 100644 index 000000000..254113c79 --- /dev/null +++ b/packages/common/src/logger.ts @@ -0,0 +1,73 @@ +import { pino, LoggerOptions } from 'pino'; + +export enum Web5LogLevel { + Debug = 'debug', + Silent = 'silent', +} + +/** + * Web5 logger interface. + */ +export interface Web5LoggerInterface { + + /** + * Sets the log verbose level. + */ + setLogLevel(logLevel: Web5LogLevel): void; + + /** + * Same as `info()`. + * Logs an informational message. + */ + log (message: string): void; + + /** + * Logs an informational message. + */ + info(message: string): void; + + /** + * Logs an error message. + */ + error(message: string): void; +} + +/** + * A Web5 logger implementation. + */ +class Web5Logger implements Web5LoggerInterface { + private pinoLogger; + + public constructor() { + const loggerOptions: LoggerOptions = { + level: 'silent', // Default to 'silent' log level + }; + + this.pinoLogger = pino(loggerOptions); + } + + setLogLevel(logLevel: Web5LogLevel): void { + this.pinoLogger.level = logLevel; + } + + public log(message: string): void { + this.info(message); + } + + public info(message: string): void { + this.pinoLogger.info(message); + } + + public error(message: string): void { + this.pinoLogger.error(message); + } +} + +// Export a singleton logger instance +export const logger = new Web5Logger(); + +// Attach logger to the global window object in browser environment for easy access to the logger instance. +// e.g. can call `web5logger.setLogLevel('debug');` directly in browser console. +if (typeof window !== 'undefined') { + (window as any).web5logger = logger; // Makes `web5Logger` accessible globally in browser +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3252bf6e3..51e115ac0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -343,6 +343,9 @@ importers: multiformats: specifier: 13.1.0 version: 13.1.0 + pino: + specifier: 9.4.0 + version: 9.4.0 readable-stream: specifier: 4.5.2 version: 4.5.2 @@ -2775,6 +2778,10 @@ packages: async@2.6.4: resolution: {integrity: sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==} + atomic-sleep@1.0.0: + resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} + engines: {node: '>=8.0.0'} + audit-ci@7.1.0: resolution: {integrity: sha512-PjjEejlST57S/aDbeWLic0glJ8CNl/ekY3kfGFPMrPkmuaYaDKcMH0F9x9yS9Vp6URhuefSCubl/G0Y2r6oP0g==} engines: {node: '>=16'} @@ -3620,6 +3627,10 @@ packages: fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + fast-redact@3.5.0: + resolution: {integrity: sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==} + engines: {node: '>=6'} + fast-uri@3.0.1: resolution: {integrity: sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==} @@ -4756,6 +4767,10 @@ packages: resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} engines: {node: '>= 0.4'} + on-exit-leak-free@2.1.2: + resolution: {integrity: sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==} + engines: {node: '>=14.0.0'} + on-finished@2.4.1: resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} engines: {node: '>= 0.8'} @@ -4980,6 +4995,16 @@ packages: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} + pino-abstract-transport@1.2.0: + resolution: {integrity: sha512-Guhh8EZfPCfH+PMXAb6rKOjGQEoy0xlAIn+irODG5kgfYV+BQ0rGYYWTIel3P5mmyXqkYkPmdIkywsn6QKUR1Q==} + + pino-std-serializers@7.0.0: + resolution: {integrity: sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==} + + pino@9.4.0: + resolution: {integrity: sha512-nbkQb5+9YPhQRz/BeQmrWpEknAaqjpAqRK8NwJpmrX/JHu7JuZC5G1CeAwJDJfGes4h+YihC6in3Q2nGb+Y09w==} + hasBin: true + pkg-dir@4.2.0: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} @@ -5055,6 +5080,9 @@ packages: process-nextick-args@2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} + process-warning@4.0.0: + resolution: {integrity: sha512-/MyYDxttz7DfGMMHiysAsFE4qF+pQYAA8ziO/3NcRVrQ5fSk+Mns4QZA/oRPFzvcqNoVJXQNWNAsdwBXLUkQKw==} + process@0.11.10: resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} engines: {node: '>= 0.6.0'} @@ -5134,6 +5162,9 @@ packages: queue-tick@1.0.1: resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} + quick-format-unescaped@4.0.4: + resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==} + rabin-wasm@0.1.5: resolution: {integrity: sha512-uWgQTo7pim1Rnj5TuWcCewRDTf0PEFTSlaUjWP4eY9EbLV9em08v89oCz/WO+wRxpYuO36XEHp4wgYQnAgOHzA==} hasBin: true @@ -5190,6 +5221,10 @@ packages: resolution: {integrity: sha512-7KA6+N9IGat52d83dvxnApAWN+MtVb1MiVuMR/cf1O4kYsJG+g/Aav0AHcHKsb6StinayfPLne0+fMX2sOzAKg==} engines: {node: '>=6'} + real-require@0.2.0: + resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==} + engines: {node: '>= 12.13.0'} + regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} @@ -5278,6 +5313,10 @@ packages: resolution: {integrity: sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==} engines: {node: '>= 0.4'} + safe-stable-stringify@2.5.0: + resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==} + engines: {node: '>=10'} + safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} @@ -5384,6 +5423,9 @@ packages: resolution: {integrity: sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==} engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} + sonic-boom@4.1.0: + resolution: {integrity: sha512-NGipjjRicyJJ03rPiZCJYjwlsuP2d1/5QUviozRXC7S3WdVWNK5e3Ojieb9CCyfhq2UC+3+SRd9nG3I2lPRvUw==} + source-map-js@1.2.0: resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} engines: {node: '>=0.10.0'} @@ -5604,6 +5646,9 @@ packages: text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + thread-stream@3.1.0: + resolution: {integrity: sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==} + through2@4.0.2: resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==} @@ -8653,6 +8698,8 @@ snapshots: dependencies: lodash: 4.17.21 + atomic-sleep@1.0.0: {} + audit-ci@7.1.0: dependencies: cross-spawn: 7.0.3 @@ -9852,6 +9899,8 @@ snapshots: fast-levenshtein@2.0.6: {} + fast-redact@3.5.0: {} + fast-uri@3.0.1: {} fast-xml-parser@4.4.1: @@ -11125,6 +11174,8 @@ snapshots: has-symbols: 1.0.3 object-keys: 1.1.1 + on-exit-leak-free@2.1.2: {} + on-finished@2.4.1: dependencies: ee-first: 1.1.1 @@ -11339,6 +11390,27 @@ snapshots: pify@4.0.1: {} + pino-abstract-transport@1.2.0: + dependencies: + readable-stream: 4.5.2 + split2: 4.2.0 + + pino-std-serializers@7.0.0: {} + + pino@9.4.0: + dependencies: + atomic-sleep: 1.0.0 + fast-redact: 3.5.0 + on-exit-leak-free: 2.1.2 + pino-abstract-transport: 1.2.0 + pino-std-serializers: 7.0.0 + process-warning: 4.0.0 + quick-format-unescaped: 4.0.4 + real-require: 0.2.0 + safe-stable-stringify: 2.5.0 + sonic-boom: 4.1.0 + thread-stream: 3.1.0 + pkg-dir@4.2.0: dependencies: find-up: 4.1.0 @@ -11409,6 +11481,8 @@ snapshots: process-nextick-args@2.0.1: {} + process-warning@4.0.0: {} + process@0.11.10: {} progress-events@1.0.1: {} @@ -11498,6 +11572,8 @@ snapshots: queue-tick@1.0.1: {} + quick-format-unescaped@4.0.4: {} + rabin-wasm@0.1.5: dependencies: '@assemblyscript/loader': 0.9.4 @@ -11586,6 +11662,8 @@ snapshots: readline-transform@1.0.0: {} + real-require@0.2.0: {} + regenerator-runtime@0.14.1: {} regexp.prototype.flags@1.5.2: @@ -11692,6 +11770,8 @@ snapshots: es-errors: 1.3.0 is-regex: 1.1.4 + safe-stable-stringify@2.5.0: {} + safer-buffer@2.1.2: {} schema-utils@3.3.0: @@ -11829,6 +11909,10 @@ snapshots: ip-address: 9.0.5 smart-buffer: 4.2.0 + sonic-boom@4.1.0: + dependencies: + atomic-sleep: 1.0.0 + source-map-js@1.2.0: {} source-map-loader@4.0.2(webpack@5.93.0(esbuild@0.19.8)): @@ -12108,6 +12192,10 @@ snapshots: text-table@0.2.0: {} + thread-stream@3.1.0: + dependencies: + real-require: 0.2.0 + through2@4.0.2: dependencies: readable-stream: 3.6.2 From a9e73fcb9c6f89eae2d6b0798e574f30685f4057 Mon Sep 17 00:00:00 2001 From: Henry Tsai Date: Fri, 4 Oct 2024 12:58:31 -0700 Subject: [PATCH 7/8] Removed logger and logging --- packages/agent/src/connect.ts | 3 +- packages/agent/src/oidc.ts | 15 +----- packages/common/package.json | 1 - packages/common/src/index.ts | 1 - packages/common/src/logger.ts | 73 ----------------------------- pnpm-lock.yaml | 88 ----------------------------------- 6 files changed, 2 insertions(+), 179 deletions(-) delete mode 100644 packages/common/src/logger.ts diff --git a/packages/agent/src/connect.ts b/packages/agent/src/connect.ts index fb19b9983..9208d3f39 100644 --- a/packages/agent/src/connect.ts +++ b/packages/agent/src/connect.ts @@ -7,7 +7,7 @@ import { } from './oidc.js'; import { pollWithTtl } from './utils.js'; -import { Convert, logger } from '@web5/common'; +import { Convert } from '@web5/common'; import { CryptoUtils } from '@web5/crypto'; import { DidJwk } from '@web5/dids'; import { DwnInterfaceName, DwnMethodName } from '@tbd54566975/dwn-sdk-js'; @@ -94,7 +94,6 @@ async function initClient({ // a deeplink to a web5 compatible wallet. if the wallet scans this link it should receive // a route to its web5 connect provider flow and the params of where to fetch the auth request. - logger.log(`Wallet URI: ${walletUri}`); const generatedWalletUri = new URL(walletUri); generatedWalletUri.searchParams.set('request_uri', parData.request_uri); generatedWalletUri.searchParams.set( diff --git a/packages/agent/src/oidc.ts b/packages/agent/src/oidc.ts index 076a0b72a..615fee38a 100644 --- a/packages/agent/src/oidc.ts +++ b/packages/agent/src/oidc.ts @@ -1,4 +1,4 @@ -import { Convert, logger, RequireOnly } from '@web5/common'; +import { Convert, RequireOnly } from '@web5/common'; import { Ed25519, EdDsaAlgorithm, @@ -631,7 +631,6 @@ async function createPermissionGrants( const permissionsApi = new AgentPermissionsApi({ agent }); // TODO: cleanup all grants if one fails by deleting them from the DWN: https://github.com/TBD54566975/web5-js/issues/849 - logger.log(`Creating permission grants for ${scopes.length} scopes given...`); const permissionGrants = await Promise.all( scopes.map((scope) => { // check if the scope is a records permission scope, or a protocol configure scope, if so it should use a delegated permission. @@ -647,7 +646,6 @@ async function createPermissionGrants( }) ); - logger.log(`Sending ${permissionGrants.length} permission grants to remote DWN...`); const messagePromises = permissionGrants.map(async (grant) => { // Quirk: we have to pull out encodedData out of the message the schema validator doesn't want it there const { encodedData, ...rawMessage } = grant.message; @@ -663,8 +661,6 @@ async function createPermissionGrants( // check if the message was sent successfully, if the remote returns 409 the message may have come through already via sync if (reply.status.code !== 202 && reply.status.code !== 409) { - logger.error(`Error sending RecordsWrite: ${reply.status.detail}`); - logger.error(`RecordsWrite message: ${rawMessage}`); throw new Error( `Could not send the message. Error details: ${reply.status.detail}` ); @@ -677,7 +673,6 @@ async function createPermissionGrants( const messages = await Promise.all(messagePromises); return messages; } catch (error) { - logger.error(`Error during batch-send of permission grants: ${error}`); throw error; } } @@ -704,8 +699,6 @@ async function prepareProtocol( `Could not fetch protocol: ${queryMessage.reply.status.detail}` ); } else if (queryMessage.reply.entries === undefined || queryMessage.reply.entries.length === 0) { - logger.log(`Protocol does not exist, creating: ${protocolDefinition.protocol}`); - // send the protocol definition to the remote DWN first, if it passes we can process it locally const { reply: sendReply, message: configureMessage } = await agent.sendDwnRequest({ author : selectedDid, @@ -728,8 +721,6 @@ async function prepareProtocol( }); } else { - logger.log(`Protocol already exists: ${protocolDefinition.protocol}`); - // the protocol already exists, let's make sure it exists on the remote DWN as the requesting app will need it const configureMessage = queryMessage.reply.entries![0]; const { reply: sendReply } = await agent.sendDwnRequest({ @@ -789,7 +780,6 @@ async function submitAuthResponse( const delegateGrants = (await Promise.all(delegateGrantPromises)).flat(); - logger.log('Generating auth response object...'); const responseObject = await Oidc.createResponseObject({ //* the IDP's did that was selected to be connected iss : selectedDid, @@ -804,7 +794,6 @@ async function submitAuthResponse( }); // Sign the Response Object using the ephemeral DID's signing key. - logger.log('Signing auth response object...'); const responseObjectJwt = await Oidc.signJwt({ did : delegateBearerDid, data : responseObject, @@ -816,7 +805,6 @@ async function submitAuthResponse( clientDid?.didDocument! ); - logger.log('Encrypting auth response object...'); const encryptedResponse = Oidc.encryptAuthResponse({ jwt : responseObjectJwt!, encryptionKey : sharedKey, @@ -829,7 +817,6 @@ async function submitAuthResponse( state : authRequest.state, }).toString(); - logger.log(`Sending auth response object to Web5 Connect server: ${authRequest.redirect_uri}`); await fetch(authRequest.redirect_uri, { body : formEncodedRequest, method : 'POST', diff --git a/packages/common/package.json b/packages/common/package.json index 5af21e6d6..8250fcb68 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -72,7 +72,6 @@ "@isaacs/ttlcache": "1.4.1", "level": "8.0.1", "multiformats": "13.1.0", - "pino": "9.4.0", "readable-stream": "4.5.2" }, "devDependencies": { diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index 0f4b01691..1a6095561 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -2,7 +2,6 @@ export type * from './types.js'; export * from './cache.js'; export * from './convert.js'; -export * from './logger.js'; export * from './multicodec.js'; export * from './object.js'; export * from './stores.js'; diff --git a/packages/common/src/logger.ts b/packages/common/src/logger.ts deleted file mode 100644 index 254113c79..000000000 --- a/packages/common/src/logger.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { pino, LoggerOptions } from 'pino'; - -export enum Web5LogLevel { - Debug = 'debug', - Silent = 'silent', -} - -/** - * Web5 logger interface. - */ -export interface Web5LoggerInterface { - - /** - * Sets the log verbose level. - */ - setLogLevel(logLevel: Web5LogLevel): void; - - /** - * Same as `info()`. - * Logs an informational message. - */ - log (message: string): void; - - /** - * Logs an informational message. - */ - info(message: string): void; - - /** - * Logs an error message. - */ - error(message: string): void; -} - -/** - * A Web5 logger implementation. - */ -class Web5Logger implements Web5LoggerInterface { - private pinoLogger; - - public constructor() { - const loggerOptions: LoggerOptions = { - level: 'silent', // Default to 'silent' log level - }; - - this.pinoLogger = pino(loggerOptions); - } - - setLogLevel(logLevel: Web5LogLevel): void { - this.pinoLogger.level = logLevel; - } - - public log(message: string): void { - this.info(message); - } - - public info(message: string): void { - this.pinoLogger.info(message); - } - - public error(message: string): void { - this.pinoLogger.error(message); - } -} - -// Export a singleton logger instance -export const logger = new Web5Logger(); - -// Attach logger to the global window object in browser environment for easy access to the logger instance. -// e.g. can call `web5logger.setLogLevel('debug');` directly in browser console. -if (typeof window !== 'undefined') { - (window as any).web5logger = logger; // Makes `web5Logger` accessible globally in browser -} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 51e115ac0..3252bf6e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -343,9 +343,6 @@ importers: multiformats: specifier: 13.1.0 version: 13.1.0 - pino: - specifier: 9.4.0 - version: 9.4.0 readable-stream: specifier: 4.5.2 version: 4.5.2 @@ -2778,10 +2775,6 @@ packages: async@2.6.4: resolution: {integrity: sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==} - atomic-sleep@1.0.0: - resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} - engines: {node: '>=8.0.0'} - audit-ci@7.1.0: resolution: {integrity: sha512-PjjEejlST57S/aDbeWLic0glJ8CNl/ekY3kfGFPMrPkmuaYaDKcMH0F9x9yS9Vp6URhuefSCubl/G0Y2r6oP0g==} engines: {node: '>=16'} @@ -3627,10 +3620,6 @@ packages: fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - fast-redact@3.5.0: - resolution: {integrity: sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==} - engines: {node: '>=6'} - fast-uri@3.0.1: resolution: {integrity: sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==} @@ -4767,10 +4756,6 @@ packages: resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} engines: {node: '>= 0.4'} - on-exit-leak-free@2.1.2: - resolution: {integrity: sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==} - engines: {node: '>=14.0.0'} - on-finished@2.4.1: resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} engines: {node: '>= 0.8'} @@ -4995,16 +4980,6 @@ packages: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} - pino-abstract-transport@1.2.0: - resolution: {integrity: sha512-Guhh8EZfPCfH+PMXAb6rKOjGQEoy0xlAIn+irODG5kgfYV+BQ0rGYYWTIel3P5mmyXqkYkPmdIkywsn6QKUR1Q==} - - pino-std-serializers@7.0.0: - resolution: {integrity: sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==} - - pino@9.4.0: - resolution: {integrity: sha512-nbkQb5+9YPhQRz/BeQmrWpEknAaqjpAqRK8NwJpmrX/JHu7JuZC5G1CeAwJDJfGes4h+YihC6in3Q2nGb+Y09w==} - hasBin: true - pkg-dir@4.2.0: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} @@ -5080,9 +5055,6 @@ packages: process-nextick-args@2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} - process-warning@4.0.0: - resolution: {integrity: sha512-/MyYDxttz7DfGMMHiysAsFE4qF+pQYAA8ziO/3NcRVrQ5fSk+Mns4QZA/oRPFzvcqNoVJXQNWNAsdwBXLUkQKw==} - process@0.11.10: resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} engines: {node: '>= 0.6.0'} @@ -5162,9 +5134,6 @@ packages: queue-tick@1.0.1: resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} - quick-format-unescaped@4.0.4: - resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==} - rabin-wasm@0.1.5: resolution: {integrity: sha512-uWgQTo7pim1Rnj5TuWcCewRDTf0PEFTSlaUjWP4eY9EbLV9em08v89oCz/WO+wRxpYuO36XEHp4wgYQnAgOHzA==} hasBin: true @@ -5221,10 +5190,6 @@ packages: resolution: {integrity: sha512-7KA6+N9IGat52d83dvxnApAWN+MtVb1MiVuMR/cf1O4kYsJG+g/Aav0AHcHKsb6StinayfPLne0+fMX2sOzAKg==} engines: {node: '>=6'} - real-require@0.2.0: - resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==} - engines: {node: '>= 12.13.0'} - regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} @@ -5313,10 +5278,6 @@ packages: resolution: {integrity: sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==} engines: {node: '>= 0.4'} - safe-stable-stringify@2.5.0: - resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==} - engines: {node: '>=10'} - safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} @@ -5423,9 +5384,6 @@ packages: resolution: {integrity: sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==} engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} - sonic-boom@4.1.0: - resolution: {integrity: sha512-NGipjjRicyJJ03rPiZCJYjwlsuP2d1/5QUviozRXC7S3WdVWNK5e3Ojieb9CCyfhq2UC+3+SRd9nG3I2lPRvUw==} - source-map-js@1.2.0: resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} engines: {node: '>=0.10.0'} @@ -5646,9 +5604,6 @@ packages: text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - thread-stream@3.1.0: - resolution: {integrity: sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==} - through2@4.0.2: resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==} @@ -8698,8 +8653,6 @@ snapshots: dependencies: lodash: 4.17.21 - atomic-sleep@1.0.0: {} - audit-ci@7.1.0: dependencies: cross-spawn: 7.0.3 @@ -9899,8 +9852,6 @@ snapshots: fast-levenshtein@2.0.6: {} - fast-redact@3.5.0: {} - fast-uri@3.0.1: {} fast-xml-parser@4.4.1: @@ -11174,8 +11125,6 @@ snapshots: has-symbols: 1.0.3 object-keys: 1.1.1 - on-exit-leak-free@2.1.2: {} - on-finished@2.4.1: dependencies: ee-first: 1.1.1 @@ -11390,27 +11339,6 @@ snapshots: pify@4.0.1: {} - pino-abstract-transport@1.2.0: - dependencies: - readable-stream: 4.5.2 - split2: 4.2.0 - - pino-std-serializers@7.0.0: {} - - pino@9.4.0: - dependencies: - atomic-sleep: 1.0.0 - fast-redact: 3.5.0 - on-exit-leak-free: 2.1.2 - pino-abstract-transport: 1.2.0 - pino-std-serializers: 7.0.0 - process-warning: 4.0.0 - quick-format-unescaped: 4.0.4 - real-require: 0.2.0 - safe-stable-stringify: 2.5.0 - sonic-boom: 4.1.0 - thread-stream: 3.1.0 - pkg-dir@4.2.0: dependencies: find-up: 4.1.0 @@ -11481,8 +11409,6 @@ snapshots: process-nextick-args@2.0.1: {} - process-warning@4.0.0: {} - process@0.11.10: {} progress-events@1.0.1: {} @@ -11572,8 +11498,6 @@ snapshots: queue-tick@1.0.1: {} - quick-format-unescaped@4.0.4: {} - rabin-wasm@0.1.5: dependencies: '@assemblyscript/loader': 0.9.4 @@ -11662,8 +11586,6 @@ snapshots: readline-transform@1.0.0: {} - real-require@0.2.0: {} - regenerator-runtime@0.14.1: {} regexp.prototype.flags@1.5.2: @@ -11770,8 +11692,6 @@ snapshots: es-errors: 1.3.0 is-regex: 1.1.4 - safe-stable-stringify@2.5.0: {} - safer-buffer@2.1.2: {} schema-utils@3.3.0: @@ -11909,10 +11829,6 @@ snapshots: ip-address: 9.0.5 smart-buffer: 4.2.0 - sonic-boom@4.1.0: - dependencies: - atomic-sleep: 1.0.0 - source-map-js@1.2.0: {} source-map-loader@4.0.2(webpack@5.93.0(esbuild@0.19.8)): @@ -12192,10 +12108,6 @@ snapshots: text-table@0.2.0: {} - thread-stream@3.1.0: - dependencies: - real-require: 0.2.0 - through2@4.0.2: dependencies: readable-stream: 3.6.2 From 5087f2a605daa274fbe2e842e2afa806a9779587 Mon Sep 17 00:00:00 2001 From: Henry Tsai Date: Fri, 4 Oct 2024 13:01:35 -0700 Subject: [PATCH 8/8] lint --- packages/agent/src/oidc.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/agent/src/oidc.ts b/packages/agent/src/oidc.ts index 615fee38a..dc40917c4 100644 --- a/packages/agent/src/oidc.ts +++ b/packages/agent/src/oidc.ts @@ -669,12 +669,8 @@ async function createPermissionGrants( return grant.message; }); - try { - const messages = await Promise.all(messagePromises); - return messages; - } catch (error) { - throw error; - } + const messages = await Promise.all(messagePromises); + return messages; } /**