Skip to content

fix(widget): support did:keri DIDs and P-256 did:key in auto-resolver #32

Description

@bordumb

Description

The TS auto-resolver in packages/widget/src/resolvers/github.ts and packages/widget/src/resolvers/did-utils.ts cannot resolve standard identities generated by the auths CLI.

Root Cause

  1. In packages/widget/src/resolvers/github.ts (lines 91-98):
if (controllerDid.startsWith('did:key:z')) {
  publicKeyHex = didKeyToPublicKeyHex(controllerDid);
} else {
  return {
    bundle: null,
    error: `Cannot extract public key from ${controllerDid}. Only did:key is supported for auto-resolve.`,
  };
}

auths init creates did:keri:... identities by default, but github.ts explicitly rejects did:keri.

  1. In packages/widget/src/resolvers/did-utils.ts (lines 57-62):
if (decoded.length < 34 || decoded[0] !== 0xed || decoded[1] !== 0x01) {
  throw new Error(`Expected Ed25519 multicodec prefix (0xED 0x01)...`);
}

didKeyToPublicKeyHex hardcodes checking for the Ed25519 multicodec prefix 0xed 0x01. However, auths init defaults to P-256 keys (multicodec 0x1200), causing didKeyToPublicKeyHex to throw an unhandled Error.

Expected Behavior

  • The resolver should support resolving did:keri DIDs by parsing inception events or KEL state.
  • didKeyToPublicKeyHex should support P-256 did:key multicodec prefix (0x1200) in addition to Ed25519 (0xed 0x01).

Location

  • packages/widget/src/resolvers/github.ts
  • packages/widget/src/resolvers/did-utils.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions