Skip to content

Commit

Permalink
fix: clean deps and publish 0.0.17-beta.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gabin54 committed Jul 12, 2023
1 parent 96ce8aa commit 989bc6c
Show file tree
Hide file tree
Showing 12 changed files with 442 additions and 1,337 deletions.
61 changes: 60 additions & 1 deletion packages/common/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { toSismoConnectResponseBytes } from "./utils/toSismoResponseBytes";

export const SISMO_CONNECT_VERSION = `sismo-connect-v1.1`;

export type SismoConnectRequest = {
Expand Down Expand Up @@ -71,12 +73,69 @@ export const authTypeLabels: { [authType in AuthType]: string } = {
[AuthType.TELEGRAM]: "Telegram",
};

export type SismoConnectResponse = Pick<SismoConnectRequest, "namespace" | "version"> & {
export type SismoConnectResponseInterface = Pick<SismoConnectRequest, "namespace" | "version"> & {
appId: string;
signedMessage?: string;
proofs: SismoConnectProof[];
};

export class SismoConnectResponse implements SismoConnectResponseInterface {
namespace?: string;
version: string;
appId: string;
signedMessage?: string;
proofs: SismoConnectProof[];
auths: Auth[];
claims: Auth[];

constructor(params: SismoConnectResponseInterface) {
Object.assign(this, params);
this.auths = params.proofs.reduce((auths: Auth[], proof) => {
if (proof.auths) {
return [...auths, ...proof.auths];
} else {
return auths;
}
}, []);
this.claims = params.proofs.reduce((auths: Auth[], proof) => {
if (proof.auths) {
return [...auths, ...proof.auths];
} else {
return auths;
}
}, []);
}

public toJson(): SismoConnectResponseInterface {
return {
namespace: this.namespace,
version: this.version,
appId: this.appId,
signedMessage: this.signedMessage,
proofs: this.proofs,
};
}

public toBytes(): string {
return toSismoConnectResponseBytes(this);
}

public getUserId(authType: AuthType): string | undefined {
const userId = this.auths.find((verifiedAuth) => verifiedAuth.authType === authType)?.userId;
return resolveSismoIdentifier(userId, authType);
}

public getUserIds(authType: AuthType): string[] {
return this.auths
.filter((verifiedAuth) => verifiedAuth.authType === authType && verifiedAuth.userId)
.map((auth) => resolveSismoIdentifier(auth.userId, authType)) as string[];
}

public getSignedMessage(): string | undefined {
return this.signedMessage;
}
}

export type SismoConnectProof = {
auths?: Auth[];
claims?: Claim[];
Expand Down
2 changes: 1 addition & 1 deletion packages/sismo-connect-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sismo-core/sismo-connect-client",
"version": "0.0.17-beta.0",
"version": "0.0.17-beta.4",
"description": "Sismo Connect client package",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
Expand Down
23 changes: 11 additions & 12 deletions packages/sismo-connect-client/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";
import pkg from "./package.json";

export default [
{
Expand All @@ -18,25 +19,23 @@ export default [
sourcemap: true,
},
],
plugins: [
resolve(),
commonjs(),
typescript({ tsconfig: "./tsconfig.json" }),
],
plugins: [resolve(), commonjs(), typescript({ tsconfig: "./tsconfig.json" })],
external: [
"@ethersproject/bignumber",
"viem",
"js-base64",
"pako"
]
"pako",
...Object.keys(pkg.devDependencies || {}),
],
},
{
input: "lib/esm/types/index.d.ts",
output: [
{
file: "lib/index.d.ts",
format: "esm"
}
file: "lib/index.d.ts",
format: "esm",
},
],
plugins: [dts.default()],
}
];
},
];
4 changes: 2 additions & 2 deletions packages/sismo-connect-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sismo-core/sismo-connect-react",
"version": "0.0.16",
"version": "0.0.17-beta.4",
"description": "sismoConnect React package",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
Expand Down Expand Up @@ -41,6 +41,6 @@
},
"peerDependencies": {},
"dependencies": {
"@sismo-core/sismo-connect-client": "0.0.16"
"@sismo-core/sismo-connect-client": "0.0.17-beta.4"
}
}
29 changes: 12 additions & 17 deletions packages/sismo-connect-react/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import postcss from 'rollup-plugin-postcss';
import postcss from "rollup-plugin-postcss";
import dts from "rollup-plugin-dts";
import external from 'rollup-plugin-peer-deps-external';
import packageJson from './package.json';
import external from "rollup-plugin-peer-deps-external";
import packageJson from "./package.json";
import pkg from "./package.json";

export default [
{
Expand All @@ -14,7 +15,7 @@ export default [
file: packageJson.module,
format: "esm",
sourcemap: true,
}
},
],
plugins: [
external(),
Expand All @@ -23,23 +24,17 @@ export default [
typescript({ tsconfig: "./tsconfig.json" }),
postcss(),
],
external: [
"viem",
"js-base64",
"pako"
]
external: ["@sismo-core/sismo-connect-client", ...Object.keys(pkg.devDependencies || {})],
},
{
input: "lib/esm/types/index.d.ts",
output: [
{
file: "lib/index.d.ts",
format: "esm"
}
file: "lib/index.d.ts",
format: "esm",
},
],
external: [/\.css$/],
plugins: [
dts.default()
],
}
];
plugins: [dts.default()],
},
];
Loading

0 comments on commit 989bc6c

Please sign in to comment.