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

v2.0.0 #146

Merged
merged 9 commits into from
Jul 21, 2023
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: 7 additions & 0 deletions packages/ssx-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @spruceid/ssx-core

## 2.0.0

### Major Changes

- Added new types to support the new structure
- The package `@spruceid/ssx-gnosis-extension` had its code moved to this library.

## 1.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ssx-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spruceid/ssx-core",
"version": "1.2.0",
"version": "2.0.0",
"description": "SSX core library",
"author": "Spruce Systems Inc.",
"license": "Apache-2.0 OR MIT",
Expand Down
104 changes: 104 additions & 0 deletions packages/ssx-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,109 @@
# @spruceid/ssx-react

## 2.0.0

### Major Changes

- ## Major rework to enable customizability

`@spruceid/ssx-react` no longer depends on `wagmi`. Instead, function hooks must be defined and used as arguments to the component.

- `onChangeAccount` property no longer exists. Replaced by the `watchProvider` property, which now allows for more customizability.
- `web3Provider.providerLoaded` property was also removed. The new architecture assumes the provider no longer needs to be initialized, and callback functions will be called when changes occur.
- `useSSX` now returns the `ssx` instance and the `provider`.
- Now `watchProvider` is the new interface for listening to provider changes. The developer must set up this function to be called whenever an interaction with the user happens. An example of how to do it can be found [here](https://github.com/spruceid/ssx/blob/main/examples/ssx-test-react/src/index.tsx#L25).

```tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import { WagmiConfig, useWalletClient } from 'wagmi';
import { Web3Modal } from '@web3modal/react';
import { SSXProvider } from '@spruceid/ssx-react';
import {
EthereumClient,
w3mConnectors,
w3mProvider,
} from '@web3modal/ethereum';
import { configureChains, createConfig } from 'wagmi';
import { polygon, mainnet, goerli, sepolia } from 'wagmi/chains';
import { type WalletClient } from '@wagmi/core';
import { providers } from 'ethers';

// 1. Get projectID at https://cloud.walletconnect.com
if (!process.env.REACT_APP_PROJECT_ID) {
console.error('You need to provide REACT_APP_PROJECT_ID env variable');
}

export const projectId = process.env.REACT_APP_PROJECT_ID ?? '';

// 2. Configure wagmi client
const chains = [mainnet, goerli, sepolia, polygon];

const { publicClient } = configureChains(chains, [
w3mProvider({ projectId }),
]);

export const wagmiConfig = createConfig({
autoConnect: false,
connectors: w3mConnectors({ projectId, chains }),
publicClient,
});

// 3. Configure modal ethereum client
export const ethereumClient = new EthereumClient(wagmiConfig, chains);

export function walletClientToEthers5Signer(walletClient: WalletClient) {
const { account, chain, transport } = walletClient;
const network = {
chainId: chain.id,
name: chain.name,
ensAddress: chain.contracts?.ensRegistry?.address,
};
const provider = new providers.Web3Provider(transport, network);
const signer = provider.getSigner(account.address);
return signer;
}

function SSXWithoutWatchProvider({ children }: any) {
const { data: walletClient } = useWalletClient();

const web3Provider = { provider: walletClient };

return (
<SSXProvider
ssxConfig={{ siweConfig: { domain: 'localhost:3000' } }}
web3Provider={web3Provider}>
{children}
</SSXProvider>
);
}

const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<WagmiConfig config={wagmiConfig}>
<SSXWithoutWatchProvider>
/* your code goes here */
</SSXWithoutWatchProvider>
</WagmiConfig>
<Web3ModalV2 projectId={projectId} ethereumClient={ethereumClient} />
</React.StrictMode>
);
```

You can [check here](https://github.com/spruceid/ssx/tree/main/examples/ssx-test-react) a more detailed example.

## Updated dependencies

Updated several dependencies.

### Patch Changes

- Updated dependencies
- @spruceid/[email protected]

## 1.3.5

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/ssx-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spruceid/ssx-react",
"version": "1.3.5",
"version": "2.0.0",
"description": "SSX React Hooks",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -36,7 +36,7 @@
"build": "tsc"
},
"dependencies": {
"@spruceid/ssx": "1.2.5"
"@spruceid/ssx": "2.0.0"
},
"peerDependencies": {
"wagmi": ">=0.5.0"
Expand Down
25 changes: 25 additions & 0 deletions packages/ssx-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# @spruceid/ssx

## 2.0.0

### Major Changes

- ## Major rework of the library architecture

SSX is now composed of modules that add significant functionality improvements. The previous functions of SSX were moved into a new module called [UserAuthorization](https://www.sprucekit.dev/ssx/installing-ssx/userauthorization-module) and will, from now on, be responsible for end-user signing-related operations.

A new module was added, [Storage](https://www.sprucekit.dev/ssx/installing-ssx/storage-module), which provides functionality to store and retrieve data in [Kepler](https://github.com/spruceid/kepler). Kepler is architected as a decentralized storage system that uses DIDs and Authorization Capabilities to define where your data lives and who has access.

## Improved tests

To keep improving the library, additional tests were added.

## Updated dependencies

Updated several libraries to address deprecation issues and possible vulnerabilities.

**⚠** You can [check here](https://www.sprucekit.dev/ssx/ssx-overview) for the latest documentation. **⚠**

### Patch Changes

- Updated dependencies
- @spruceid/[email protected]

## 1.2.5

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/ssx-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spruceid/ssx",
"version": "1.2.5",
"version": "2.0.0",
"description": "An identity solution that enables SSI to JS/TS apps.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -26,7 +26,7 @@
},
"dependencies": {
"@metamask/detect-provider": "^1.2.0",
"@spruceid/ssx-core": "1.2.0",
"@spruceid/ssx-core": "2.0.0",
"@spruceid/ssx-sdk-wasm": "0.3.0",
"assert": "^2.0.0",
"axios": "^0.27.2",
Expand Down
12 changes: 12 additions & 0 deletions packages/ssx-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @spruceid/ssx-server

## 2.0.0

### Major Changes

- Added stricter checks on nonces
- SSX middleware was moved back to the server package

### Patch Changes

- Updated dependencies
- @spruceid/[email protected]

## 1.2.4

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/ssx-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spruceid/ssx-server",
"version": "1.2.4",
"version": "2.0.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Spruce Systems, Inc.",
Expand All @@ -23,7 +23,7 @@
"ssx-server": "bin/ssx-server.js"
},
"dependencies": {
"@spruceid/ssx-core": "1.2.0",
"@spruceid/ssx-core": "2.0.0",
"axios": "^0.27.2",
"body-parser": "^1.20.0",
"cookie-parser": "^1.4.6",
Expand Down