This repository was archived by the owner on Mar 5, 2025. It is now read-only.
-
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
4 changed files
with
1,061 additions
and
4 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,18 @@ | ||
import { createSignatureMessage } from './create-signature-message' | ||
import { rolaTestVectors } from './test-vectors' | ||
|
||
describe('createSignatureMessage', () => { | ||
it('should create a signature message', () => { | ||
rolaTestVectors.forEach((vector) => { | ||
const result = createSignatureMessage({ | ||
dAppDefinitionAddress: vector.dAppDefinitionAddress, | ||
origin: vector.origin, | ||
challenge: vector.challenge, | ||
}) | ||
|
||
if (result.isErr()) throw { ...result.error, vector } | ||
|
||
expect(result.value).toEqual(vector.blakeHashOfPayload) | ||
}) | ||
}) | ||
}) |
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,44 @@ | ||
import { RadixNetwork } from '@radixdlt/babylon-gateway-api-sdk' | ||
import { | ||
deriveVirtualEcdsaSecp256k1AccountAddress, | ||
deriveVirtualEddsaEd25519AccountAddress, | ||
deriveVirtualIdentityAddress, | ||
} from './derive-address-from-public-key' | ||
|
||
describe('deriveAddressFromPublicKey', () => { | ||
it('should derive virtual identity address', async () => { | ||
const output = deriveVirtualIdentityAddress( | ||
'59c02cc1c4cc1eddd90907bb848c44ac1808d844476c1621ecf234cf3ed49c57', | ||
RadixNetwork.Enkinet, | ||
) | ||
|
||
const result = await output.unwrapOr(undefined) | ||
expect(result).toEqual( | ||
'identity_tdx_21_12t5uwv48e5j7w368r7kjmcrw3wygfh0dtssz0u5n4hkq7qawrwrzyv', | ||
) | ||
}) | ||
|
||
it('should derive ed25519 virtual account address', async () => { | ||
const output = deriveVirtualEddsaEd25519AccountAddress( | ||
'59c02cc1c4cc1eddd90907bb848c44ac1808d844476c1621ecf234cf3ed49c57', | ||
RadixNetwork.Enkinet, | ||
) | ||
|
||
const result = await output.unwrapOr(undefined) | ||
expect(result).toEqual( | ||
'account_tdx_21_1285uwv48e5j7w368r7kjmcrw3wygfh0dtssz0u5n4hkq7qawthf4kn', | ||
) | ||
}) | ||
|
||
it('should derive secp256k1 virtual account address', async () => { | ||
const output = deriveVirtualEcdsaSecp256k1AccountAddress( | ||
'02807797adba8d61024c186f438b7bd9c7e1260b6306d615c35faeef9da052e5e4', | ||
RadixNetwork.Enkinet, | ||
) | ||
|
||
const result = await output.unwrapOr(undefined) | ||
expect(result).toEqual( | ||
'account_tdx_21_168razfxd603n87nals6us3nnzet2k9tjdk5dlyh2xdjkah3duuyyr3', | ||
) | ||
}) | ||
}) |
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
Oops, something went wrong.