@aooth/auth 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atscript-db.cjs +6 -6
- package/dist/atscript-db.mjs +6 -6
- package/dist/index.cjs +11 -11
- package/dist/index.mjs +11 -11
- package/package.json +10 -10
package/dist/atscript-db.cjs
CHANGED
|
@@ -428,14 +428,14 @@ function rowToState(row, metadataField) {
|
|
|
428
428
|
if (metadataField !== void 0) {
|
|
429
429
|
delete state[metadataField];
|
|
430
430
|
const metadata = row[metadataField];
|
|
431
|
-
if (metadata
|
|
431
|
+
if (metadata != null) state.metadata = metadata;
|
|
432
432
|
}
|
|
433
433
|
if (row.kind === "access" || row.kind === "refresh") state.kind = row.kind;
|
|
434
|
-
if (row.parentCredentialId
|
|
435
|
-
if (row.rotatedAt
|
|
436
|
-
if (row.successor
|
|
437
|
-
if (row.sessionId
|
|
438
|
-
if (row.lastSeenAt
|
|
434
|
+
if (row.parentCredentialId != null) state.parentCredentialId = row.parentCredentialId;
|
|
435
|
+
if (row.rotatedAt != null) state.rotatedAt = row.rotatedAt;
|
|
436
|
+
if (row.successor != null) state.successor = row.successor;
|
|
437
|
+
if (row.sessionId != null) state.sessionId = row.sessionId;
|
|
438
|
+
if (row.lastSeenAt != null) state.lastSeenAt = row.lastSeenAt;
|
|
439
439
|
return state;
|
|
440
440
|
}
|
|
441
441
|
exports.AUTHORITY_METADATA_KEYS = AUTHORITY_METADATA_KEYS;
|
package/dist/atscript-db.mjs
CHANGED
|
@@ -427,14 +427,14 @@ function rowToState(row, metadataField) {
|
|
|
427
427
|
if (metadataField !== void 0) {
|
|
428
428
|
delete state[metadataField];
|
|
429
429
|
const metadata = row[metadataField];
|
|
430
|
-
if (metadata
|
|
430
|
+
if (metadata != null) state.metadata = metadata;
|
|
431
431
|
}
|
|
432
432
|
if (row.kind === "access" || row.kind === "refresh") state.kind = row.kind;
|
|
433
|
-
if (row.parentCredentialId
|
|
434
|
-
if (row.rotatedAt
|
|
435
|
-
if (row.successor
|
|
436
|
-
if (row.sessionId
|
|
437
|
-
if (row.lastSeenAt
|
|
433
|
+
if (row.parentCredentialId != null) state.parentCredentialId = row.parentCredentialId;
|
|
434
|
+
if (row.rotatedAt != null) state.rotatedAt = row.rotatedAt;
|
|
435
|
+
if (row.successor != null) state.successor = row.successor;
|
|
436
|
+
if (row.sessionId != null) state.sessionId = row.sessionId;
|
|
437
|
+
if (row.lastSeenAt != null) state.lastSeenAt = row.lastSeenAt;
|
|
438
438
|
return state;
|
|
439
439
|
}
|
|
440
440
|
export { AUTHORITY_METADATA_KEYS, AuthCodeStoreAtscriptDb, CredentialStoreAtscriptDb, DynamicClientStoreAtscriptDb, PendingAuthorizationStoreAtscriptDb, getAoothCredentialMetadataSpec };
|
package/dist/index.cjs
CHANGED
|
@@ -895,7 +895,7 @@ var AuthCredential = class {
|
|
|
895
895
|
userId: oldState.userId,
|
|
896
896
|
iat: oldState.issuedAt,
|
|
897
897
|
exp: oldState.expiresAt,
|
|
898
|
-
...oldState.sessionId
|
|
898
|
+
...oldState.sessionId != null && { sessionId: oldState.sessionId }
|
|
899
899
|
});
|
|
900
900
|
return await this.issueRotatedPair(oldState, refreshToken, key, false, now, true);
|
|
901
901
|
}
|
|
@@ -936,7 +936,7 @@ var AuthCredential = class {
|
|
|
936
936
|
expiresAt: oldState.expiresAt,
|
|
937
937
|
kind: "refresh",
|
|
938
938
|
rotatedAt: oldState.rotatedAt,
|
|
939
|
-
...oldState.sessionId
|
|
939
|
+
...oldState.sessionId != null && { sessionId: oldState.sessionId }
|
|
940
940
|
});
|
|
941
941
|
return {
|
|
942
942
|
accessToken: successor.accessToken,
|
|
@@ -1131,8 +1131,8 @@ var AuthCredential = class {
|
|
|
1131
1131
|
issuedAt: now,
|
|
1132
1132
|
expiresAt: now + accessTtl,
|
|
1133
1133
|
kind: "access",
|
|
1134
|
-
metadata: refreshState.metadata,
|
|
1135
|
-
sessionId: refreshState.sessionId,
|
|
1134
|
+
metadata: refreshState.metadata ?? void 0,
|
|
1135
|
+
sessionId: refreshState.sessionId ?? void 0,
|
|
1136
1136
|
...this.trackLastSeen === "refresh" && { lastSeenAt: now }
|
|
1137
1137
|
});
|
|
1138
1138
|
return {
|
|
@@ -1157,9 +1157,9 @@ var AuthCredential = class {
|
|
|
1157
1157
|
issuedAt: now,
|
|
1158
1158
|
expiresAt: refreshExpiresAt,
|
|
1159
1159
|
kind: "refresh",
|
|
1160
|
-
metadata: oldRefreshState.metadata,
|
|
1160
|
+
metadata: oldRefreshState.metadata ?? void 0,
|
|
1161
1161
|
parentCredentialId: this.hashAtRest ? fingerprint(oldRefreshToken) : oldRefreshToken,
|
|
1162
|
-
sessionId: oldRefreshState.sessionId,
|
|
1162
|
+
sessionId: oldRefreshState.sessionId ?? void 0,
|
|
1163
1163
|
...this.trackLastSeen === "refresh" && { lastSeenAt: now }
|
|
1164
1164
|
});
|
|
1165
1165
|
const access = await this.issueAccessFromRefresh(oldRefreshState, now);
|
|
@@ -1267,15 +1267,15 @@ var AuthCredential = class {
|
|
|
1267
1267
|
issuedAt: reuse.issuedAt,
|
|
1268
1268
|
expiresAt: reuse.expiresAt,
|
|
1269
1269
|
kind: "refresh",
|
|
1270
|
-
...reuse.sessionId
|
|
1271
|
-
...reuse.rotatedAt
|
|
1270
|
+
...reuse.sessionId != null && { sessionId: reuse.sessionId },
|
|
1271
|
+
...reuse.rotatedAt != null && { rotatedAt: reuse.rotatedAt }
|
|
1272
1272
|
});
|
|
1273
|
-
if ((this.refreshConfig?.reuseResponse ?? "session") === "session" && reuse.sessionId
|
|
1273
|
+
if ((this.refreshConfig?.reuseResponse ?? "session") === "session" && reuse.sessionId != null && this.store.listForUser) await this.revokeSession(reuse.userId, reuse.sessionId);
|
|
1274
1274
|
else await this.revokeAllForUser(reuse.userId);
|
|
1275
1275
|
throw new require_payload.AuthError("REFRESH_REUSE_DETECTED", void 0, {
|
|
1276
1276
|
userId: reuse.userId,
|
|
1277
|
-
...reuse.sessionId
|
|
1278
|
-
...reuse.rotatedAt
|
|
1277
|
+
...reuse.sessionId != null && { sessionId: reuse.sessionId },
|
|
1278
|
+
...reuse.rotatedAt != null && { rotatedAt: reuse.rotatedAt }
|
|
1279
1279
|
});
|
|
1280
1280
|
}
|
|
1281
1281
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -894,7 +894,7 @@ var AuthCredential = class {
|
|
|
894
894
|
userId: oldState.userId,
|
|
895
895
|
iat: oldState.issuedAt,
|
|
896
896
|
exp: oldState.expiresAt,
|
|
897
|
-
...oldState.sessionId
|
|
897
|
+
...oldState.sessionId != null && { sessionId: oldState.sessionId }
|
|
898
898
|
});
|
|
899
899
|
return await this.issueRotatedPair(oldState, refreshToken, key, false, now, true);
|
|
900
900
|
}
|
|
@@ -935,7 +935,7 @@ var AuthCredential = class {
|
|
|
935
935
|
expiresAt: oldState.expiresAt,
|
|
936
936
|
kind: "refresh",
|
|
937
937
|
rotatedAt: oldState.rotatedAt,
|
|
938
|
-
...oldState.sessionId
|
|
938
|
+
...oldState.sessionId != null && { sessionId: oldState.sessionId }
|
|
939
939
|
});
|
|
940
940
|
return {
|
|
941
941
|
accessToken: successor.accessToken,
|
|
@@ -1130,8 +1130,8 @@ var AuthCredential = class {
|
|
|
1130
1130
|
issuedAt: now,
|
|
1131
1131
|
expiresAt: now + accessTtl,
|
|
1132
1132
|
kind: "access",
|
|
1133
|
-
metadata: refreshState.metadata,
|
|
1134
|
-
sessionId: refreshState.sessionId,
|
|
1133
|
+
metadata: refreshState.metadata ?? void 0,
|
|
1134
|
+
sessionId: refreshState.sessionId ?? void 0,
|
|
1135
1135
|
...this.trackLastSeen === "refresh" && { lastSeenAt: now }
|
|
1136
1136
|
});
|
|
1137
1137
|
return {
|
|
@@ -1156,9 +1156,9 @@ var AuthCredential = class {
|
|
|
1156
1156
|
issuedAt: now,
|
|
1157
1157
|
expiresAt: refreshExpiresAt,
|
|
1158
1158
|
kind: "refresh",
|
|
1159
|
-
metadata: oldRefreshState.metadata,
|
|
1159
|
+
metadata: oldRefreshState.metadata ?? void 0,
|
|
1160
1160
|
parentCredentialId: this.hashAtRest ? fingerprint(oldRefreshToken) : oldRefreshToken,
|
|
1161
|
-
sessionId: oldRefreshState.sessionId,
|
|
1161
|
+
sessionId: oldRefreshState.sessionId ?? void 0,
|
|
1162
1162
|
...this.trackLastSeen === "refresh" && { lastSeenAt: now }
|
|
1163
1163
|
});
|
|
1164
1164
|
const access = await this.issueAccessFromRefresh(oldRefreshState, now);
|
|
@@ -1266,15 +1266,15 @@ var AuthCredential = class {
|
|
|
1266
1266
|
issuedAt: reuse.issuedAt,
|
|
1267
1267
|
expiresAt: reuse.expiresAt,
|
|
1268
1268
|
kind: "refresh",
|
|
1269
|
-
...reuse.sessionId
|
|
1270
|
-
...reuse.rotatedAt
|
|
1269
|
+
...reuse.sessionId != null && { sessionId: reuse.sessionId },
|
|
1270
|
+
...reuse.rotatedAt != null && { rotatedAt: reuse.rotatedAt }
|
|
1271
1271
|
});
|
|
1272
|
-
if ((this.refreshConfig?.reuseResponse ?? "session") === "session" && reuse.sessionId
|
|
1272
|
+
if ((this.refreshConfig?.reuseResponse ?? "session") === "session" && reuse.sessionId != null && this.store.listForUser) await this.revokeSession(reuse.userId, reuse.sessionId);
|
|
1273
1273
|
else await this.revokeAllForUser(reuse.userId);
|
|
1274
1274
|
throw new AuthError("REFRESH_REUSE_DETECTED", void 0, {
|
|
1275
1275
|
userId: reuse.userId,
|
|
1276
|
-
...reuse.sessionId
|
|
1277
|
-
...reuse.rotatedAt
|
|
1276
|
+
...reuse.sessionId != null && { sessionId: reuse.sessionId },
|
|
1277
|
+
...reuse.rotatedAt != null && { rotatedAt: reuse.rotatedAt }
|
|
1278
1278
|
});
|
|
1279
1279
|
}
|
|
1280
1280
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aooth/auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Auth method layer for aoothjs (sessions, tokens, password reset, MFA primitives)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aoothjs",
|
|
@@ -104,22 +104,22 @@
|
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"jose": "^6.2.3",
|
|
107
|
-
"@aooth/user": "0.2.
|
|
107
|
+
"@aooth/user": "0.2.8"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@atscript/core": "^0.2.
|
|
111
|
-
"@atscript/db": "^0.1.
|
|
112
|
-
"@atscript/db-sql-tools": "^0.1.
|
|
113
|
-
"@atscript/db-sqlite": "^0.1.
|
|
114
|
-
"@atscript/typescript": "^0.2.
|
|
110
|
+
"@atscript/core": "^0.2.12",
|
|
111
|
+
"@atscript/db": "^0.1.176",
|
|
112
|
+
"@atscript/db-sql-tools": "^0.1.176",
|
|
113
|
+
"@atscript/db-sqlite": "^0.1.176",
|
|
114
|
+
"@atscript/typescript": "^0.2.12",
|
|
115
115
|
"@types/better-sqlite3": "^7.6.13",
|
|
116
|
-
"@uniqu/core": "^0.2.
|
|
116
|
+
"@uniqu/core": "^0.2.2",
|
|
117
117
|
"better-sqlite3": "^12.6.2",
|
|
118
118
|
"ioredis": "^5.11.1",
|
|
119
|
-
"unplugin-atscript": "^0.2.
|
|
119
|
+
"unplugin-atscript": "^0.2.12"
|
|
120
120
|
},
|
|
121
121
|
"peerDependencies": {
|
|
122
|
-
"@atscript/db": "^0.1.
|
|
122
|
+
"@atscript/db": "^0.1.176"
|
|
123
123
|
},
|
|
124
124
|
"peerDependenciesMeta": {
|
|
125
125
|
"@atscript/db": {
|