Skip to content

Commit 537d3ab

Browse files
committed
add isRotated field to access token data
1 parent 248816e commit 537d3ab

File tree

1 file changed

+11
-30
lines changed

1 file changed

+11
-30
lines changed

packages/vault-sdk/src/types.ts

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ type SignTypedDataData = {
403403
signature: string;
404404
};
405405

406-
type CreateAccessTokenData = {
406+
export type AccessTokenData = {
407407
accessToken: string;
408408
id: string; // UUID
409409
issuerId: string; // UUID
@@ -413,19 +413,15 @@ type CreateAccessTokenData = {
413413
metadata: Record<string, MetadataValue>;
414414
createdAt: string; // ISO date string
415415
updatedAt: string; // ISO date string
416+
/**
417+
* If nullish then token hasn't been explicitly revoked, otherwise the ISO date string of the revocation.
418+
* Note that an access token will be "implicitly" revoked if the token issuer account gets rotated. Check the isRotated field for this
419+
*/
416420
revokedAt?: string; // ISO date string
417-
};
418-
419-
type RevokeAccessTokenData = {
420-
id: string; // UUID
421-
issuerId: string; // UUID
422-
issuerType: OwnerType;
423-
policies: PolicyComponent[];
424-
expiresAt: string; // ISO date string
425-
metadata: Record<string, MetadataValue>;
426-
createdAt: string; // ISO date string
427-
updatedAt: string; // ISO date string
428-
revokedAt?: string; // ISO date string
421+
/**
422+
* Reflects whether the issuer of this token has "rotated" their account, which implicitly revokes the token, but is not tracked by the revokedAt? field.
423+
*/
424+
isRotated: boolean;
429425
};
430426

431427
// Update SignAuthorizationData to use the defined SignedAuthorization type
@@ -439,21 +435,6 @@ export type SignStructuredMessageData = {
439435
message: string; // This likely represents the UserOp hash in Rust
440436
};
441437

442-
// Add AccessTokenData (as defined previously, ensure OwnerType/MetadataValue are correct)
443-
export type AccessTokenData = {
444-
id: string; // UUID
445-
issuerId: string; // UUID
446-
// Only revealed if revealSensitive is true for the policy being used to read, otherwise redacted/masked
447-
accessToken: string;
448-
issuerType: OwnerType;
449-
policies: PolicyComponent[];
450-
expiresAt: string; // ISO date string
451-
metadata: Record<string, MetadataValue>;
452-
createdAt: string; // ISO date string
453-
updatedAt: string; // ISO date string
454-
revokedAt?: string | null; // ISO date string or null
455-
};
456-
457438
// Add GetAccessTokensData (as defined previously)
458439
export type GetAccessTokensData = {
459440
items: AccessTokenData[];
@@ -555,7 +536,7 @@ export type CreateAccessTokenPayload = GenericPayload<{
555536
operation: "accessToken:create";
556537
auth: Auth;
557538
options: CreateAccessTokenOptions;
558-
data: CreateAccessTokenData;
539+
data: AccessTokenData;
559540
}>;
560541

561542
// Add ListAccessTokensPayload (using defined types)
@@ -569,7 +550,7 @@ export type RevokeAccessTokenPayload = GenericPayload<{
569550
operation: "accessToken:revoke";
570551
auth: Auth;
571552
options: RevokeAccessTokenOptions;
572-
data: RevokeAccessTokenData;
553+
data: AccessTokenData;
573554
}>;
574555

575556
// ========== Union of all payloads ==========

0 commit comments

Comments
 (0)