File tree 2 files changed +3
-2
lines changed
2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ export const publicKeyToIPNSRoutingKey = (publicKey: PublicKey): Uint8Array => {
139
139
return multihashToIPNSRoutingKey ( publicKey . toMultihash ( ) )
140
140
}
141
141
142
- export const multihashToIPNSRoutingKey = ( digest : MultihashDigest ) : Uint8Array => {
142
+ export const multihashToIPNSRoutingKey = ( digest : MultihashDigest < 0x00 | 0x12 > ) : Uint8Array => {
143
143
return uint8ArrayConcat ( [
144
144
IPNS_PREFIX ,
145
145
digest . bytes
@@ -153,7 +153,7 @@ export const publicKeyFromIPNSRoutingKey = (key: Uint8Array): Ed25519PublicKey |
153
153
} catch { }
154
154
}
155
155
156
- export const multihashFromIPNSRoutingKey = ( key : Uint8Array ) : MultihashDigest < 0x00 > | MultihashDigest < 0x12 > => {
156
+ export const multihashFromIPNSRoutingKey = ( key : Uint8Array ) : MultihashDigest < 0x00 | 0x12 > => {
157
157
const digest = Digest . decode ( key . slice ( IPNS_PREFIX . length ) )
158
158
159
159
if ( digest . code !== 0x00 && digest . code !== 0x12 ) {
Original file line number Diff line number Diff line change @@ -356,6 +356,7 @@ describe('ipns', function () {
356
356
357
357
keys . forEach ( key => {
358
358
const digest = Digest . decode ( base58btc . decode ( `z${ key } ` ) )
359
+ // @ts -expect-error digest may have the wrong hash type
359
360
const routingKey = multihashToIPNSRoutingKey ( digest )
360
361
const id = multihashFromIPNSRoutingKey ( routingKey )
361
362
You can’t perform that action at this time.
0 commit comments