@riocrypto/common-server 1.0.2272 → 1.0.2274

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);
@@ -2,10 +2,12 @@ import mongoose from "mongoose";
2
2
  interface AdminAuthDashboardSettingsAttrs {
3
3
  adminAuthId: string;
4
4
  hideBackgroundAnimation?: boolean;
5
+ pwaInstallBannerDismissed?: boolean;
5
6
  }
6
7
  interface AdminAuthDashboardSettingsDoc extends mongoose.Document {
7
8
  adminAuthId: string;
8
9
  hideBackgroundAnimation?: boolean;
10
+ pwaInstallBannerDismissed?: boolean;
9
11
  }
10
12
  interface AdminAuthDashboardSettingsModel extends mongoose.Model<AdminAuthDashboardSettingsDoc> {
11
13
  build(attrs: AdminAuthDashboardSettingsAttrs): AdminAuthDashboardSettingsDoc;
@@ -14,6 +14,10 @@ const buildAdminAuthDashboardSettings = (mongoose) => {
14
14
  hideBackgroundAnimation: {
15
15
  type: Boolean,
16
16
  },
17
+ pwaInstallBannerDismissed: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
17
21
  }, {
18
22
  toJSON: {
19
23
  transform(doc, ret) {
@@ -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;
@@ -2,10 +2,12 @@ import mongoose from "mongoose";
2
2
  interface AuthDashboardSettingsAttrs {
3
3
  authId: string;
4
4
  hideBackgroundAnimation?: boolean;
5
+ pwaInstallBannerDismissed?: boolean;
5
6
  }
6
7
  interface AuthDashboardSettingsDoc extends mongoose.Document {
7
8
  authId: string;
8
9
  hideBackgroundAnimation?: boolean;
10
+ pwaInstallBannerDismissed?: boolean;
9
11
  }
10
12
  interface AuthDashboardSettingsModel extends mongoose.Model<AuthDashboardSettingsDoc> {
11
13
  build(attrs: AuthDashboardSettingsAttrs): AuthDashboardSettingsDoc;
@@ -14,6 +14,10 @@ const buildAuthDashboardSettings = (mongoose) => {
14
14
  hideBackgroundAnimation: {
15
15
  type: Boolean,
16
16
  },
17
+ pwaInstallBannerDismissed: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
17
21
  }, {
18
22
  toJSON: {
19
23
  transform(doc, ret) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2272",
3
+ "version": "1.0.2274",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/secret-manager": "^5.3.0",
29
29
  "@google-cloud/storage": "^6.9.5",
30
30
  "@hyperdx/node-opentelemetry": "^0.7.0",
31
- "@riocrypto/common": "^1.0.1990",
31
+ "@riocrypto/common": "^1.0.1992",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",