diff --git a/packages/auth-helpers/src/lib/recap/recap-session-capability-object.ts b/packages/auth-helpers/src/lib/recap/recap-session-capability-object.ts index 33a7d3fa4..0aaeb3bcd 100644 --- a/packages/auth-helpers/src/lib/recap/recap-session-capability-object.ts +++ b/packages/auth-helpers/src/lib/recap/recap-session-capability-object.ts @@ -13,13 +13,13 @@ import { sanitizeSiweMessage } from '../siwe/siwe-helper'; import { AuthSig } from '../models'; export class RecapSessionCapabilityObject implements ISessionCapabilityObject { - #inner: Recap; + private _inner: Recap; constructor( att: AttenuationsObject = {}, prf: Array | Array = [] ) { - this.#inner = new Recap(att, prf); + this._inner = new Recap(att, prf); } /** @@ -46,19 +46,19 @@ export class RecapSessionCapabilityObject implements ISessionCapabilityObject { } get attenuations(): AttenuationsObject { - return this.#inner.attenuations; + return this._inner.attenuations; } get proofs(): Array { - return this.#inner.proofs.map((cid: any) => cid.toString()); + return this._inner.proofs.map((cid: any) => cid.toString()); } get statement(): string { - return sanitizeSiweMessage(this.#inner.statement); + return sanitizeSiweMessage(this._inner.statement); } addProof(proof: string): void { - return this.#inner.addProof(proof); + return this._inner.addProof(proof); } addAttenuation( @@ -67,15 +67,15 @@ export class RecapSessionCapabilityObject implements ISessionCapabilityObject { name: string = '*', restriction: { [key: string]: PlainJSON } = {} ) { - return this.#inner.addAttenuation(resource, namespace, name, restriction); + return this._inner.addAttenuation(resource, namespace, name, restriction); } addToSiweMessage(siwe: SiweMessage): SiweMessage { - return this.#inner.add_to_siwe_message(siwe); + return this._inner.add_to_siwe_message(siwe); } encodeAsSiweResource(): string { - return this.#inner.encode(); + return this._inner.encode(); } /** LIT specific methods */ @@ -129,7 +129,7 @@ export class RecapSessionCapabilityObject implements ISessionCapabilityObject { // Find an attenuated resource key to match against. const attenuatedResourceKey = - this.#getResourceKeyToMatchAgainst(litResource); + this._getResourceKeyToMatchAgainst(litResource); if (!attenuations[attenuatedResourceKey]) { // No attenuations specified for this resource. @@ -171,7 +171,7 @@ export class RecapSessionCapabilityObject implements ISessionCapabilityObject { * * Then, if the provided litResource is 'lit-acc://123', the method will return 'lit-acc://*'. */ - #getResourceKeyToMatchAgainst(litResource: ILitResource): string { + private _getResourceKeyToMatchAgainst(litResource: ILitResource): string { const attenuatedResourceKeysToMatchAgainst: string[] = [ `${litResource.resourcePrefix}://*`, litResource.getResourceKey(), diff --git a/packages/core/src/lib/lit-core.ts b/packages/core/src/lib/lit-core.ts index e2aecef17..8ebe09dc1 100644 --- a/packages/core/src/lib/lit-core.ts +++ b/packages/core/src/lib/lit-core.ts @@ -276,7 +276,7 @@ export class LitCore { this._epochUpdateTimeout = setTimeout(async () => { try { - this.currentEpochNumber = await this.fetchCurrentEpochNumber(); + this.currentEpochNumber = await this._fetchCurrentEpochNumber(); } catch (e) { // Don't let errors here bubble up to be unhandle rejections in the runtime! logError('Error while attempting to fetch current epoch number'); @@ -534,7 +534,7 @@ export class LitCore { // Already scheduled update for current epoch number (due to a recent epoch change) // Skip setting it right now, because we haven't waited long enough for nodes to propagate the new epoch if (!this._epochUpdateTimeout) { - this.currentEpochNumber = await this.fetchCurrentEpochNumber(); + this.currentEpochNumber = await this._fetchCurrentEpochNumber(); } // -- handshake with each node. Note that if we've previously initialized successfully, but this call fails, @@ -566,7 +566,7 @@ export class LitCore { } } - private async handshakeAndVerifyNodeAttestation({ + private async _handshakeAndVerifyNodeAttestation({ url, requestId, }: { @@ -701,7 +701,7 @@ export class LitCore { }), Promise.all( this.config.bootstrapUrls.map(async (url) => { - serverKeys[url] = await this.handshakeAndVerifyNodeAttestation({ + serverKeys[url] = await this._handshakeAndVerifyNodeAttestation({ url, requestId, }); @@ -888,7 +888,7 @@ export class LitCore { }); }; - private async fetchCurrentEpochNumber() { + private async _fetchCurrentEpochNumber() { if (!this._stakingContract) { return throwError({ message: diff --git a/packages/lit-auth-client/src/lib/providers/DiscordProvider.ts b/packages/lit-auth-client/src/lib/providers/DiscordProvider.ts index 2d9c4c80c..b7aafe0ec 100644 --- a/packages/lit-auth-client/src/lib/providers/DiscordProvider.ts +++ b/packages/lit-auth-client/src/lib/providers/DiscordProvider.ts @@ -164,7 +164,7 @@ export default class DiscordProvider extends BaseProvider { * @returns {Promise} - Auth method id */ public async getAuthMethodId(authMethod: AuthMethod): Promise { - const userId = await this.#fetchDiscordUser(authMethod.accessToken); + const userId = await this._fetchDiscordUser(authMethod.accessToken); const authMethodId = ethers.utils.keccak256( ethers.utils.toUtf8Bytes(`${userId}:${this.clientId}`) ); @@ -207,7 +207,7 @@ export default class DiscordProvider extends BaseProvider { * * @returns {Promise} - Discord user ID */ - async #fetchDiscordUser(accessToken: string): Promise { + private async _fetchDiscordUser(accessToken: string): Promise { const meResponse = await fetch('https://discord.com/api/users/@me', { method: 'GET', headers: { diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index a52030116..f330227ba 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -448,7 +448,7 @@ export class LitNodeClientNodeJs return walletSig!; }; - #authCallbackAndUpdateStorageItem = async ({ + private _authCallbackAndUpdateStorageItem = async ({ authCallbackParams, authCallback, }: { @@ -639,7 +639,7 @@ export class LitNodeClientNodeJs return finalJwt; }; - #decryptWithSignatureShares = ( + private _decryptWithSignatureShares = ( networkPubKey: string, identityParam: Uint8Array, ciphertext: string, @@ -1460,7 +1460,7 @@ export class LitNodeClientNodeJs ); // ========== Assemble identity parameter ========== - const identityParam = this.#getIdentityParamForEncryption( + const identityParam = this._getIdentityParamForEncryption( hashOfConditionsStr, hashOfPrivateDataStr ); @@ -1554,7 +1554,7 @@ export class LitNodeClientNodeJs } // ========== Assemble identity parameter ========== - const identityParam = this.#getIdentityParamForEncryption( + const identityParam = this._getIdentityParamForEncryption( hashOfConditionsStr, dataToEncryptHash ); @@ -1613,7 +1613,7 @@ export class LitNodeClientNodeJs logWithRequestId(requestId, 'signatureShares', signatureShares); // ========== Result ========== - const decryptedData = this.#decryptWithSignatureShares( + const decryptedData = this._decryptWithSignatureShares( this.subnetPubKey, uint8arrayFromString(identityParam, 'utf8'), ciphertext, @@ -1660,7 +1660,7 @@ export class LitNodeClientNodeJs ); }; - #getIdentityParamForEncryption = ( + private _getIdentityParamForEncryption = ( hashOfConditionsStr: string, hashOfPrivateDataStr: string ): string => { @@ -1804,7 +1804,7 @@ export class LitNodeClientNodeJs logWithRequestId(requestId, 'handleNodePromises res:', res); // -- case: promises rejected - if (!this.#isSuccessNodePromises(res)) { + if (!this._isSuccessNodePromises(res)) { this._throwNodeError(res as RejectedNodePromises, requestId); return {} as SignSessionKeyResponse; } @@ -1947,7 +1947,7 @@ export class LitNodeClientNodeJs return signSessionKeyRes; }; - #isSuccessNodePromises = ( + private _isSuccessNodePromises = ( res: SuccessNodePromises | RejectedNodePromises ): res is SuccessNodePromises => { return res.success; @@ -2061,7 +2061,7 @@ const resourceAbilityRequests = [ // -- (CHECK) if we need to resign the session key if (needToResignSessionKey) { log('need to re-sign session key. Signing...'); - authSig = await this.#authCallbackAndUpdateStorageItem({ + authSig = await this._authCallbackAndUpdateStorageItem({ authCallback: params.authNeededCallback, authCallbackParams: { chain: params.chain || 'ethereum', diff --git a/packages/lit-node-client/src/lib/lit-node-client.ts b/packages/lit-node-client/src/lib/lit-node-client.ts index 7d84a9c69..c10caa81f 100644 --- a/packages/lit-node-client/src/lib/lit-node-client.ts +++ b/packages/lit-node-client/src/lib/lit-node-client.ts @@ -26,7 +26,7 @@ export class LitNodeClient extends LitNodeClientNodeJs { }); // -- override configs - this.overrideConfigsFromLocalStorage(); + this._overrideConfigsFromLocalStorage(); } /** @@ -36,7 +36,7 @@ export class LitNodeClient extends LitNodeClientNodeJs { * @returns { void } * */ - overrideConfigsFromLocalStorage = (): void => { + private _overrideConfigsFromLocalStorage = (): void => { if (isNode()) return; const storageKey = 'LitNodeClientConfig'; diff --git a/yarn.lock b/yarn.lock index cd22f387d..a4b97588b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== + "@ampproject/remapping@^2.2.0": version "2.3.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" @@ -3153,7 +3158,7 @@ hey-listen "^1.0.8" tslib "^2.3.1" -"@motionone/easing@^10.18.0": +"@motionone/easing@^10.17.0", "@motionone/easing@^10.18.0": version "10.18.0" resolved "https://registry.yarnpkg.com/@motionone/easing/-/easing-10.18.0.tgz#7b82f6010dfee3a1bb0ee83abfbaff6edae0c708" integrity sha512-VcjByo7XpdLS4o9T8t99JtgxkdMcNWD3yHU/n6CLEz3bkmKDRZyYQ/wmSf6daum8ZXqfUAgFeCZSpJZIMxaCzg== @@ -3178,12 +3183,12 @@ "@motionone/dom" "^10.16.4" tslib "^2.3.1" -"@motionone/types@^10.15.1", "@motionone/types@^10.17.1": +"@motionone/types@^10.15.1", "@motionone/types@^10.17.0", "@motionone/types@^10.17.1": version "10.17.1" resolved "https://registry.yarnpkg.com/@motionone/types/-/types-10.17.1.tgz#cf487badbbdc9da0c2cb86ffc1e5d11147c6e6fb" integrity sha512-KaC4kgiODDz8hswCrS0btrVrzyU2CSQKO7Ps90ibBVSQmjkrt2teqta6/sOG59v7+dPnKMAg13jyqtMKV2yJ7A== -"@motionone/utils@^10.15.1", "@motionone/utils@^10.18.0": +"@motionone/utils@^10.15.1", "@motionone/utils@^10.17.0", "@motionone/utils@^10.18.0": version "10.18.0" resolved "https://registry.yarnpkg.com/@motionone/utils/-/utils-10.18.0.tgz#a59ff8932ed9009624bca07c56b28ef2bb2f885e" integrity sha512-3XVF7sgyTSI2KWvTf6uLlBJ5iAgRgmvp3bpuOiQJvInd4nZ19ET8lX5unn30SlmRH7hXbBbH+Gxd0m0klJ3Xtw== @@ -8023,7 +8028,7 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" -braces@^3.0.3, braces@~3.0.2: +braces@^3.0.2, braces@^3.0.3, braces@~3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==