diff --git a/src/api/sys/lookupSelf.ts b/src/api/sys/lookupSelf.ts index a2c7f5c..7891083 100644 --- a/src/api/sys/lookupSelf.ts +++ b/src/api/sys/lookupSelf.ts @@ -1,8 +1,5 @@ import { appendAPIURL, getHeaders } from "../apiUtils"; - -type TokenInfo = { - expire_time: string; -} +import { TokenInfo } from "../types/token"; export async function lookupSelf(): Promise { const request = new Request(appendAPIURL("/v1/auth/token/lookup-self"), { diff --git a/src/api/types/token.ts b/src/api/types/token.ts new file mode 100644 index 0000000..2215496 --- /dev/null +++ b/src/api/types/token.ts @@ -0,0 +1,19 @@ +export type TokenInfo = { + accessor: string; + creation_time: number; + creation_ttl: number; + display_name: string; + entity_id: string; + expire_time: string; + explicit_max_ttl: 0; + id: string; + identity_policies: string[]; + issue_time: string; + meta: any; + num_uses: number; + orphan: Boolean; + path: string; + policies: string[]; + renewable: Boolean; + ttl: number; +} \ No newline at end of file diff --git a/src/api/types/transit.ts b/src/api/types/transit.ts index 015f130..074103c 100644 --- a/src/api/types/transit.ts +++ b/src/api/types/transit.ts @@ -11,6 +11,7 @@ export const enum TransitKeyTypes { RSA_4096 = "rsa-4096", } +// Type when used to make new transit keys. export type TransitKeyBaseType = { name: string; convergent_encryption: Boolean; @@ -20,10 +21,11 @@ export type TransitKeyBaseType = { type: keyof typeof TransitKeyTypes; } +// Type returned when calling getTransitKey export type TransitKeyType = TransitKeyBaseType & { - keys?: { + keys: { [version: string]: number; - }, + }; min_decryption_version: number; min_encryption_version: number; supports_encryption: Boolean;