feat: add fromRegistryPublicKey helper

This commit is contained in:
Derrick Hammer 2023-09-11 13:21:39 -04:00
parent 07893b1538
commit e25087890f
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 0 deletions

View File

@ -42,6 +42,10 @@ export default class CID extends Multibase {
return CID._init(bytes);
}
static fromRegistryPublicKey(pubkey: string | Uint8Array): CID {
return CID.fromHash(pubkey, 0, CID_TYPES.RESOLVER);
}
static fromHash(
bytes: string | Uint8Array,
size: number,