Skip to content

[oidc-provider] Add BaseToken#generateTokenId#75183

Open
RoyLeibo wants to merge 4 commits into
DefinitelyTyped:masterfrom
RoyLeibo:oidc-provider-generate-token-id
Open

[oidc-provider] Add BaseToken#generateTokenId#75183
RoyLeibo wants to merge 4 commits into
DefinitelyTyped:masterfrom
RoyLeibo:oidc-provider-generate-token-id

Conversation

@RoyLeibo

Copy link
Copy Markdown

BaseToken#generateTokenId

Adds the missing generateTokenId(): string method to BaseToken.

It exists at runtime on every token model but is absent from the typings, so calling it (e.g. to mint an opaque token value without persisting it via the adapter) currently requires an as unknown as { generateTokenId(): string } cast.

Runtime evidence (oidc-provider@9.8.6, also present in 7.x):

  • Defined in lib/models/formats/opaque.js (generateTokenId() { … return nanoid(length); }) and the jwt/paseto/dynamic formats.
  • Attached to every token model's prototype via lib/models/mixins/has_format.js (klass.prototype.generateTokenId = generateTokenId;).
  • Called by the base model constructor / save() (this.jti = this.generateTokenId();).

Since the format mixin is applied to all BaseToken descendants, declaring the method on BaseToken (alongside jti / save) matches the runtime surface.

A line exercising the method was added to the existing access_token.saved handler in oidc-provider-tests.ts.

Select one

  • My PR does not introduce a breaking change (it is purely additive — a method that already exists at runtime).

If changing an existing definition

  • I have verified the version is still accurate (no version bump needed — additive).
  • Provide a URL to documentation or source code which provides context for the suggested changes: see the runtime references above.
  • Increase the version number in the header if appropriate. (Not applicable — additive change, no header version bump required.)

@typescript-automation

typescript-automation Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@RoyLeibo Thank you for submitting this PR!

This is a live comment that I will keep updated.

1 package in this PR

Code Reviews

Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • 🕐 Most recent commit is approved by type definition owners or DT maintainers

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 75183,
  "author": "RoyLeibo",
  "headCommitOid": "828b05581700722e2907f6f6c4d8ab739636c209",
  "mergeBaseOid": "e186cd854fef1fbd5152877e78f9ab05743c226e",
  "lastPushDate": "2026-06-30T11:06:25.000Z",
  "lastActivityDate": "2026-06-30T11:06:25.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "tooManyCommits": false,
  "tooManyReviews": false,
  "popularityLevel": "Popular",
  "pkgInfo": [
    {
      "name": "oidc-provider",
      "kind": "edit",
      "files": [
        {
          "path": "types/oidc-provider/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/oidc-provider/oidc-provider-tests.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "panva"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Popular"
    }
  ],
  "reviews": [],
  "mainBotCommentID": 4842714100,
  "ciResult": "pass"
}

@typescript-automation typescript-automation Bot added the Popular package This PR affects a popular package (as counted by NPM download counts). label Jun 30, 2026
@typescript-automation

Copy link
Copy Markdown
Contributor

🔔 @panva — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-automation typescript-automation Bot moved this to Waiting for Code Reviews in Pull Request Status Board Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Popular package This PR affects a popular package (as counted by NPM download counts).

Projects

Status: Waiting for Code Reviews

Development

Successfully merging this pull request may close these issues.

1 participant