@riocrypto/common-server 1.0.2272 → 1.0.2273
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/build/index.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ export * from "./models/STP-deposit-CLABE";
|
|
|
90
90
|
export * from "./models/STP-settings";
|
|
91
91
|
export * from "./models/dashboard-push-notification-subscription";
|
|
92
92
|
export * from "./models/webauthn-credential";
|
|
93
|
+
export * from "./models/admin-webauthn-credential";
|
|
93
94
|
export * from "./clients/axios-with-logging";
|
|
94
95
|
export * from "./clients/slack-client";
|
|
95
96
|
export * from "./clients/fireblocks-client";
|
package/build/index.js
CHANGED
|
@@ -106,6 +106,7 @@ __exportStar(require("./models/STP-deposit-CLABE"), exports);
|
|
|
106
106
|
__exportStar(require("./models/STP-settings"), exports);
|
|
107
107
|
__exportStar(require("./models/dashboard-push-notification-subscription"), exports);
|
|
108
108
|
__exportStar(require("./models/webauthn-credential"), exports);
|
|
109
|
+
__exportStar(require("./models/admin-webauthn-credential"), exports);
|
|
109
110
|
__exportStar(require("./clients/axios-with-logging"), exports);
|
|
110
111
|
__exportStar(require("./clients/slack-client"), exports);
|
|
111
112
|
__exportStar(require("./clients/fireblocks-client"), exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
3
|
+
import { AdminAuthDoc } from "./admin-auth";
|
|
4
|
+
export interface AdminWebAuthnCredentialAttrs {
|
|
5
|
+
adminAuthId: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
credentialID: string;
|
|
8
|
+
publicKey: Buffer;
|
|
9
|
+
counter: number;
|
|
10
|
+
transports?: string[];
|
|
11
|
+
backedUp: boolean;
|
|
12
|
+
aaguid: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AdminWebAuthnCredentialDoc extends Document {
|
|
15
|
+
adminAuthId: AdminAuthDoc["_id"];
|
|
16
|
+
name?: string;
|
|
17
|
+
credentialID: string;
|
|
18
|
+
publicKey: Buffer;
|
|
19
|
+
counter: number;
|
|
20
|
+
transports?: string[];
|
|
21
|
+
backedUp: boolean;
|
|
22
|
+
aaguid: string;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
updatedAt: Date;
|
|
25
|
+
}
|
|
26
|
+
interface AdminWebAuthnCredentialModel extends Model<AdminWebAuthnCredentialDoc> {
|
|
27
|
+
build(attrs: AdminWebAuthnCredentialAttrs): AdminWebAuthnCredentialDoc;
|
|
28
|
+
}
|
|
29
|
+
declare const buildAdminWebAuthnCredential: (mongoose: Mongoose) => AdminWebAuthnCredentialModel;
|
|
30
|
+
export { buildAdminWebAuthnCredential };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAdminWebAuthnCredential = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const buildAdminWebAuthnCredential = (mongoose) => {
|
|
6
|
+
// If model is already defined, return it to prevent OverwriteModelError
|
|
7
|
+
if (mongoose.models.AdminWebAuthnCredential) {
|
|
8
|
+
return mongoose.model("AdminWebAuthnCredential");
|
|
9
|
+
}
|
|
10
|
+
const adminWebAuthnCredentialSchema = new mongoose.Schema({
|
|
11
|
+
adminAuthId: {
|
|
12
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
13
|
+
ref: "AdminAuth",
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
name: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: false,
|
|
19
|
+
},
|
|
20
|
+
credentialID: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
unique: true, // WebAuthn Level 1 spec: credential IDs are globally unique.
|
|
24
|
+
},
|
|
25
|
+
publicKey: {
|
|
26
|
+
type: Buffer,
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
counter: {
|
|
30
|
+
type: Number,
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
transports: {
|
|
34
|
+
type: [String],
|
|
35
|
+
required: false,
|
|
36
|
+
},
|
|
37
|
+
backedUp: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
required: true,
|
|
40
|
+
default: false,
|
|
41
|
+
},
|
|
42
|
+
aaguid: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: true,
|
|
45
|
+
},
|
|
46
|
+
}, {
|
|
47
|
+
timestamps: true,
|
|
48
|
+
toJSON: {
|
|
49
|
+
transform(doc, ret) {
|
|
50
|
+
ret.id = ret._id.valueOf();
|
|
51
|
+
delete ret._id;
|
|
52
|
+
delete ret.__v;
|
|
53
|
+
// Do not serialize publicKey by default
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
// Index for efficient lookup by authId, if you often query credentials for a user
|
|
58
|
+
adminWebAuthnCredentialSchema.index({ adminAuthId: 1 });
|
|
59
|
+
// Index for efficient lookup by credentialID as it's used during authentication
|
|
60
|
+
// This is already unique, but an explicit index can sometimes be beneficial for queries
|
|
61
|
+
// webAuthnCredentialSchema.index({ credentialID: 1 }); // unique:true already creates an index
|
|
62
|
+
adminWebAuthnCredentialSchema.statics.build = (attrs) => {
|
|
63
|
+
return new AdminWebAuthnCredential(attrs);
|
|
64
|
+
};
|
|
65
|
+
const AdminWebAuthnCredential = mongoose.model("AdminWebAuthnCredential", adminWebAuthnCredentialSchema);
|
|
66
|
+
return AdminWebAuthnCredential;
|
|
67
|
+
};
|
|
68
|
+
exports.buildAdminWebAuthnCredential = buildAdminWebAuthnCredential;
|