@suveren/gateway 0.4.0 → 0.5.0
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/bin/suveren-gateway.js +59 -0
- package/content/integrations/calendar.json +116 -22
- package/content/integrations/gmail.json +3 -0
- package/dist/control-plane/index.mjs +67 -7
- package/dist/mcp-server/http.mjs +98 -17
- package/dist/ui/assets/index-DedRWpBs.js +105 -0
- package/dist/ui/index.html +1 -1
- package/lib/autostart-templates.d.mts +37 -0
- package/lib/autostart-templates.mjs +208 -0
- package/node_modules/jose/README.md +13 -13
- package/node_modules/jose/dist/types/index.d.ts +6 -5
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +17 -11
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +7 -19
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +17 -11
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +7 -19
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +18 -13
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +20 -21
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +8 -12
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +0 -15
- package/node_modules/jose/dist/types/jwks/local.d.ts +12 -21
- package/node_modules/jose/dist/types/jwks/remote.d.ts +34 -165
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +2 -13
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +17 -13
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +2 -13
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +17 -13
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +16 -17
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +18 -15
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +17 -11
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +10 -34
- package/node_modules/jose/dist/types/jwt/sign.d.ts +2 -13
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +4 -13
- package/node_modules/jose/dist/types/jwt/verify.d.ts +14 -13
- package/node_modules/jose/dist/types/key/export.d.ts +0 -14
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +7 -14
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +16 -14
- package/node_modules/jose/dist/types/key/import.d.ts +18 -28
- package/node_modules/jose/dist/types/types.d.ts +242 -223
- package/node_modules/jose/dist/types/util/base64url.d.ts +11 -4
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -9
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +0 -8
- package/node_modules/jose/dist/types/util/errors.d.ts +128 -121
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +3 -21
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +5 -153
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +16 -111
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +15 -3
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +33 -48
- package/node_modules/jose/dist/webapi/jwk/embedded.js +5 -3
- package/node_modules/jose/dist/webapi/jwks/local.js +27 -47
- package/node_modules/jose/dist/webapi/jwks/remote.js +3 -3
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +5 -2
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +3 -15
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +7 -57
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +3 -89
- package/node_modules/jose/dist/webapi/jws/general/sign.js +18 -5
- package/node_modules/jose/dist/webapi/jws/general/verify.js +21 -3
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +4 -4
- package/node_modules/jose/dist/webapi/jwt/sign.js +2 -3
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +4 -3
- package/node_modules/jose/dist/webapi/jwt/verify.js +5 -5
- package/node_modules/jose/dist/webapi/key/export.js +34 -1
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +32 -82
- package/node_modules/jose/dist/webapi/key/import.js +8 -8
- package/node_modules/jose/dist/webapi/lib/asn1.js +29 -65
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +1 -0
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +20 -77
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +13 -127
- package/node_modules/jose/dist/webapi/lib/helpers.js +23 -0
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +143 -0
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +181 -0
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +109 -0
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +11 -96
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +74 -0
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +68 -0
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +108 -0
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +9 -8
- package/node_modules/jose/dist/webapi/lib/key.js +170 -0
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +16 -0
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +7 -0
- package/node_modules/jose/dist/webapi/lib/key_management.js +186 -29
- package/node_modules/jose/dist/webapi/lib/{validate_crit.js → options.js} +18 -0
- package/node_modules/jose/dist/webapi/lib/signing.js +20 -52
- package/node_modules/jose/dist/webapi/util/base64url.js +11 -3
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +2 -2
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -15
- package/node_modules/jose/dist/webapi/util/errors.js +1 -1
- package/node_modules/jose/package.json +2 -4
- package/package.json +2 -1
- package/profiles/email/0.4.profile.json +2 -1
- package/dist/ui/assets/index-BDQY7Z3H.js +0 -105
- package/node_modules/jose/dist/webapi/lib/aesgcmkw.js +0 -15
- package/node_modules/jose/dist/webapi/lib/aeskw.js +0 -25
- package/node_modules/jose/dist/webapi/lib/check_key_type.js +0 -122
- package/node_modules/jose/dist/webapi/lib/ecdhes.js +0 -52
- package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +0 -34
- package/node_modules/jose/dist/webapi/lib/normalize_key.js +0 -166
- package/node_modules/jose/dist/webapi/lib/pbes2kw.js +0 -42
- package/node_modules/jose/dist/webapi/lib/rsaes.js +0 -24
- package/node_modules/jose/dist/webapi/lib/validate_algorithms.js +0 -10
package/dist/ui/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Suveren</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DedRWpBs.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-JHaCddDE.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the plain-ESM autostart templates.
|
|
3
|
+
*
|
|
4
|
+
* The module is .mjs because the CLI (plain JS, no build step) imports it
|
|
5
|
+
* directly. TypeScript consumers — the tests — need declarations, and without
|
|
6
|
+
* them a typecheck fails with TS7016 rather than checking anything.
|
|
7
|
+
*/
|
|
8
|
+
export declare function escapeXml(value: unknown): string;
|
|
9
|
+
export declare function shellQuote(value: unknown): string;
|
|
10
|
+
|
|
11
|
+
export declare function buildLaunchAgentPlist(opts: {
|
|
12
|
+
launcherPath: string;
|
|
13
|
+
label: string;
|
|
14
|
+
logFile: string;
|
|
15
|
+
dataDir?: string;
|
|
16
|
+
path?: string;
|
|
17
|
+
}): string;
|
|
18
|
+
|
|
19
|
+
export declare function buildMacLauncher(opts: {
|
|
20
|
+
nodePath: string;
|
|
21
|
+
serverEntry: string;
|
|
22
|
+
}): string;
|
|
23
|
+
|
|
24
|
+
export declare function buildSystemdUnit(opts: {
|
|
25
|
+
nodePath: string;
|
|
26
|
+
serverEntry: string;
|
|
27
|
+
logFile: string;
|
|
28
|
+
dataDir?: string;
|
|
29
|
+
path?: string;
|
|
30
|
+
}): string;
|
|
31
|
+
|
|
32
|
+
export declare function buildWindowsTaskXml(opts: {
|
|
33
|
+
nodePath: string;
|
|
34
|
+
serverEntry: string;
|
|
35
|
+
author: string;
|
|
36
|
+
dataDir?: string;
|
|
37
|
+
}): string;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autostart file contents, per platform — pure string builders, no side effects.
|
|
3
|
+
*
|
|
4
|
+
* Separated from the CLI so they can be tested. The macOS plist builder shipped
|
|
5
|
+
* with no tests and interpolated paths straight into XML: a home directory
|
|
6
|
+
* containing `&` or `<` (both legal) produced a malformed plist and an install
|
|
7
|
+
* that failed confusingly. Escaping is applied here, once, for every format
|
|
8
|
+
* that needs it.
|
|
9
|
+
*
|
|
10
|
+
* All three mechanisms are USER-level — no admin, no root:
|
|
11
|
+
* macOS LaunchAgent (~/Library/LaunchAgents)
|
|
12
|
+
* Windows Task Scheduler ONLOGON task, registered from XML
|
|
13
|
+
* Linux systemd user unit (~/.config/systemd/user)
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Escape the five XML predefined entities. Used by both plist and Task XML. */
|
|
17
|
+
export function escapeXml(value) {
|
|
18
|
+
return String(value)
|
|
19
|
+
.replace(/&/g, '&')
|
|
20
|
+
.replace(/</g, '<')
|
|
21
|
+
.replace(/>/g, '>')
|
|
22
|
+
.replace(/"/g, '"')
|
|
23
|
+
.replace(/'/g, ''');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* macOS LaunchAgent.
|
|
28
|
+
*
|
|
29
|
+
* RunAtLoad → start at login. KeepAlive → restart on crash. The API key is
|
|
30
|
+
* NEVER placed here: no argument or environment variable carries a secret, so
|
|
31
|
+
* the gateway always boots locked.
|
|
32
|
+
*/
|
|
33
|
+
export function buildLaunchAgentPlist({ launcherPath, label, logFile, dataDir, path }) {
|
|
34
|
+
// launchd hands a process a MINIMAL PATH (/usr/bin:/bin:/usr/sbin:/sbin).
|
|
35
|
+
// The gateway itself still starts — its node path is absolute — but it then
|
|
36
|
+
// cannot find npx or the integration bin shims, so every integration silently
|
|
37
|
+
// fails to launch and the UI shows them all "Not running". Carry the PATH
|
|
38
|
+
// captured at install time, when it is the user's real one.
|
|
39
|
+
const entries = [];
|
|
40
|
+
if (dataDir) entries.push(['SUVEREN_DATA_DIR', dataDir]);
|
|
41
|
+
if (path) entries.push(['PATH', path]);
|
|
42
|
+
|
|
43
|
+
const env = entries.length
|
|
44
|
+
? ' <key>EnvironmentVariables</key>\n <dict>\n' +
|
|
45
|
+
entries.map(([k, v]) => ` <key>${escapeXml(k)}</key>\n <string>${escapeXml(v)}</string>\n`).join('') +
|
|
46
|
+
' </dict>\n'
|
|
47
|
+
: '';
|
|
48
|
+
|
|
49
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
50
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
51
|
+
<plist version="1.0">
|
|
52
|
+
<dict>
|
|
53
|
+
<key>Label</key>
|
|
54
|
+
<string>${escapeXml(label)}</string>
|
|
55
|
+
<key>ProgramArguments</key>
|
|
56
|
+
<array>
|
|
57
|
+
<string>${escapeXml(launcherPath)}</string>
|
|
58
|
+
</array>
|
|
59
|
+
<key>RunAtLoad</key>
|
|
60
|
+
<true/>
|
|
61
|
+
<key>KeepAlive</key>
|
|
62
|
+
<true/>
|
|
63
|
+
<key>StandardOutPath</key>
|
|
64
|
+
<string>${escapeXml(logFile)}</string>
|
|
65
|
+
<key>StandardErrorPath</key>
|
|
66
|
+
<string>${escapeXml(logFile)}</string>
|
|
67
|
+
${env}</dict>
|
|
68
|
+
</plist>
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A tiny launcher whose FILENAME is what macOS shows in
|
|
75
|
+
* System Settings → Login Items & Extensions.
|
|
76
|
+
*
|
|
77
|
+
* Pointing launchd straight at the node binary made the entry read "node —
|
|
78
|
+
* Item from unidentified developer": the user cannot tell what it is, and it
|
|
79
|
+
* looks like something that wandered in. A file named `Suveren` reads as
|
|
80
|
+
* itself.
|
|
81
|
+
*
|
|
82
|
+
* ("Unidentified developer" persists regardless — it means the node binary is
|
|
83
|
+
* not signed and notarized by a registered Apple developer, which is true of
|
|
84
|
+
* every Homebrew and nvm install. Nothing is bypassed; it is your own node
|
|
85
|
+
* running your own code.)
|
|
86
|
+
*/
|
|
87
|
+
export function buildMacLauncher({ nodePath, serverEntry }) {
|
|
88
|
+
// exec, so the launcher does not linger as an extra process between launchd
|
|
89
|
+
// and the gateway — launchd's KeepAlive and signal delivery then apply to
|
|
90
|
+
// the gateway itself.
|
|
91
|
+
return `#!/bin/sh
|
|
92
|
+
# Generated by \`suveren-gateway service install\`. Safe to delete once the
|
|
93
|
+
# login item is removed.
|
|
94
|
+
exec ${shellQuote(nodePath)} ${shellQuote(serverEntry)} --autostart "$@"
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Single-quote for /bin/sh, escaping embedded quotes. */
|
|
99
|
+
export function shellQuote(value) {
|
|
100
|
+
return `'${String(value).replace(/'/g, `'\\''`)}'`;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Linux systemd USER unit.
|
|
105
|
+
*
|
|
106
|
+
* Restart=always is the KeepAlive equivalent. WantedBy=default.target starts it
|
|
107
|
+
* with the user session; `loginctl enable-linger` (offered separately) extends
|
|
108
|
+
* that to boot, before any login.
|
|
109
|
+
*
|
|
110
|
+
* Environment values are quoted because systemd splits unquoted values on
|
|
111
|
+
* whitespace — a data directory with a space would otherwise be truncated.
|
|
112
|
+
*/
|
|
113
|
+
export function buildSystemdUnit({ nodePath, serverEntry, logFile, dataDir, path }) {
|
|
114
|
+
// Same problem as launchd: a systemd user unit does not inherit the shell's
|
|
115
|
+
// PATH, so npx and the integration shims go missing and every integration
|
|
116
|
+
// fails to start.
|
|
117
|
+
const envLines = [];
|
|
118
|
+
if (dataDir) envLines.push(`Environment="SUVEREN_DATA_DIR=${dataDir}"`);
|
|
119
|
+
if (path) envLines.push(`Environment="PATH=${path}"`);
|
|
120
|
+
const envLine = envLines.length ? envLines.join('\n') + '\n' : '';
|
|
121
|
+
return `[Unit]
|
|
122
|
+
Description=Suveren gateway (Human Agency Protocol)
|
|
123
|
+
Documentation=https://www.suveren.ai
|
|
124
|
+
After=network-online.target
|
|
125
|
+
|
|
126
|
+
[Service]
|
|
127
|
+
Type=simple
|
|
128
|
+
ExecStart=${nodePath} ${serverEntry} --autostart
|
|
129
|
+
${envLine}Restart=always
|
|
130
|
+
RestartSec=5
|
|
131
|
+
# The gateway boots LOCKED. Nothing in this unit can unlock the vault, so a
|
|
132
|
+
# restart brings the process back but never the credentials.
|
|
133
|
+
StandardOutput=append:${logFile}
|
|
134
|
+
StandardError=append:${logFile}
|
|
135
|
+
|
|
136
|
+
[Install]
|
|
137
|
+
WantedBy=default.target
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Windows Task Scheduler task, as registration XML.
|
|
143
|
+
*
|
|
144
|
+
* Registered with `schtasks /Create /XML`. XML rather than the flag form
|
|
145
|
+
* because the flags cannot express restart-on-failure, and cannot reliably
|
|
146
|
+
* carry paths containing spaces.
|
|
147
|
+
*
|
|
148
|
+
* LogonType=InteractiveToken keeps it in the user's own session with no stored
|
|
149
|
+
* password and no admin rights. Hidden + no execution time limit stop it
|
|
150
|
+
* flashing a console window or being killed after the default 72 hours.
|
|
151
|
+
*/
|
|
152
|
+
export function buildWindowsTaskXml({ nodePath, serverEntry, author, dataDir }) {
|
|
153
|
+
// Task Scheduler requires \Command to be the executable and \Arguments the
|
|
154
|
+
// rest; quoting the script path handles spaces (e.g. under "Program Files").
|
|
155
|
+
// Task Scheduler XML carries no environment block, so the marker that this
|
|
156
|
+
// was a service start has to ride in the arguments.
|
|
157
|
+
const args = `"${serverEntry}" --autostart`;
|
|
158
|
+
const envNote = dataDir ? `Suveren data directory: ${dataDir}` : 'Suveren gateway';
|
|
159
|
+
|
|
160
|
+
return `<?xml version="1.0" encoding="UTF-16"?>
|
|
161
|
+
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
162
|
+
<RegistrationInfo>
|
|
163
|
+
<Description>${escapeXml(envNote)}</Description>
|
|
164
|
+
<Author>${escapeXml(author)}</Author>
|
|
165
|
+
</RegistrationInfo>
|
|
166
|
+
<Triggers>
|
|
167
|
+
<LogonTrigger>
|
|
168
|
+
<Enabled>true</Enabled>
|
|
169
|
+
</LogonTrigger>
|
|
170
|
+
</Triggers>
|
|
171
|
+
<Principals>
|
|
172
|
+
<Principal id="Author">
|
|
173
|
+
<LogonType>InteractiveToken</LogonType>
|
|
174
|
+
<RunLevel>LeastPrivilege</RunLevel>
|
|
175
|
+
</Principal>
|
|
176
|
+
</Principals>
|
|
177
|
+
<Settings>
|
|
178
|
+
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
179
|
+
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
180
|
+
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
181
|
+
<AllowHardTerminate>true</AllowHardTerminate>
|
|
182
|
+
<StartWhenAvailable>true</StartWhenAvailable>
|
|
183
|
+
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
|
|
184
|
+
<IdleSettings>
|
|
185
|
+
<StopOnIdleEnd>false</StopOnIdleEnd>
|
|
186
|
+
<RestartOnIdle>false</RestartOnIdle>
|
|
187
|
+
</IdleSettings>
|
|
188
|
+
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
189
|
+
<Enabled>true</Enabled>
|
|
190
|
+
<Hidden>true</Hidden>
|
|
191
|
+
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
192
|
+
<WakeToRun>false</WakeToRun>
|
|
193
|
+
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
|
|
194
|
+
<Priority>7</Priority>
|
|
195
|
+
<RestartOnFailure>
|
|
196
|
+
<Interval>PT1M</Interval>
|
|
197
|
+
<Count>3</Count>
|
|
198
|
+
</RestartOnFailure>
|
|
199
|
+
</Settings>
|
|
200
|
+
<Actions Context="Author">
|
|
201
|
+
<Exec>
|
|
202
|
+
<Command>${escapeXml(nodePath)}</Command>
|
|
203
|
+
<Arguments>${escapeXml(args)}</Arguments>
|
|
204
|
+
</Exec>
|
|
205
|
+
</Actions>
|
|
206
|
+
</Task>
|
|
207
|
+
`;
|
|
208
|
+
}
|
|
@@ -124,19 +124,19 @@ Please note that certain algorithms may not be available depending on the runtim
|
|
|
124
124
|
<details>
|
|
125
125
|
<summary>Details</summary>
|
|
126
126
|
|
|
127
|
-
- JSON Web Signature (JWS) - [RFC7515](https://www.rfc-editor.org/
|
|
128
|
-
- JSON Web Encryption (JWE) - [RFC7516](https://www.rfc-editor.org/
|
|
129
|
-
- JSON Web Key (JWK) - [RFC7517](https://www.rfc-editor.org/
|
|
130
|
-
- JSON Web Algorithms (JWA) - [RFC7518](https://www.rfc-editor.org/
|
|
131
|
-
- JSON Web Token (JWT) - [RFC7519](https://www.rfc-editor.org/
|
|
132
|
-
- JSON Web Key Thumbprint - [RFC7638](https://www.rfc-editor.org/
|
|
133
|
-
- JSON Web Key Thumbprint URI - [RFC9278](https://www.rfc-editor.org/
|
|
134
|
-
- JWS Unencoded Payload Option - [RFC7797](https://www.rfc-editor.org/
|
|
135
|
-
- CFRG Elliptic Curve ECDH and Signatures - [RFC8037](https://www.rfc-editor.org/
|
|
136
|
-
- Fully-Specified Algorithms for JOSE - [RFC9864](https://www.rfc-editor.org/
|
|
137
|
-
- ML-DSA for JOSE - [RFC9964](https://www.rfc-editor.org/
|
|
138
|
-
|
|
139
|
-
The algorithm implementations in `jose` have been tested using test vectors from their respective specifications as well as [RFC7520](https://www.rfc-editor.org/
|
|
127
|
+
- JSON Web Signature (JWS) - [RFC7515](https://www.rfc-editor.org/info/rfc7515/)
|
|
128
|
+
- JSON Web Encryption (JWE) - [RFC7516](https://www.rfc-editor.org/info/rfc7516/)
|
|
129
|
+
- JSON Web Key (JWK) - [RFC7517](https://www.rfc-editor.org/info/rfc7517/)
|
|
130
|
+
- JSON Web Algorithms (JWA) - [RFC7518](https://www.rfc-editor.org/info/rfc7518/)
|
|
131
|
+
- JSON Web Token (JWT) - [RFC7519](https://www.rfc-editor.org/info/rfc7519/)
|
|
132
|
+
- JSON Web Key Thumbprint - [RFC7638](https://www.rfc-editor.org/info/rfc7638/)
|
|
133
|
+
- JSON Web Key Thumbprint URI - [RFC9278](https://www.rfc-editor.org/info/rfc9278/)
|
|
134
|
+
- JWS Unencoded Payload Option - [RFC7797](https://www.rfc-editor.org/info/rfc7797/)
|
|
135
|
+
- CFRG Elliptic Curve ECDH and Signatures - [RFC8037](https://www.rfc-editor.org/info/rfc8037/)
|
|
136
|
+
- Fully-Specified Algorithms for JOSE - [RFC9864](https://www.rfc-editor.org/info/rfc9864/)
|
|
137
|
+
- ML-DSA for JOSE - [RFC9964](https://www.rfc-editor.org/info/rfc9964/)
|
|
138
|
+
|
|
139
|
+
The algorithm implementations in `jose` have been tested using test vectors from their respective specifications as well as [RFC7520](https://www.rfc-editor.org/info/rfc7520/).
|
|
140
140
|
|
|
141
141
|
</details>
|
|
142
142
|
|
|
@@ -27,8 +27,9 @@ export { EncryptJWT } from './jwt/encrypt.js';
|
|
|
27
27
|
export { calculateJwkThumbprint, calculateJwkThumbprintUri } from './jwk/thumbprint.js';
|
|
28
28
|
export { EmbeddedJWK } from './jwk/embedded.js';
|
|
29
29
|
export { createLocalJWKSet } from './jwks/local.js';
|
|
30
|
+
export type { LocalJWKSet } from './jwks/local.js';
|
|
30
31
|
export { createRemoteJWKSet, jwksCache, customFetch } from './jwks/remote.js';
|
|
31
|
-
export type { RemoteJWKSetOptions, JWKSCacheInput, ExportedJWKSCache, FetchImplementation, } from './jwks/remote.js';
|
|
32
|
+
export type { RemoteJWKSet, RemoteJWKSetOptions, JWKSCacheInput, ExportedJWKSCache, FetchImplementation, } from './jwks/remote.js';
|
|
32
33
|
export { UnsecuredJWT } from './jwt/unsecured.js';
|
|
33
34
|
export type { UnsecuredResult } from './jwt/unsecured.js';
|
|
34
35
|
export { exportPKCS8, exportSPKI, exportJWK } from './key/export.js';
|
|
@@ -40,16 +41,16 @@ export type { ProtectedHeaderParameters } from './util/decode_protected_header.j
|
|
|
40
41
|
import * as errors from './util/errors.js';
|
|
41
42
|
export { errors };
|
|
42
43
|
export { generateKeyPair } from './key/generate_key_pair.js';
|
|
43
|
-
export type { GenerateKeyPairResult, GenerateKeyPairOptions } from './key/generate_key_pair.js';
|
|
44
|
+
export type { GenerateKeyPairAlgorithm, GenerateKeyPairResult, GenerateKeyPairOptions, } from './key/generate_key_pair.js';
|
|
44
45
|
export { generateSecret } from './key/generate_secret.js';
|
|
45
|
-
export type { GenerateSecretOptions } from './key/generate_secret.js';
|
|
46
|
+
export type { GenerateSecretAlgorithm, GenerateSecretOptions } from './key/generate_secret.js';
|
|
46
47
|
import * as base64url from './util/base64url.js';
|
|
47
48
|
export { base64url };
|
|
48
|
-
export type { CompactDecryptResult, CompactJWEHeaderParameters, CompactJWSHeaderParameters, CompactVerifyResult, CritOption, CryptoKey, DecryptOptions, EncryptOptions, FlattenedDecryptResult, FlattenedJWE, FlattenedJWS, FlattenedJWSInput, FlattenedVerifyResult, GeneralDecryptResult, GeneralJWE, GeneralJWS, GeneralJWSInput, GeneralVerifyResult, GetKeyFunction, JoseHeaderParameters, JSONWebKeySet, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWK_EC_Private, JWK_EC_Public, JWK_oct, JWK_OKP_Private, JWK_OKP_Public, JWK_RSA_Private, JWK_RSA_Public, JWK, JWKParameters, JWSHeaderParameters, JWTClaimVerificationOptions, JWTDecryptResult, JWTHeaderParameters, JWTPayload, JWTVerifyResult, KeyObject, ProduceJWT, ResolvedKey, SignOptions, VerifyOptions, } from './types.d.ts';
|
|
49
|
+
export type { AnyJWK, CompactDecryptResult, CompactJWEHeaderParameters, CompactJWSHeaderParameters, CompactVerifyResult, CritOption, CryptoKey, DecryptOptions, EncryptOptions, FlattenedDecryptResult, FlattenedJWE, FlattenedJWS, FlattenedJWSInput, FlattenedVerifyResult, GeneralDecryptResult, GeneralJWE, GeneralJWS, GeneralJWSInput, GeneralVerifyResult, GetKeyFunction, JoseHeaderParameters, JSONWebKeySet, JWEContentEncryptionAlgorithm, JWEHeaderParameters, JWEKeyManagementAlgorithm, JWEKeyManagementHeaderParameters, JWK_AKP_Private, JWK_AKP_Public, JWK_EC_Private, JWK_EC_Public, JWK_oct, JWK_OKP_Private, JWK_OKP_Public, JWK_RSA_Private, JWK_RSA_Public, JWK, JWKKeyType, JWKParameters, JWSAlgorithm, JWSHeaderParameters, JWTClaimVerificationOptions, JWTDecryptResult, JWTHeaderParameters, JWTPayload, JWTVerifyResult, KeyInput, KeyObject, ProduceJWT, ResolvedKey, SignOptions, VerifyOptions, } from './types.d.ts';
|
|
49
50
|
/**
|
|
50
51
|
* In prior releases this indicated whether a Node.js-specific build was loaded, this is now fixed
|
|
51
52
|
* to `"WebCryptoAPI"`
|
|
52
53
|
*
|
|
53
|
-
* @deprecated
|
|
54
|
+
* @deprecated Remove any runtime branching on this value; it is always `"WebCryptoAPI"`.
|
|
54
55
|
*/
|
|
55
56
|
export declare const cryptoRuntime = "WebCryptoAPI";
|
|
@@ -1,31 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decrypting JSON Web Encryption (JWE) in Compact Serialization
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../../types.d.ts';
|
|
7
2
|
/**
|
|
8
3
|
* Interface for Compact JWE Decryption dynamic key resolution. No token components have been
|
|
9
4
|
* verified at the time of this function call.
|
|
10
5
|
*/
|
|
11
|
-
export interface CompactDecryptGetKey extends types.GetKeyFunction<types.CompactJWEHeaderParameters, types.FlattenedJWE> {
|
|
6
|
+
export interface CompactDecryptGetKey<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array> extends types.GetKeyFunction<types.CompactJWEHeaderParameters, types.FlattenedJWE, KeyType | types.KeyObject | types.JWK> {
|
|
12
7
|
}
|
|
13
8
|
/**
|
|
14
9
|
* Decrypts a Compact JWE.
|
|
15
10
|
*
|
|
16
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
17
|
-
* as from its subpath export `'jose/jwe/compact/decrypt'`.
|
|
18
|
-
*
|
|
19
11
|
* @param jwe Compact JWE.
|
|
20
12
|
* @param key Private Key or Secret to decrypt the JWE with. See
|
|
21
13
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
22
14
|
* @param options JWE Decryption options.
|
|
23
15
|
*/
|
|
24
|
-
export declare function compactDecrypt(jwe: string | Uint8Array, key: types.
|
|
16
|
+
export declare function compactDecrypt(jwe: string | Uint8Array, key: types.KeyInput, options?: types.DecryptOptions): Promise<types.CompactDecryptResult>;
|
|
25
17
|
/**
|
|
18
|
+
* Decrypts a Compact JWE, resolving the key dynamically. The result additionally carries the
|
|
19
|
+
* {@link types.ResolvedKey.key resolved key}.
|
|
20
|
+
*
|
|
26
21
|
* @param jwe Compact JWE.
|
|
27
22
|
* @param getKey Function resolving Private Key or Secret to decrypt the JWE with. See
|
|
28
23
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
29
24
|
* @param options JWE Decryption options.
|
|
30
25
|
*/
|
|
31
|
-
export declare function compactDecrypt(jwe: string | Uint8Array, getKey: CompactDecryptGetKey
|
|
26
|
+
export declare function compactDecrypt<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array>(jwe: string | Uint8Array, getKey: CompactDecryptGetKey<KeyType>, options?: types.DecryptOptions): Promise<types.CompactDecryptResult & types.ResolvedKey<KeyType>>;
|
|
27
|
+
/**
|
|
28
|
+
* Accepts either form of the `key` argument. Use this overload when forwarding a value that may be
|
|
29
|
+
* either a key or a key resolution function; `key` is present on the result only when a resolution
|
|
30
|
+
* function was used.
|
|
31
|
+
*
|
|
32
|
+
* @param jwe Compact JWE.
|
|
33
|
+
* @param key Private Key or Secret, or a function resolving one, to decrypt the JWE with. See
|
|
34
|
+
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
35
|
+
* @param options JWE Decryption options.
|
|
36
|
+
*/
|
|
37
|
+
export declare function compactDecrypt(jwe: string | Uint8Array, key: types.KeyInput | CompactDecryptGetKey, options?: types.DecryptOptions): Promise<types.CompactDecryptResult & Partial<types.ResolvedKey>>;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encrypting JSON Web Encryption (JWE) in Compact Serialization
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../../types.d.ts';
|
|
7
|
-
/**
|
|
8
|
-
* The CompactEncrypt class is used to build and encrypt Compact JWE strings.
|
|
9
|
-
*
|
|
10
|
-
* This class is exported (as a named export) from the main `'jose'` module entry point as well as
|
|
11
|
-
* from its subpath export `'jose/jwe/compact/encrypt'`.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
2
|
+
/** The CompactEncrypt class is used to build and encrypt Compact JWE strings. */
|
|
14
3
|
export declare class CompactEncrypt {
|
|
15
4
|
#private;
|
|
16
5
|
/**
|
|
@@ -21,7 +10,7 @@ export declare class CompactEncrypt {
|
|
|
21
10
|
constructor(plaintext: Uint8Array);
|
|
22
11
|
/**
|
|
23
12
|
* Sets a content encryption key to use, by default a random suitable one is generated for the JWE
|
|
24
|
-
* enc" (Encryption Algorithm) Header Parameter.
|
|
13
|
+
* "enc" (Encryption Algorithm) Header Parameter.
|
|
25
14
|
*
|
|
26
15
|
* @deprecated You should not use this method. It is only really intended for test and vector
|
|
27
16
|
* validation purposes.
|
|
@@ -31,7 +20,7 @@ export declare class CompactEncrypt {
|
|
|
31
20
|
setContentEncryptionKey(cek: Uint8Array): this;
|
|
32
21
|
/**
|
|
33
22
|
* Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
|
|
34
|
-
* one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
|
|
23
|
+
* one is generated for the JWE "enc" (Encryption Algorithm) Header Parameter.
|
|
35
24
|
*
|
|
36
25
|
* @deprecated You should not use this method. It is only really intended for test and vector
|
|
37
26
|
* validation purposes.
|
|
@@ -46,10 +35,9 @@ export declare class CompactEncrypt {
|
|
|
46
35
|
*/
|
|
47
36
|
setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this;
|
|
48
37
|
/**
|
|
49
|
-
* Sets the JWE Key Management parameters to be used when encrypting.
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* PartyUInfo) or "apv" (Agreement PartyVInfo) parameters.
|
|
38
|
+
* Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
|
|
39
|
+
* use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
|
|
40
|
+
* parameters.
|
|
53
41
|
*
|
|
54
42
|
* @param parameters JWE Key Management parameters.
|
|
55
43
|
*/
|
|
@@ -61,5 +49,5 @@ export declare class CompactEncrypt {
|
|
|
61
49
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
62
50
|
* @param options JWE Encryption options.
|
|
63
51
|
*/
|
|
64
|
-
encrypt(key: types.
|
|
52
|
+
encrypt(key: types.KeyInput, options?: types.EncryptOptions): Promise<string>;
|
|
65
53
|
}
|
|
@@ -1,31 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decrypting JSON Web Encryption (JWE) in Flattened JSON Serialization
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../../types.d.ts';
|
|
7
2
|
/**
|
|
8
3
|
* Interface for Flattened JWE Decryption dynamic key resolution. No token components have been
|
|
9
4
|
* verified at the time of this function call.
|
|
10
5
|
*/
|
|
11
|
-
export interface FlattenedDecryptGetKey extends types.GetKeyFunction<types.JWEHeaderParameters | undefined, types.FlattenedJWE> {
|
|
6
|
+
export interface FlattenedDecryptGetKey<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array> extends types.GetKeyFunction<types.JWEHeaderParameters | undefined, types.FlattenedJWE, KeyType | types.KeyObject | types.JWK> {
|
|
12
7
|
}
|
|
13
8
|
/**
|
|
14
9
|
* Decrypts a Flattened JWE.
|
|
15
10
|
*
|
|
16
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
17
|
-
* as from its subpath export `'jose/jwe/flattened/decrypt'`.
|
|
18
|
-
*
|
|
19
11
|
* @param jwe Flattened JWE.
|
|
20
12
|
* @param key Private Key or Secret to decrypt the JWE with. See
|
|
21
13
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
22
14
|
* @param options JWE Decryption options.
|
|
23
15
|
*/
|
|
24
|
-
export declare function flattenedDecrypt(jwe: types.FlattenedJWE, key: types.
|
|
16
|
+
export declare function flattenedDecrypt(jwe: types.FlattenedJWE, key: types.KeyInput, options?: types.DecryptOptions): Promise<types.FlattenedDecryptResult>;
|
|
25
17
|
/**
|
|
18
|
+
* Decrypts a Flattened JWE, resolving the key dynamically. The result additionally carries the
|
|
19
|
+
* {@link types.ResolvedKey.key resolved key}.
|
|
20
|
+
*
|
|
26
21
|
* @param jwe Flattened JWE.
|
|
27
22
|
* @param getKey Function resolving Private Key or Secret to decrypt the JWE with. See
|
|
28
23
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
29
24
|
* @param options JWE Decryption options.
|
|
30
25
|
*/
|
|
31
|
-
export declare function flattenedDecrypt(jwe: types.FlattenedJWE, getKey: FlattenedDecryptGetKey
|
|
26
|
+
export declare function flattenedDecrypt<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array>(jwe: types.FlattenedJWE, getKey: FlattenedDecryptGetKey<KeyType>, options?: types.DecryptOptions): Promise<types.FlattenedDecryptResult & types.ResolvedKey<KeyType>>;
|
|
27
|
+
/**
|
|
28
|
+
* Accepts either form of the `key` argument. Use this overload when forwarding a value that may be
|
|
29
|
+
* either a key or a key resolution function; `key` is present on the result only when a resolution
|
|
30
|
+
* function was used.
|
|
31
|
+
*
|
|
32
|
+
* @param jwe Flattened JWE.
|
|
33
|
+
* @param key Private Key or Secret, or a function resolving one, to decrypt the JWE with. See
|
|
34
|
+
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
35
|
+
* @param options JWE Decryption options.
|
|
36
|
+
*/
|
|
37
|
+
export declare function flattenedDecrypt(jwe: types.FlattenedJWE, key: types.KeyInput | FlattenedDecryptGetKey, options?: types.DecryptOptions): Promise<types.FlattenedDecryptResult & Partial<types.ResolvedKey>>;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encrypting JSON Web Encryption (JWE) in Flattened JSON Serialization
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../../types.d.ts';
|
|
7
|
-
/**
|
|
8
|
-
* The FlattenedEncrypt class is used to build and encrypt Flattened JWE objects.
|
|
9
|
-
*
|
|
10
|
-
* This class is exported (as a named export) from the main `'jose'` module entry point as well as
|
|
11
|
-
* from its subpath export `'jose/jwe/flattened/encrypt'`.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
2
|
+
/** The FlattenedEncrypt class is used to build and encrypt Flattened JWE objects. */
|
|
14
3
|
export declare class FlattenedEncrypt {
|
|
15
4
|
#private;
|
|
16
5
|
/**
|
|
@@ -20,10 +9,9 @@ export declare class FlattenedEncrypt {
|
|
|
20
9
|
*/
|
|
21
10
|
constructor(plaintext: Uint8Array);
|
|
22
11
|
/**
|
|
23
|
-
* Sets the JWE Key Management parameters to be used when encrypting.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* PartyUInfo) or "apv" (Agreement PartyVInfo) parameters.
|
|
12
|
+
* Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
|
|
13
|
+
* use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
|
|
14
|
+
* parameters.
|
|
27
15
|
*
|
|
28
16
|
* @param parameters JWE Key Management parameters.
|
|
29
17
|
*/
|
|
@@ -54,7 +42,7 @@ export declare class FlattenedEncrypt {
|
|
|
54
42
|
setAdditionalAuthenticatedData(aad: Uint8Array): this;
|
|
55
43
|
/**
|
|
56
44
|
* Sets a content encryption key to use, by default a random suitable one is generated for the JWE
|
|
57
|
-
* enc" (Encryption Algorithm) Header Parameter.
|
|
45
|
+
* "enc" (Encryption Algorithm) Header Parameter.
|
|
58
46
|
*
|
|
59
47
|
* @deprecated You should not use this method. It is only really intended for test and vector
|
|
60
48
|
* validation purposes.
|
|
@@ -64,7 +52,7 @@ export declare class FlattenedEncrypt {
|
|
|
64
52
|
setContentEncryptionKey(cek: Uint8Array): this;
|
|
65
53
|
/**
|
|
66
54
|
* Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
|
|
67
|
-
* one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
|
|
55
|
+
* one is generated for the JWE "enc" (Encryption Algorithm) Header Parameter.
|
|
68
56
|
*
|
|
69
57
|
* @deprecated You should not use this method. It is only really intended for test and vector
|
|
70
58
|
* validation purposes.
|
|
@@ -79,5 +67,5 @@ export declare class FlattenedEncrypt {
|
|
|
79
67
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
80
68
|
* @param options JWE Encryption options.
|
|
81
69
|
*/
|
|
82
|
-
encrypt(key: types.
|
|
70
|
+
encrypt(key: types.KeyInput, options?: types.EncryptOptions): Promise<types.FlattenedJWE>;
|
|
83
71
|
}
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decrypting JSON Web Encryption (JWE) in General JSON Serialization
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../../types.d.ts';
|
|
7
2
|
/**
|
|
8
3
|
* Interface for General JWE Decryption dynamic key resolution. No token components have been
|
|
9
4
|
* verified at the time of this function call.
|
|
10
5
|
*/
|
|
11
|
-
export interface GeneralDecryptGetKey extends types.GetKeyFunction<types.JWEHeaderParameters, types.FlattenedJWE> {
|
|
6
|
+
export interface GeneralDecryptGetKey<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array> extends types.GetKeyFunction<types.JWEHeaderParameters | undefined, types.FlattenedJWE, KeyType | types.KeyObject | types.JWK> {
|
|
12
7
|
}
|
|
13
8
|
/**
|
|
14
9
|
* Decrypts a General JWE.
|
|
15
10
|
*
|
|
16
|
-
*
|
|
17
|
-
* as from its subpath export `'jose/jwe/general/decrypt'`.
|
|
18
|
-
*
|
|
19
|
-
* > [!NOTE]\
|
|
20
|
-
* > The function iterates over the `recipients` array in the General JWE and returns the decryption
|
|
11
|
+
* > Note: The function iterates over the `recipients` array in the General JWE and returns the decryption
|
|
21
12
|
* > result of the first recipient entry that can be successfully decrypted. The result only contains
|
|
22
13
|
* > the plaintext and headers of that successfully decrypted recipient entry. Other recipient entries
|
|
23
14
|
* > in the General JWE are not validated, and their headers are not included in the returned result.
|
|
@@ -28,11 +19,25 @@ export interface GeneralDecryptGetKey extends types.GetKeyFunction<types.JWEHead
|
|
|
28
19
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
29
20
|
* @param options JWE Decryption options.
|
|
30
21
|
*/
|
|
31
|
-
export declare function generalDecrypt(jwe: types.GeneralJWE, key: types.
|
|
22
|
+
export declare function generalDecrypt(jwe: types.GeneralJWE, key: types.KeyInput, options?: types.DecryptOptions): Promise<types.GeneralDecryptResult>;
|
|
32
23
|
/**
|
|
24
|
+
* Decrypts a General JWE, resolving the key dynamically. The result additionally carries the
|
|
25
|
+
* {@link types.ResolvedKey.key resolved key}.
|
|
26
|
+
*
|
|
33
27
|
* @param jwe General JWE.
|
|
34
28
|
* @param getKey Function resolving Private Key or Secret to decrypt the JWE with. See
|
|
35
29
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
36
30
|
* @param options JWE Decryption options.
|
|
37
31
|
*/
|
|
38
|
-
export declare function generalDecrypt(jwe: types.GeneralJWE, getKey: GeneralDecryptGetKey
|
|
32
|
+
export declare function generalDecrypt<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array>(jwe: types.GeneralJWE, getKey: GeneralDecryptGetKey<KeyType>, options?: types.DecryptOptions): Promise<types.GeneralDecryptResult & types.ResolvedKey<KeyType>>;
|
|
33
|
+
/**
|
|
34
|
+
* Accepts either form of the `key` argument. Use this overload when forwarding a value that may be
|
|
35
|
+
* either a key or a key resolution function; `key` is present on the result only when a resolution
|
|
36
|
+
* function was used.
|
|
37
|
+
*
|
|
38
|
+
* @param jwe General JWE.
|
|
39
|
+
* @param key Private Key or Secret, or a function resolving one, to decrypt the JWE with. See
|
|
40
|
+
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
41
|
+
* @param options JWE Decryption options.
|
|
42
|
+
*/
|
|
43
|
+
export declare function generalDecrypt(jwe: types.GeneralJWE, key: types.KeyInput | GeneralDecryptGetKey, options?: types.DecryptOptions): Promise<types.GeneralDecryptResult & Partial<types.ResolvedKey>>;
|