Skip to content

Commit d1d9421

Browse files
committed
refactor: idToken.issue() now requires the use option
BREAKING CHANGE: `IdToken.prototype.issue` now requires the `use` option.
1 parent 5572e0e commit d1d9421

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/models/formats/paseto.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ module.exports = (provider, { opaque }) => {
121121
if (config.version === 1) {
122122
issue = config.purpose === 'local' ? paseto.V1.encrypt : paseto.V1.sign;
123123
} else {
124-
issue = config.purpose === 'local' ? paseto.V2.encrypt : paseto.V2.sign;
124+
issue = paseto.V2.sign;
125125
}
126126

127127
/* eslint-disable no-unused-expressions */

lib/models/id_token.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports = function getIdToken(provider) {
6262
return merge({}, await mask.result(), this.extra);
6363
}
6464

65-
async issue({ use = 'idtoken', expiresAt = null } = {}) {
65+
async issue({ use, expiresAt = null } = {}) {
6666
const { client } = this;
6767
const expiresIn = expiresAt ? expiresAt - epochTime() : undefined;
6868
let alg;

test/formats/paseto.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('paseto format', () => {
7878

7979
const client = await this.provider.Client.find(clientId);
8080
const token = new this.provider.AccessToken({ client, ...fullPayload, resourceServer });
81-
expect(await token.save()).to.match(/^v1.public./);
81+
expect(await token.save()).to.match(/^v1\.public\./);
8282
});
8383

8484
it('v2.public', async function () {
@@ -93,7 +93,7 @@ describe('paseto format', () => {
9393

9494
const client = await this.provider.Client.find(clientId);
9595
const token = new this.provider.AccessToken({ client, ...fullPayload, resourceServer });
96-
expect(await token.save()).to.match(/^v2.public./);
96+
expect(await token.save()).to.match(/^v2\.public\./);
9797
});
9898

9999
it('v1.local', async function () {
@@ -109,7 +109,7 @@ describe('paseto format', () => {
109109

110110
const client = await this.provider.Client.find(clientId);
111111
const token = new this.provider.AccessToken({ client, ...fullPayload, resourceServer });
112-
expect(await token.save()).to.match(/^v1.local./);
112+
expect(await token.save()).to.match(/^v1\.local\./);
113113
});
114114

115115
it('v1.local (keyObject)', async function () {
@@ -125,7 +125,7 @@ describe('paseto format', () => {
125125

126126
const client = await this.provider.Client.find(clientId);
127127
const token = new this.provider.AccessToken({ client, ...fullPayload, resourceServer });
128-
expect(await token.save()).to.match(/^v1.local./);
128+
expect(await token.save()).to.match(/^v1\.local\./);
129129
});
130130

131131
it('v2.local is not supported', async function () {

0 commit comments

Comments
 (0)