-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,878 additions
and
15 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// import { signMessage } from 'aptos'; | ||
|
||
// export const _signAptosMessage = async (message: string, privateKey: string): Promise<string> => { | ||
// const signature = await aptos.sign(message, privateKey); | ||
// return signature; | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { ethers } from "ethers"; | ||
|
||
export const _signEthereumMessage = async (message: string, privateKey: string): Promise<string> => { | ||
const wallet = new ethers.Wallet(privateKey); | ||
const signature = await wallet.signMessage(message); | ||
return signature; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { _signEthereumMessage } from "./eth"; | ||
import { _signSolanaMessage } from "./solana"; | ||
|
||
|
||
export default class Sign { | ||
|
||
signEthereurmMessage(message: string, privateKey: string) { | ||
return _signEthereumMessage(message, privateKey); | ||
} | ||
|
||
signSolanaMessage(message: string, privateKey: string) { | ||
return _signSolanaMessage(message, privateKey); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import nacl from "tweetnacl"; | ||
|
||
export const _signSolanaMessage = async (message: string, privateKey: string) => { | ||
const messageBytes = new TextEncoder().encode(message); | ||
|
||
const signature = nacl.sign.detached(messageBytes, new TextEncoder().encode(privateKey)); | ||
return signature; | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Fetcch from "../../src"; | ||
|
||
describe("module: sign-ethereum-message", () => { | ||
const fetcch = new Fetcch("4ff9ecc8-4537-4e2e-950d-0cefbd16f2a5"); | ||
test("sign ethereum message", async () => { | ||
const signature = await fetcch.sign.signEthereurmMessage( | ||
"fujh@pay", | ||
"c36c3587ae76d32737cb441334c5ac858d0fc906b329ba9fc6998e090625b60d", | ||
); | ||
console.log("signaturee", signature); | ||
expect(signature).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Fetcch from "../../src"; | ||
|
||
describe("module: sign-solana-message", () => { | ||
const fetcch = new Fetcch("4ff9ecc8-4537-4e2e-950d-0cefbd16f2a5"); | ||
test("sign solana message", async () => { | ||
const signature = await fetcch.sign.signSolanaMessage( | ||
"fujh@pay", | ||
"c36c3587ae76d32737cb441334c5ac858d0fc906b329ba9fc6998e090625b60d", | ||
); | ||
console.log("signature solana", signature); | ||
expect(signature).toBeDefined(); | ||
}); | ||
}); |