-
Notifications
You must be signed in to change notification settings - Fork 5
/
Tokens.ts
80 lines (77 loc) · 2.04 KB
/
Tokens.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Docs: https://www.vaultproject.io/api/auth/token/index.html
import { Network } from '../interfaces/Network'
export interface TokenOptions {
readonly id?: string
readonly role_name: string
readonly policies: string[]
readonly no_default_policy: boolean
readonly renewable: boolean
readonly ttl: string
readonly display_name: string
readonly num_uses: number
readonly meta: { name: string; network?: string }
}
export namespace Token {
export const Login: TokenOptions = {
role_name: 'login',
policies: ['login'],
no_default_policy: true,
renewable: false,
ttl: '720h',
display_name: 'Login',
num_uses: 0, // The value of 0 has no limit to the number of uses.
meta: {
name: 'login',
},
}
export const VerifyAccount: TokenOptions = {
role_name: 'verify_account',
policies: ['verify_account'],
no_default_policy: true,
renewable: false,
ttl: '4611686018s', // ~146 years,
display_name: 'Verify account',
num_uses: 2,
meta: {
name: 'verify_account',
},
}
export const ForgotPassword: TokenOptions = {
role_name: 'forgot_password',
policies: ['forgot_password'],
no_default_policy: true,
renewable: false,
ttl: '30m',
display_name: 'Forgot password',
num_uses: 1,
meta: {
name: 'forgot_password',
},
}
export const ApiKey: TokenOptions = {
role_name: 'api_key',
policies: ['api_key'],
no_default_policy: true,
renewable: true,
ttl: '4611686018s', // ~146 years
display_name: 'Api key',
num_uses: 0, // The value of 0 has no limit to the number of uses.
meta: {
name: 'api_key',
network: Network.LIVE,
},
}
export const TestApiKey: TokenOptions = {
role_name: 'test',
policies: ['test_api_key'],
no_default_policy: true,
renewable: true,
ttl: '4611686018s', // ~146 years
display_name: 'Test Api key',
num_uses: 0, // The value of 0 has no limit to the number of uses.
meta: {
name: 'test_api_key',
network: Network.TEST,
},
}
}