-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(app): wallet key integration issues
- Loading branch information
Showing
4 changed files
with
28 additions
and
12 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 |
---|---|---|
@@ -1 +1 @@ | ||
site_name: '@cypherock/sdk-app-tron' | ||
site_name: '@cypherock/sdk-app-inheritance' |
34 changes: 25 additions & 9 deletions
34
packages/app-inheritance/src/operations/walletSign/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,33 +1,49 @@ | ||
import { ISDK } from '@cypherock/sdk-core'; | ||
import { createLoggerWithPrefix } from '@cypherock/sdk-utils'; | ||
import { APP_VERSION } from '../../constants/appId'; | ||
import { GetChallengeResponse } from '../../proto/generated/inheritance/wallet_key'; | ||
import { IWalletAuthResultResponse } from '../../proto/generated/types'; | ||
import { | ||
assertOrThrowInvalidResult, | ||
OperationHelper, | ||
logger as rootLogger, | ||
} from '../../utils'; | ||
|
||
const logger = createLoggerWithPrefix(rootLogger, 'GetChallenge'); | ||
const logger = createLoggerWithPrefix(rootLogger, 'walletAuthRequest'); | ||
|
||
export const getWalletSign = async ( | ||
sdk: ISDK, | ||
): Promise<GetChallengeResponse> => { | ||
): Promise<IWalletAuthResultResponse> => { | ||
logger.info('Started'); | ||
|
||
await sdk.checkAppCompatibility(APP_VERSION); | ||
|
||
const helper = new OperationHelper({ | ||
sdk, | ||
queryKey: 'getChallenge', | ||
resultKey: 'getChallengeResponse', | ||
queryKey: 'walletAuth', | ||
resultKey: 'walletAuth', | ||
}); | ||
// TODO: add vars to parameters | ||
await helper.sendQuery({ | ||
initiate: { | ||
challenge: new Uint8Array([ | ||
144, 213, 122, 213, 228, 193, 104, 222, 201, 19, 75, 27, 117, 55, 36, | ||
46, 163, 239, 183, 51, 61, 251, 171, 30, 87, 72, 90, 53, 41, 121, 48, | ||
132, | ||
]), | ||
walletId: new Uint8Array([ | ||
144, 213, 122, 213, 228, 193, 104, 222, 201, 19, 75, 27, 117, 55, 36, | ||
46, 87, 72, 90, 53, 41, 121, 48, 132, 163, 239, 183, 51, 61, 251, 171, | ||
30, | ||
]), | ||
isPublickey: false, | ||
}, | ||
}); | ||
|
||
await helper.sendQuery({ challenge: 'CHALLENGE #XX' }); | ||
const result = await helper.waitForResult(); | ||
logger.verbose('getChallengeResponse', result); | ||
assertOrThrowInvalidResult(result); | ||
logger.verbose('walletAuthResponse', result); | ||
console.log(JSON.stringify(result)); | ||
assertOrThrowInvalidResult(result.result); | ||
|
||
logger.info('Completed'); | ||
return result; | ||
return result.result; | ||
}; |
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
Submodule common
updated
4 files
+4 −5 | proto/inheritance/core.proto | |
+30 −0 | proto/inheritance/wallet_auth.proto | |
+0 −18 | proto/inheritance/wallet_key.proto | |
+87 −0 | proto/session.proto |