Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GunHookCallbackAuth has the wrong type in Typescript def #1298

Open
nerocui opened this issue Dec 21, 2022 · 1 comment
Open

GunHookCallbackAuth has the wrong type in Typescript def #1298

nerocui opened this issue Dec 21, 2022 · 1 comment

Comments

@nerocui
Copy link

nerocui commented Dec 21, 2022

when I do gun. On('auth', (user, message, event) => {}). The user object I get at runtime is this as stated in documents

// on success calls callback with a reference to the gun user
// cb(at) where at is an object as below
{
    ack: 2,
    back: object, //reference to the root object (internal)
    get: "~publicKeyOfUser",
    gun: object, //gun root (internal)
    id: 6, //id of the node in graph (internal)
    on: function onto(),
    opt: object, //uuid function object (internal)
    put: object, //object containing pub, alias and epub of the user
    root: object, //gun root reference (internal)
    sea: object, //object containing keys of the user
    soul: "~publicKeyOfUser",
    tag: object //gun in and out reference (internal)
}
// on failure callback is called cb(ack) where ack is as below
{
    err: 'Wrong user or password.'
}

But the type definition in typescript is

export type GunUser = {
  /** Username or Alias which can be used to find a user */
  alias: string;
  // auth: string;
  /** public key for encryption */
  epub: string;
  /** public key */
  pub: string;
};

as defined in https://github.com/amark/gun/blob/master/types/sea/GunUser.d.ts

@vageherder
Copy link

M61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants