Skip to content

Commit

Permalink
Merge pull request #16 from passportxyz/buffer
Browse files Browse the repository at this point in the history
remove buffer dependency
  • Loading branch information
larisa17 authored Feb 18, 2025
2 parents 7527cad + 42ee23e commit 04d7f7f
Show file tree
Hide file tree
Showing 6 changed files with 408 additions and 604 deletions.
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"dependencies": {
"@passportxyz/passport-embed": "^0.0.2",
"@tanstack/react-query": "^5.62.11",
"buffer": "^6.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
9 changes: 6 additions & 3 deletions example/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { createRoot } from "react-dom/client";
import { useState } from "react";
import { Buffer } from "buffer";
import {
PassportScoreWidget,
usePassportScore,
Expand All @@ -7,8 +9,6 @@ import {

import "./index.css";

import { useState } from "react";

const passportEmbedParams = {
apiKey: import.meta.env.VITE_API_KEY,
scorerId: import.meta.env.VITE_SCORER_ID,
Expand Down Expand Up @@ -51,10 +51,13 @@ const generateSignature = async (message: string) => {

const signerAddress = accounts[0];

const stringToSign = `0x${Buffer.from(message, "utf8").toString(
"hex"
)}`;
// Sign the message
const signature = await window.ethereum.request({
method: "personal_sign",
params: [message, signerAddress],
params: [stringToSign, signerAddress],
});

return signature ? signature : "";
Expand Down
Loading

0 comments on commit 04d7f7f

Please sign in to comment.