Skip to content

Commit af07a21

Browse files
authored
Merge pull request #6480 from BitGo/coin-4593-sign-message
feat: use a whitelisted message for signing
2 parents 5b021b8 + 996589b commit af07a21

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

examples/ts/build-message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
import {BitGoAPI} from '@bitgo/sdk-api';
1111
import {MessageStandardType} from "@bitgo/sdk-core";
12-
import {MIDNIGHT_TNC_HASH} from "@bitgo/account-lib/dist/src/utils";
1312
import {Hteth} from "@bitgo/sdk-coin-eth";
13+
import {MIDNIGHT_TNC_HASH} from "@bitgo/account-lib";
1414
require('dotenv').config({ path: '../../.env' });
1515

1616
const bitgo = new BitGoAPI({

examples/ts/sign-message.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
import { BitGo } from 'bitgo';
77
import { MessageStandardType } from '@bitgo/sdk-core';
8+
import { MIDNIGHT_TNC_HASH } from "@bitgo/account-lib";
89

910
const bitgo = new BitGo({ env: 'test' });
1011

@@ -18,9 +19,12 @@ async function signMessage(): Promise<void> {
1819
await bitgo.authenticateWithAccessToken({ accessToken });
1920
const walletInstance = await basecoin.wallets().get({ id: walletId });
2021

22+
const adaTestnetDestinationAddress = 'addr_test1vz7xs7ceu4xx9n5xn57lfe86vrwddqpp77vjwq5ptlkh49cqy3wur';
23+
const testnetMessageRaw = `STAR 12345678 to ${adaTestnetDestinationAddress} ${MIDNIGHT_TNC_HASH}`;
24+
2125
const messageTxn = await walletInstance.signMessage({
2226
message: {
23-
messageRaw: 'Hello BitGo!',
27+
messageRaw: testnetMessageRaw,
2428
messageStandardType: MessageStandardType.EIP191,
2529
},
2630
walletPassphrase,

modules/account-lib/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ export { Soneium };
203203
import * as Vet from '@bitgo/sdk-coin-vet';
204204
export { Vet };
205205

206-
import { validateAgainstMessageTemplates } from './utils';
206+
import { validateAgainstMessageTemplates, MIDNIGHT_TNC_HASH } from './utils';
207+
export { MIDNIGHT_TNC_HASH };
207208

208209
const coinBuilderMap = {
209210
trx: Trx.WrappedBuilder,

0 commit comments

Comments
 (0)