@nurama/sdk 1.4.2 → 1.4.3
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/dist/browser/nurama-bot-sdk.js +101 -4
- package/dist/browser/nurama-bot-sdk.min.js +1 -1
- package/dist/browser/nurama-sdk.js +101 -4
- package/dist/browser/nurama-sdk.min.js +1 -1
- package/dist/routes/auth.d.ts +45 -1
- package/dist/routes/auth.d.ts.map +1 -1
- package/dist/routes/auth.js +92 -0
- package/dist/routes/auth.js.map +1 -1
- package/dist/version.js +4 -4
- package/package.json +2 -2
- package/src/routes/auth.ts +108 -0
- package/src/version.ts +4 -4
|
@@ -4156,6 +4156,103 @@
|
|
|
4156
4156
|
});
|
|
4157
4157
|
return result;
|
|
4158
4158
|
},
|
|
4159
|
+
/**
|
|
4160
|
+
* Gets the options for the browser's passkey sign-in prompt. Pass them to the WebAuthn library
|
|
4161
|
+
* (`startAuthentication` in @simplewebauthn/browser), then send its result to `loginWithPasskey`.
|
|
4162
|
+
* @returns Promise resolving to WebAuthn request options.
|
|
4163
|
+
*/
|
|
4164
|
+
async getPasskeyLoginOptions() {
|
|
4165
|
+
return client._request({
|
|
4166
|
+
endpoint: "/v1/auth/passkeys/login-options",
|
|
4167
|
+
method: "POST",
|
|
4168
|
+
sendJWT: false
|
|
4169
|
+
});
|
|
4170
|
+
},
|
|
4171
|
+
/**
|
|
4172
|
+
* Signs in with the browser's response to the passkey prompt and stores the tokens.
|
|
4173
|
+
* A passkey stands in for two-factor, so this never returns an MFA challenge.
|
|
4174
|
+
* @param credential - The WebAuthn library's AuthenticationResponseJSON.
|
|
4175
|
+
* @returns Promise resolving to the user and tokens.
|
|
4176
|
+
*/
|
|
4177
|
+
async loginWithPasskey(credential) {
|
|
4178
|
+
const result = await client._request({
|
|
4179
|
+
endpoint: "/v1/auth/passkeys/login",
|
|
4180
|
+
method: "POST",
|
|
4181
|
+
body: { credential },
|
|
4182
|
+
sendJWT: false
|
|
4183
|
+
});
|
|
4184
|
+
client._setTokens(
|
|
4185
|
+
result.tokens.access.token,
|
|
4186
|
+
result.tokens.refresh.token,
|
|
4187
|
+
result.tokens.access.expires,
|
|
4188
|
+
result.tokens.refresh.expires
|
|
4189
|
+
);
|
|
4190
|
+
return result;
|
|
4191
|
+
},
|
|
4192
|
+
/**
|
|
4193
|
+
* Gets the options for the browser's "create a passkey" prompt, after confirming who is asking.
|
|
4194
|
+
* @param proof - The password when the account has one, and a two-factor code when two-factor is on.
|
|
4195
|
+
* @returns Promise resolving to WebAuthn creation options.
|
|
4196
|
+
*/
|
|
4197
|
+
async getPasskeyRegistrationOptions(proof = {}) {
|
|
4198
|
+
return client._request({
|
|
4199
|
+
endpoint: "/v1/auth/passkeys/registration-options",
|
|
4200
|
+
method: "POST",
|
|
4201
|
+
body: proof,
|
|
4202
|
+
sendJWT: true
|
|
4203
|
+
});
|
|
4204
|
+
},
|
|
4205
|
+
/**
|
|
4206
|
+
* Saves the passkey the browser created.
|
|
4207
|
+
* @param credential - The WebAuthn library's RegistrationResponseJSON.
|
|
4208
|
+
* @param name - Optional name to tell it apart, e.g. "MacBook".
|
|
4209
|
+
* @returns Promise resolving to the saved passkey.
|
|
4210
|
+
*/
|
|
4211
|
+
async registerPasskey(credential, name) {
|
|
4212
|
+
return client._request({
|
|
4213
|
+
endpoint: "/v1/auth/passkeys",
|
|
4214
|
+
method: "POST",
|
|
4215
|
+
body: { credential, ...name ? { name } : {} },
|
|
4216
|
+
sendJWT: true
|
|
4217
|
+
});
|
|
4218
|
+
},
|
|
4219
|
+
/**
|
|
4220
|
+
* Lists the authenticated user's passkeys, oldest first.
|
|
4221
|
+
* @returns Promise resolving to the user's passkeys.
|
|
4222
|
+
*/
|
|
4223
|
+
async listPasskeys() {
|
|
4224
|
+
return client._request({
|
|
4225
|
+
endpoint: "/v1/auth/passkeys",
|
|
4226
|
+
method: "GET",
|
|
4227
|
+
sendJWT: true
|
|
4228
|
+
});
|
|
4229
|
+
},
|
|
4230
|
+
/**
|
|
4231
|
+
* Renames one of the authenticated user's passkeys.
|
|
4232
|
+
* @param passkeyId - The passkey's id.
|
|
4233
|
+
* @param name - The new name.
|
|
4234
|
+
* @returns Promise resolving to the renamed passkey.
|
|
4235
|
+
*/
|
|
4236
|
+
async renamePasskey(passkeyId, name) {
|
|
4237
|
+
return client._request({
|
|
4238
|
+
endpoint: `/v1/auth/passkeys/${passkeyId}`,
|
|
4239
|
+
method: "PATCH",
|
|
4240
|
+
body: { name },
|
|
4241
|
+
sendJWT: true
|
|
4242
|
+
});
|
|
4243
|
+
},
|
|
4244
|
+
/**
|
|
4245
|
+
* Removes one of the authenticated user's passkeys.
|
|
4246
|
+
* @param passkeyId - The passkey's id.
|
|
4247
|
+
* @returns Promise resolving when complete.
|
|
4248
|
+
*/
|
|
4249
|
+
async deletePasskey(passkeyId) {
|
|
4250
|
+
await client._request({
|
|
4251
|
+
endpoint: `/v1/auth/passkeys/${passkeyId}`,
|
|
4252
|
+
method: "DELETE",
|
|
4253
|
+
sendJWT: true
|
|
4254
|
+
});
|
|
4255
|
+
},
|
|
4159
4256
|
/**
|
|
4160
4257
|
* Unlinks an OAuth provider from the authenticated user's account.
|
|
4161
4258
|
* User must have at least one authentication method remaining (password or another OAuth provider).
|
|
@@ -11259,10 +11356,10 @@
|
|
|
11259
11356
|
|
|
11260
11357
|
// src/version.ts
|
|
11261
11358
|
var SDK_VERSION = {
|
|
11262
|
-
version: "1.4.
|
|
11263
|
-
buildTimestamp: "2026-10-
|
|
11264
|
-
buildHash: "
|
|
11265
|
-
gitCommit: "
|
|
11359
|
+
version: "1.4.3",
|
|
11360
|
+
buildTimestamp: "2026-10-14T13:35:12.378Z",
|
|
11361
|
+
buildHash: "df74c9b4b055b19a9012e0c265c3b94f",
|
|
11362
|
+
gitCommit: "b66adea",
|
|
11266
11363
|
dirty: false
|
|
11267
11364
|
};
|
|
11268
11365
|
|