diff --git a/.changeset/m2m-token-timestamp-units.md b/.changeset/m2m-token-timestamp-units.md new file mode 100644 index 00000000000..fc12e04daf7 --- /dev/null +++ b/.changeset/m2m-token-timestamp-units.md @@ -0,0 +1,5 @@ +--- +'@clerk/backend': patch +--- + +Clarify in the `M2MToken`, `APIKey`, and `IdPOAuthAccessToken` JSDoc that the timestamp properties (`expiration`, `lastUsedAt`, `createdAt`, and `updatedAt`) are Unix timestamps in milliseconds (not seconds). diff --git a/packages/backend/src/api/resources/APIKey.ts b/packages/backend/src/api/resources/APIKey.ts index 09f67479b26..38838700aef 100644 --- a/packages/backend/src/api/resources/APIKey.ts +++ b/packages/backend/src/api/resources/APIKey.ts @@ -23,17 +23,17 @@ export class APIKey { readonly revocationReason: string | null, /** Whether the API key has expired. */ readonly expired: boolean, - /** The Unix timestamp when the API key expires. `null` if the API key never expires. */ + /** The Unix timestamp (in milliseconds) when the API key expires. `null` if the API key never expires. */ readonly expiration: number | null, /** The user ID for the user creating the API key. */ readonly createdBy: string | null, /** A description for the API key. */ readonly description: string | null, - /** The Unix timestamp when the API key was last used to authenticate a request. */ + /** The Unix timestamp (in milliseconds) when the API key was last used to authenticate a request. */ readonly lastUsedAt: number | null, - /** The Unix timestamp when the API key was created. */ + /** The Unix timestamp (in milliseconds) when the API key was created. */ readonly createdAt: number, - /** The Unix timestamp when the API key was last updated. */ + /** The Unix timestamp (in milliseconds) when the API key was last updated. */ readonly updatedAt: number, /** The API key secret. */ readonly secret?: string, diff --git a/packages/backend/src/api/resources/IdPOAuthAccessToken.ts b/packages/backend/src/api/resources/IdPOAuthAccessToken.ts index 41e0d765c70..8399057e59b 100644 --- a/packages/backend/src/api/resources/IdPOAuthAccessToken.ts +++ b/packages/backend/src/api/resources/IdPOAuthAccessToken.ts @@ -19,8 +19,11 @@ export class IdPOAuthAccessToken { readonly revoked: boolean, readonly revocationReason: string | null, readonly expired: boolean, + /** The Unix timestamp (in milliseconds) when the access token expires. */ readonly expiration: number | null, + /** The Unix timestamp (in milliseconds) when the access token was created. */ readonly createdAt: number, + /** The Unix timestamp (in milliseconds) when the access token was last updated. */ readonly updatedAt: number, ) {} diff --git a/packages/backend/src/api/resources/M2MToken.ts b/packages/backend/src/api/resources/M2MToken.ts index 95ec6c41b81..5b19fdd9603 100644 --- a/packages/backend/src/api/resources/M2MToken.ts +++ b/packages/backend/src/api/resources/M2MToken.ts @@ -55,11 +55,11 @@ export class M2MToken { readonly revocationReason: string | null, /** Whether the M2M token has expired. */ readonly expired: boolean, - /** The Unix timestamp when the M2M token expires. */ + /** The Unix timestamp (in milliseconds) when the M2M token expires. */ readonly expiration: number | null, - /** The Unix timestamp when the M2M token was created. */ + /** The Unix timestamp (in milliseconds) when the M2M token was created. */ readonly createdAt: number, - /** The Unix timestamp when the M2M token was last updated. */ + /** The Unix timestamp (in milliseconds) when the M2M token was last updated. */ readonly updatedAt: number, /** The token string. */ readonly token?: string,