@@ -13,7 +13,6 @@ import {
1313 Agent as SecretStreamAgent ,
1414} from 'secret-stream-http'
1515import { describe , it , expect } from 'vitest'
16- import z32 from 'z32'
1716
1817import type { MapShareState } from '../src/types.js'
1918import {
@@ -151,7 +150,7 @@ describe('Map Shares and Downloads', () => {
151150
152151 // Create a third device (another receiver)
153152 const receiver2KeyPair = SecretStreamAgent . keyPair ( Buffer . alloc ( 32 , 2 ) )
154- const receiver2DeviceId = z32 . encode ( receiver2KeyPair . publicKey )
153+ const receiver2DeviceId = Buffer . from ( receiver2KeyPair . publicKey ) . toString ( 'hex' )
155154
156155 // Create share for first receiver
157156 const share1 = await createShare ( ) . json ( )
@@ -1102,7 +1101,7 @@ describe('Map Shares and Downloads', () => {
11021101
11031102 // Create a third device with different keys
11041103 const wrongKeyPair = SecretStreamAgent . keyPair ( )
1105- const wrongDeviceId = z32 . encode ( wrongKeyPair . publicKey )
1104+ const wrongDeviceId = Buffer . from ( wrongKeyPair . publicKey ) . toString ( 'hex' )
11061105
11071106 // Create a share for a different device
11081107 const { shareId : shareId2 } = await sender
@@ -1132,7 +1131,7 @@ describe('Map Shares and Downloads', () => {
11321131
11331132 // Create a third device with different keys
11341133 const wrongKeyPair = SecretStreamAgent . keyPair ( )
1135- const wrongDeviceId = z32 . encode ( wrongKeyPair . publicKey )
1134+ const wrongDeviceId = Buffer . from ( wrongKeyPair . publicKey ) . toString ( 'hex' )
11361135
11371136 // Create a share for wrongDeviceId
11381137 const { shareId } = await sender
@@ -1185,7 +1184,7 @@ describe('Map Shares and Downloads', () => {
11851184
11861185 // Create a third device
11871186 const wrongKeyPair = SecretStreamAgent . keyPair ( )
1188- const wrongDeviceId = z32 . encode ( wrongKeyPair . publicKey )
1187+ const wrongDeviceId = Buffer . from ( wrongKeyPair . publicKey ) . toString ( 'hex' )
11891188
11901189 // Create a share for wrongDeviceId
11911190 const { shareId } = await sender
@@ -1494,7 +1493,7 @@ describe('Map Shares and Downloads', () => {
14941493
14951494 const response = await receiver . post ( 'downloads' , {
14961495 json : {
1497- senderDeviceId : 'not-a-valid-z32 -encoded-public-key' ,
1496+ senderDeviceId : 'not-a-valid-hex -encoded-public-key' ,
14981497 shareId : 'test-share' ,
14991498 mapShareUrls : [ 'http://127.0.0.1:1/mapShares/test-share' ] ,
15001499 estimatedSizeBytes : 1000 ,
@@ -1509,8 +1508,8 @@ describe('Map Shares and Downloads', () => {
15091508 it ( 'should reject download with sender device ID of wrong length' , async ( t ) => {
15101509 const { receiver } = await startServers ( t )
15111510
1512- // Valid z32 encoding but only 16 bytes instead of 32
1513- const shortKey = z32 . encode ( new Uint8Array ( 16 ) )
1511+ // Valid hex encoding but only 16 bytes instead of 32
1512+ const shortKey = Buffer . from ( new Uint8Array ( 16 ) ) . toString ( 'hex' )
15141513
15151514 const response = await receiver . post ( 'downloads' , {
15161515 json : {
0 commit comments