1
0
Fork 0

Expand TokenInfo type.

This commit is contained in:
Kitteh 2021-05-09 12:35:40 +01:00
parent ba7e619bdf
commit e16ef675cb
3 changed files with 24 additions and 6 deletions

View file

@ -1,8 +1,5 @@
import { appendAPIURL, getHeaders } from "../apiUtils";
type TokenInfo = {
expire_time: string;
}
import { TokenInfo } from "../types/token";
export async function lookupSelf(): Promise<TokenInfo> {
const request = new Request(appendAPIURL("/v1/auth/token/lookup-self"), {

19
src/api/types/token.ts Normal file
View file

@ -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;
}

View file

@ -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;