ceramicnetwork / js-did

A simple interface to interact with DIDs that conform to the DID-provider interface.
Other
95 stars 28 forks source link

feat: add multidid library with did:* and did:key support #150

Closed zachferland closed 1 year ago

zachferland commented 1 year ago

Add multidid library based on specification and examples as test vectors.

Does not have did:pkh support yet, and few small todos left.

Pretty simple, but feedback on interface, what to add/remove etc, would be helpful.

zachferland commented 1 year ago

@AaronGoldman

zachferland commented 1 year ago

@oed dont think aaron is in here, could not add as reviewer, I cant access settings either

oed commented 1 year ago

That's odd. Sent an org invite to you @AaronGoldman

oed commented 1 year ago

Imo we can merge this before we add support for DID PKH

zachferland commented 1 year ago

Sounds good, pkh can go in another pr after, for this PR will change API to following

type InspectObject = {
  methodCode: number
  methodIdBytes: Uint8Array
  urlBytes: Uint8Array
}

class Multidid {
  constructor(private code: number, private id: Uint8Array, private url: Uint8Array): Multidid 
  static fromBytes(bytes: Uint8Array): Multidid 
  toBytes(): Uint8Array 
  toMultibase(base: SupportedBase = 'base58btc'): string 
  static fromMultibase(multidid: string): Multidid 
  static fromString(did: string): Multidid 
  toString(): string 
  inspect(): InspectObject
}
zachferland commented 1 year ago

Covered all comments, and changed what was listed above, moved out of draft, all set to merge

zachferland commented 1 year ago

oh the docs build, will update, but it is built before docs are pushed out on merge