-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: sign button no longer relies for accouunt update
- Loading branch information
1 parent
45328cc
commit 81521b6
Showing
11 changed files
with
240 additions
and
151 deletions.
There are no files selected for viewing
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,56 @@ | ||
const { sign } = require('tweetnacl'); | ||
const { encode } = require('@stablelib/hex'); | ||
const { | ||
generateAccount, | ||
mnemonicFromSeed, | ||
secretKeyToMnemonic, | ||
} = require('algosdk'); | ||
|
||
const account = generateAccount(); | ||
const seed = account.sk.slice(0, sign.seedLength); | ||
const mnemonicFromPrivateKey = secretKeyToMnemonic(account.sk); | ||
const _mnemonicFromSeed = mnemonicFromSeed(seed); | ||
|
||
console.log('address:', account.addr); | ||
console.log('privateKey byte length:', account.sk.byteLength); | ||
console.log('seed:', encode(seed)); | ||
console.log('seed byte length:', seed.byteLength); | ||
console.log('mnemonicFromPrivateKey:', mnemonicFromPrivateKey); | ||
console.log('mnemonicFromSeed:', _mnemonicFromSeed); | ||
|
||
const privateKey = account.sk.slice(0, sign.seedLength); | ||
const publicKey = account.sk.slice(sign.seedLength, account.sk.length); | ||
|
||
console.log('privateKey:', encode(privateKey)); | ||
console.log('publicKey:', encode(publicKey)); | ||
console.log( | ||
'sign.keyPair.fromSecretKey()#publicKey:', | ||
encode(sign.keyPair.fromSecretKey(account.sk).publicKey) | ||
); | ||
|
||
const generatePrivateKey = () => | ||
encode(sign.keyPair().secretKey.slice(0, sign.seedLength), true); | ||
|
||
console.log(sign.keyPair().secretKey); | ||
|
||
const secretKey1 = new Uint8Array([ | ||
177, 128, 122, 222, 69, 20, 122, 56, 201, 121, 18, 112, 29, 225, 199, 16, 71, | ||
212, 51, 244, 21, 102, 83, 245, 66, 165, 211, 55, 141, 79, 22, 204, 134, 189, | ||
241, 74, 92, 222, 22, 218, 196, 197, 159, 174, 51, 203, 88, 234, 2, 76, 13, 0, | ||
160, 180, 83, 193, 104, 39, 106, 9, 9, 209, 138, 81, | ||
]); | ||
const secretKey2 = new Uint8Array([ | ||
210, 190, 72, 201, 18, 160, 41, 151, 90, 41, 177, 247, 108, 197, 164, 64, 241, | ||
187, 185, 93, 54, 145, 222, 245, 80, 99, 177, 236, 35, 18, 96, 70, 97, 7, 92, | ||
174, 48, 168, 36, 207, 98, 82, 9, 209, 157, 7, 237, 213, 146, 251, 210, 140, | ||
171, 245, 101, 201, 52, 211, 113, 77, 100, 37, 1, 103, | ||
]); | ||
const challenge = new Uint8Array([ | ||
178, 70, 214, 9, 123, 64, 164, 247, 117, 99, 228, 178, 196, 30, 33, 180, 249, | ||
242, 116, 64, 204, 165, 83, 177, 51, 62, 98, 34, 164, 207, 220, 116, | ||
]); | ||
console.log('challenge:', encode(challenge)); | ||
console.log('secret key 1:', encode(secretKey1)); | ||
console.log('signature 1:', encode(sign.detached(challenge, secretKey1))); | ||
console.log('secret key 2:', encode(secretKey2)); | ||
console.log('signature 2:', encode(sign.detached(challenge, secretKey2))); |
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
10 changes: 10 additions & 0 deletions
10
src/extension/modals/SignTransactionsModal/hooks/useSignTransactionsModal/types/IState.ts
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 type { ISignTransactionsParams } from '@agoralabs-sh/avm-web-provider'; | ||
|
||
// types | ||
import type { IClientRequestEvent } from '@extension/types'; | ||
|
||
interface IState { | ||
event: IClientRequestEvent<ISignTransactionsParams> | null; | ||
} | ||
|
||
export default IState; |
17 changes: 0 additions & 17 deletions
17
...nTransactionsModal/hooks/useSignTransactionsModal/types/IUseSignTransactionsModalState.ts
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/extension/modals/SignTransactionsModal/hooks/useSignTransactionsModal/types/index.ts
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 |
---|---|---|
@@ -1 +1 @@ | ||
export type { default as IUseSignTransactionsModalState } from './IUseSignTransactionsModalState'; | ||
export type { default as IState } from './IState'; |
Oops, something went wrong.