Skip to content

Commit 4932528

Browse files
feat(auth): LIT-4211 - Define @lit-protocol/auth package
- Migrated `lit-auth-client` providers and relayer module to auth package - Collapsed `auth-browser` into `auth` package as an authenticator - `MetamaskAuthenticator`
1 parent c943535 commit 4932528

File tree

37 files changed

+93
-375
lines changed

37 files changed

+93
-375
lines changed

.vscode/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"todo-tree.tree.scanMode": "workspace",
44
"conventionalCommits.scopes": [
55
"contracts-sdk",
6-
"lit-node-client-nodejs",
7-
"core",
6+
"lit-node-client",
7+
"core"
88
],
99
"workbench.colorCustomizations": {
1010
"activityBar.activeBackground": "#2f7c47",
@@ -52,4 +52,4 @@
5252
// ]
5353
// }
5454
// ]
55-
}
55+
}

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ yarn add @lit-protocol/lit-node-client
5050

5151
<!-- autogen:package:start -->
5252

53-
| Package | Category | Download |
54-
| -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55-
| [@lit-protocol/lit-node-client-nodejs](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/lit-node-client-nodejs) | ![lit-node-client-nodejs](https://img.shields.io/badge/-nodejs-2E8B57 'lit-node-client-nodejs') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/lit-node-client-nodejs"><img src="https://img.shields.io/npm/v/@lit-protocol/lit-node-client-nodejs"/></a> |
56-
| [@lit-protocol/lit-node-client](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/lit-node-client) | ![lit-node-client](https://img.shields.io/badge/-universal-8A6496 'lit-node-client') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/lit-node-client"><img src="https://img.shields.io/npm/v/@lit-protocol/lit-node-client"/></a> |
53+
| Package | Category | Download |
54+
| ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55+
| [@lit-protocol/lit-node-client](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/lit-node-client) | ![lit-node-client](https://img.shields.io/badge/-nodejs-2E8B57 'lit-node-client') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/lit-node-client"><img src="https://img.shields.io/npm/v/@lit-protocol/lit-node-client"/></a> |
5756

5857
If you're a tech-savvy user and wish to utilize only specific submodules that our main module relies upon, you can find individual packages listed below. This way, you can import only the necessary packages that cater to your specific use case::
5958

6059
| Package | Category | Download |
6160
| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
6261
| [@lit-protocol/access-control-conditions](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/access-control-conditions) | ![access-control-conditions](https://img.shields.io/badge/-universal-8A6496 'access-control-conditions') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/access-control-conditions"><img src="https://img.shields.io/npm/v/@lit-protocol/access-control-conditions"/></a> |
62+
| [@lit-protocol/auth](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/auth) | ![auth](https://img.shields.io/badge/-universal-8A6496 'auth') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/auth"><img src="https://img.shields.io/npm/v/@lit-protocol/auth"/></a> |
6363
| [@lit-protocol/auth-helpers](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/auth-helpers) | ![auth-helpers](https://img.shields.io/badge/-universal-8A6496 'auth-helpers') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/auth-helpers"><img src="https://img.shields.io/npm/v/@lit-protocol/auth-helpers"/></a> |
6464
| [@lit-protocol/constants](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/constants) | ![constants](https://img.shields.io/badge/-universal-8A6496 'constants') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/constants"><img src="https://img.shields.io/npm/v/@lit-protocol/constants"/></a> |
6565
| [@lit-protocol/contracts-sdk](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/contracts-sdk) | ![contracts-sdk](https://img.shields.io/badge/-universal-8A6496 'contracts-sdk') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/contracts-sdk"><img src="https://img.shields.io/npm/v/@lit-protocol/contracts-sdk"/></a> |
@@ -70,6 +70,7 @@ If you're a tech-savvy user and wish to utilize only specific submodules that ou
7070
| [@lit-protocol/logger](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/logger) | ![logger](https://img.shields.io/badge/-universal-8A6496 'logger') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/logger"><img src="https://img.shields.io/npm/v/@lit-protocol/logger"/></a> |
7171
| [@lit-protocol/misc](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/misc) | ![misc](https://img.shields.io/badge/-universal-8A6496 'misc') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/misc"><img src="https://img.shields.io/npm/v/@lit-protocol/misc"/></a> |
7272
| [@lit-protocol/nacl](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/nacl) | ![nacl](https://img.shields.io/badge/-universal-8A6496 'nacl') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/nacl"><img src="https://img.shields.io/npm/v/@lit-protocol/nacl"/></a> |
73+
| [@lit-protocol/networks](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/networks) | ![networks](https://img.shields.io/badge/-universal-8A6496 'networks') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/networks"><img src="https://img.shields.io/npm/v/@lit-protocol/networks"/></a> |
7374
| [@lit-protocol/pkp-base](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-base) | ![pkp-base](https://img.shields.io/badge/-universal-8A6496 'pkp-base') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/pkp-base"><img src="https://img.shields.io/npm/v/@lit-protocol/pkp-base"/></a> |
7475
| [@lit-protocol/pkp-cosmos](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-cosmos) | ![pkp-cosmos](https://img.shields.io/badge/-universal-8A6496 'pkp-cosmos') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/pkp-cosmos"><img src="https://img.shields.io/npm/v/@lit-protocol/pkp-cosmos"/></a> |
7576
| [@lit-protocol/pkp-ethers](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/pkp-ethers) | ![pkp-ethers](https://img.shields.io/badge/-universal-8A6496 'pkp-ethers') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/pkp-ethers"><img src="https://img.shields.io/npm/v/@lit-protocol/pkp-ethers"/></a> |
@@ -80,7 +81,6 @@ If you're a tech-savvy user and wish to utilize only specific submodules that ou
8081
| [@lit-protocol/wasm](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/wasm) | ![wasm](https://img.shields.io/badge/-universal-8A6496 'wasm') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/wasm"><img src="https://img.shields.io/npm/v/@lit-protocol/wasm"/></a> |
8182
| [@lit-protocol/wrapped-keys](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/wrapped-keys) | ![wrapped-keys](https://img.shields.io/badge/-universal-8A6496 'wrapped-keys') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/wrapped-keys"><img src="https://img.shields.io/npm/v/@lit-protocol/wrapped-keys"/></a> |
8283
| [@lit-protocol/wrapped-keys-lit-actions](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/wrapped-keys-lit-actions) | ![wrapped-keys-lit-actions](https://img.shields.io/badge/-universal-8A6496 'wrapped-keys-lit-actions') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/wrapped-keys-lit-actions"><img src="https://img.shields.io/npm/v/@lit-protocol/wrapped-keys-lit-actions"/></a> |
83-
| [@lit-protocol/auth-browser](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/auth-browser) | ![auth-browser](https://img.shields.io/badge/-browser-E98869 'auth-browser') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/auth-browser"><img src="https://img.shields.io/npm/v/@lit-protocol/auth-browser"/></a> |
8484
| [@lit-protocol/misc-browser](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/misc-browser) | ![misc-browser](https://img.shields.io/badge/-browser-E98869 'misc-browser') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/misc-browser"><img src="https://img.shields.io/npm/v/@lit-protocol/misc-browser"/></a> |
8585

8686
<!-- autogen:package:end -->

local-tests/README.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,3 @@ The `TinnyPerson` class encapsulates various functionalities to manage wallet op
122122
| `createCapacityDelegationAuthSig(addresses)` | Mints a Capacity Credits NFT and creates an authentication signature for delegating capacity, which can be used to authorize other addresses to use the minted credits. |
123123

124124
##
125-
126-
# esbuild benchmark
127-
128-
```ts
129-
// test-bundle-speed.ts
130-
export const testBundleSpeed = async (devEnv: TinnyEnvironment) => {
131-
const a = await import('@lit-protocol/lit-node-client');
132-
const b = await import('@lit-protocol/contracts-sdk');
133-
const c = await import('@lit-protocol/auth-helpers');
134-
const d = await import('@lit-protocol/constants');
135-
const e = await import('@lit-protocol/lit-auth-client');
136-
137-
console.log(a, b, c, d, e);
138-
};
139-
// ----------------
140-
// Build time: 77ms
141-
// ----------------
142-
```

local-tests/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@
8989
"@solana/web3.js": "^1.95.3",
9090
"bech32": "^2.0.0",
9191
"pako": "^2.1.0",
92-
"@lit-protocol/misc": "^7.0.0",
93-
"@lit-protocol/lit-node-client": "^7.0.0",
94-
"@lit-protocol/lit-auth-client": "^7.0.0",
92+
"@lit-protocol/misc": "8.0.0-alpha.0",
93+
"@lit-protocol/lit-node-client": "8.0.0-alpha.0",
94+
"@lit-protocol/auth": "8.0.0-alpha.0",
9595
"@lit-protocol/contracts": "^0.0.71"
9696
}
9797
}

local-tests/setup/tinny-person.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ import {
1111
} from '@lit-protocol/types';
1212
import { ethers } from 'ethers';
1313
import { PKPInfo, TinnyEnvConfig } from './tinny-config';
14-
import { EthWalletProvider } from '@lit-protocol/lit-auth-client';
1514
import { AUTH_METHOD_SCOPE, LIT_NETWORK } from '@lit-protocol/constants';
1615

16+
import { authenticators } from '@lit-protocol/auth';
17+
18+
const { MetamaskAuthenticator } = authenticators;
19+
1720
export class TinnyPerson {
1821
public privateKey: string;
1922
public wallet: ethers.Wallet;
@@ -53,7 +56,7 @@ export class TinnyPerson {
5356
}
5457

5558
async getAuthMethodId(): Promise<string> {
56-
return EthWalletProvider.authMethodId(this.authMethod);
59+
return MetamaskAuthenticator.authMethodId(this.authMethod);
5760
}
5861

5962
/**
@@ -116,7 +119,7 @@ export class TinnyPerson {
116119
console.log(
117120
'[𐬺🧪 Tinny Person𐬺] Crafting an authMethod from the authSig for the eth wallet auth method...'
118121
);
119-
this.authMethod = await EthWalletProvider.authenticate({
122+
this.authMethod = await MetamaskAuthenticator.authenticate({
120123
signer: this.wallet,
121124
litNodeClient: this.envConfig.litNodeClient,
122125
});

local-tests/tests/test-bundle-speed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const testBundleSpeed = async (devEnv: TinnyEnvironment) => {
99
const b = await import('@lit-protocol/contracts-sdk');
1010
const c = await import('@lit-protocol/auth-helpers');
1111
const d = await import('@lit-protocol/constants');
12-
const e = await import('@lit-protocol/lit-auth-client');
12+
const e = await import('@lit-protocol/auth');
1313

1414
console.log(a, b, c, d, e);
1515
};

local-tests/tests/testRelayer.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { log } from '@lit-protocol/misc';
22
import { ClaimRequest, ClientClaimProcessor } from '@lit-protocol/types';
33
import { TinnyEnvironment } from 'local-tests/setup/tinny-environment';
4-
import { EthWalletProvider, LitRelay } from '@lit-protocol/lit-auth-client';
4+
import { authenticators, LitRelay } from '@lit-protocol/auth';
5+
6+
const { MetamaskAuthenticator } = authenticators;
57

68
/**
79
* Test Commands:
@@ -18,20 +20,6 @@ export const testRelayer = async (devEnv: TinnyEnvironment) => {
1820
relayUrl: LitRelay.getRelayUrl(devEnv.network),
1921
relayApiKey: 'test-api-key',
2022
});
21-
const ethWalletProvider = new EthWalletProvider({
22-
relay: litRelay,
23-
litNodeClient: devEnv.litNodeClient,
24-
});
25-
26-
const pkps = await ethWalletProvider.fetchPKPsThroughRelayer(
27-
alice.authMethod
28-
);
29-
30-
if (pkps.length <= 0) {
31-
throw new Error('No PKPs found');
32-
} else {
33-
console.log('✅ 1. [testRelayer] /fetch-pkps-by-auth-method works');
34-
}
3523

3624
// -- test claims
3725
const claimRequest: ClaimRequest<ClientClaimProcessor> = {

packages/auth-browser/.babelrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/auth-browser/.eslintrc.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/auth-browser/README.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)