Comparing version 2.0.0-next.9 to 2.0.0
@@ -1,6 +0,5 @@ | ||
import { parseJWT } from "@oslojs/jwt"; | ||
import { decodeJWT } from "@oslojs/jwt"; | ||
export function decodeIdToken(idToken) { | ||
try { | ||
const [_header, payload, _signature] = parseJWT(idToken); | ||
return payload; | ||
return decodeJWT(idToken); | ||
} | ||
@@ -7,0 +6,0 @@ catch (e) { |
import { createS256CodeChallenge } from "../oauth2.js"; | ||
import { createOAuth2Request, encodeBasicCredentials, sendTokenRequest, sendTokenRevocationRequest } from "../request.js"; | ||
import { createOAuth2Request, sendTokenRequest, sendTokenRevocationRequest } from "../request.js"; | ||
export class AmazonCognito { | ||
@@ -36,5 +36,5 @@ authorizationEndpoint; | ||
body.set("redirect_uri", this.redirectURI); | ||
body.set("client_id", this.clientId); | ||
body.set("client_secret", this.clientSecret); | ||
const request = createOAuth2Request(this.tokenEndpoint, body); | ||
const encodedCredentials = encodeBasicCredentials(this.clientId, this.clientSecret); | ||
request.headers.set("Authorization", `Basic ${encodedCredentials}`); | ||
const tokens = await sendTokenRequest(request); | ||
@@ -47,5 +47,5 @@ return tokens; | ||
body.set("refresh_token", refreshToken); | ||
body.set("client_id", this.clientId); | ||
body.set("client_secret", this.clientSecret); | ||
const request = createOAuth2Request(this.tokenEndpoint, body); | ||
const encodedCredentials = encodeBasicCredentials(this.clientId, this.clientSecret); | ||
request.headers.set("Authorization", `Basic ${encodedCredentials}`); | ||
const tokens = await sendTokenRequest(request); | ||
@@ -57,7 +57,7 @@ return tokens; | ||
body.set("token", token); | ||
body.set("client_id", this.clientId); | ||
body.set("client_secret", this.clientSecret); | ||
const request = createOAuth2Request(this.tokenRevocationEndpoint, body); | ||
const encodedCredentials = encodeBasicCredentials(this.clientId, this.clientSecret); | ||
request.headers.set("Authorization", `Basic ${encodedCredentials}`); | ||
await sendTokenRevocationRequest(request); | ||
} | ||
} |
@@ -45,8 +45,8 @@ import { createOAuth2Request, sendTokenRequest } from "../request.js"; | ||
const now = Math.floor(Date.now() / 1000); | ||
const header = { | ||
const headerJSON = JSON.stringify({ | ||
typ: "JWT", | ||
alg: "ES256", | ||
kid: this.keyId | ||
}; | ||
const payload = { | ||
}); | ||
const payloadJSON = JSON.stringify({ | ||
iss: this.teamId, | ||
@@ -57,10 +57,10 @@ exp: now + 5 * 60, | ||
iat: now | ||
}; | ||
}); | ||
const signature = new Uint8Array(await crypto.subtle.sign({ | ||
name: "ECDSA", | ||
hash: "SHA-256" | ||
}, privateKey, createJWTSignatureMessage(header, payload))); | ||
const jwt = encodeJWT(header, payload, signature); | ||
}, privateKey, createJWTSignatureMessage(headerJSON, payloadJSON))); | ||
const jwt = encodeJWT(headerJSON, payloadJSON, signature); | ||
return jwt; | ||
} | ||
} |
{ | ||
"name": "arctic", | ||
"type": "module", | ||
"version": "2.0.0-next.9", | ||
"description": "OAuth 2.0 clients for popular providers", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"module": "dist/index.js", | ||
"files": [ | ||
"/dist/" | ||
], | ||
"author": "pilcrowOnPaper", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pilcrowOnPaper/arctic" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.8.6", | ||
"@typescript-eslint/eslint-plugin": "^6.7.5", | ||
"@typescript-eslint/parser": "^6.7.5", | ||
"auri": "2.0.0", | ||
"eslint": "^8.51.0", | ||
"prettier": "^3.0.3", | ||
"typescript": "^5.2.2", | ||
"vitest": "1.6.0" | ||
}, | ||
"dependencies": { | ||
"@oslojs/crypto": "0.6.0", | ||
"@oslojs/encoding": "0.4.1", | ||
"@oslojs/jwt": "0.1.0" | ||
}, | ||
"scripts": { | ||
"build": "rm -rf dist/* && tsc", | ||
"format": "prettier -w .", | ||
"lint": "eslint src", | ||
"test": "vitest run --sequence.concurrent" | ||
} | ||
} | ||
"name": "arctic", | ||
"type": "module", | ||
"version": "2.0.0", | ||
"description": "OAuth 2.0 clients for popular providers", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"module": "dist/index.js", | ||
"scripts": { | ||
"build": "rm -rf dist/* && tsc", | ||
"format": "prettier -w .", | ||
"lint": "eslint src", | ||
"test": "vitest run --sequence.concurrent" | ||
}, | ||
"files": [ | ||
"/dist/" | ||
], | ||
"author": "pilcrowOnPaper", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pilcrowOnPaper/arctic" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.8.6", | ||
"@typescript-eslint/eslint-plugin": "^6.7.5", | ||
"@typescript-eslint/parser": "^6.7.5", | ||
"auri": "2.0.0", | ||
"eslint": "^8.51.0", | ||
"prettier": "^3.0.3", | ||
"typescript": "^5.2.2", | ||
"vitest": "1.6.0" | ||
}, | ||
"dependencies": { | ||
"@oslojs/crypto": "1.0.1", | ||
"@oslojs/encoding": "1.1.0", | ||
"@oslojs/jwt": "0.2.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
142076
3183
+ Added@oslojs/asn1@1.0.0(transitive)
+ Added@oslojs/binary@1.0.0(transitive)
+ Added@oslojs/crypto@1.0.1(transitive)
+ Added@oslojs/encoding@1.1.0(transitive)
+ Added@oslojs/jwt@0.2.0(transitive)
- Removed@oslojs/asn1@0.2.2(transitive)
- Removed@oslojs/binary@0.2.3(transitive)
- Removed@oslojs/crypto@0.6.0(transitive)
- Removed@oslojs/jwt@0.1.0(transitive)
Updated@oslojs/crypto@1.0.1
Updated@oslojs/encoding@1.1.0
Updated@oslojs/jwt@0.2.0