@abtnode/auth 1.16.11-next-8a4df821 → 1.16.11-next-ca5f18b5

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.
Files changed (2) hide show
  1. package/lib/auth.js +36 -0
  2. package/package.json +7 -7
package/lib/auth.js CHANGED
@@ -1122,8 +1122,44 @@ const setUserInfoHeaders = (req) => {
1122
1122
  }
1123
1123
  };
1124
1124
 
1125
+ /**
1126
+ * Defines properties for an asset.
1127
+ * @typedef {Object} AssetClaim
1128
+ * @property {string} acquireUrl URL to acquire the asset
1129
+ * @property {string} asset The asset identifier
1130
+ * @property {string} description A description of the asset
1131
+ * @property {Filter[]} [filters] Filters that can be used to acquire the asset
1132
+ * @property {Object} [meta] Metadata associated with the asset
1133
+ * @property {string[]} [mfaCode] Multi-factor authentication code for the asset
1134
+ * @property {boolean} optional Whether the asset is optional or required
1135
+ * @property {string} ownerDid DID of the asset owner
1136
+ * @property {string} ownerPk Public key of the asset owner
1137
+ * @property {string} ownerProof Ownership proof for the asset
1138
+ * @property {string} [tag] Tag or category of the asset
1139
+ * @property {'asset'} type The type of entity, always "asset"
1140
+ */
1141
+
1142
+ /**
1143
+ * @typedef {Object} Filter
1144
+ * @property {string} acquireUrl URL to acquire the asset through this filter
1145
+ * @property {string} tag Tag associated with this filter
1146
+ * @property {string[]} trustedIssuers Issuers trusted for this filter
1147
+ */
1148
+
1149
+ /**
1150
+ *
1151
+ * @description 校验 NFT
1152
+ * @param {{
1153
+ * claims: any[],
1154
+ * challenge: any,
1155
+ * chainHost: string,
1156
+ * locale: 'zh' | 'en',
1157
+ * }}
1158
+ * @returns {Promise<import('@ocap/client').AssetState>}
1159
+ */
1125
1160
  const verifyNFT = async ({ claims, challenge, chainHost, locale }) => {
1126
1161
  const client = getChainClient(chainHost);
1162
+ /** @type {AssetClaim} */
1127
1163
  const claim = claims.find((x) => x.type === 'asset');
1128
1164
  if (!claim) {
1129
1165
  throw new Error(messages.missingNftClaim[locale]);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.11-next-8a4df821",
6
+ "version": "1.16.11-next-ca5f18b5",
7
7
  "description": "Simple lib to manage auth in ABT Node",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -20,13 +20,13 @@
20
20
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@abtnode/constant": "1.16.11-next-8a4df821",
24
- "@abtnode/logger": "1.16.11-next-8a4df821",
25
- "@abtnode/util": "1.16.11-next-8a4df821",
23
+ "@abtnode/constant": "1.16.11-next-ca5f18b5",
24
+ "@abtnode/logger": "1.16.11-next-ca5f18b5",
25
+ "@abtnode/util": "1.16.11-next-ca5f18b5",
26
26
  "@arcblock/did": "1.18.80",
27
27
  "@arcblock/vc": "1.18.80",
28
- "@blocklet/constant": "1.16.11-next-8a4df821",
29
- "@blocklet/meta": "1.16.11-next-8a4df821",
28
+ "@blocklet/constant": "1.16.11-next-ca5f18b5",
29
+ "@blocklet/meta": "1.16.11-next-ca5f18b5",
30
30
  "@ocap/mcrypto": "1.18.80",
31
31
  "@ocap/util": "1.18.80",
32
32
  "@ocap/wallet": "1.18.80",
@@ -42,5 +42,5 @@
42
42
  "devDependencies": {
43
43
  "jest": "^27.5.1"
44
44
  },
45
- "gitHead": "194300e66d207fd7d5e40f5e97fc58c4bdd9ffd7"
45
+ "gitHead": "d797d0177d585b66d17876c99c994fda4d812f37"
46
46
  }