@arcblock/validator 1.29.17 → 1.29.19
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/esm/extension/did.mjs +10 -3
- package/lib/extension/did.cjs +9 -2
- package/package.json +4 -4
package/esm/extension/did.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DID_TYPE_ARCBLOCK, DID_TYPE_ETHEREUM, DID_TYPE_PASSKEY, isKnownDid, toAddress, toTypeInfo, toTypeInfoStr } from "@arcblock/did";
|
|
2
2
|
import { types } from "@ocap/mcrypto";
|
|
3
3
|
import isEqual from "lodash/isEqual.js";
|
|
4
4
|
|
|
@@ -23,7 +23,7 @@ function DIDExtension(root) {
|
|
|
23
23
|
},
|
|
24
24
|
validate(value, helpers) {
|
|
25
25
|
if (!value || typeof value !== "string") return { errors: helpers.error("did.empty", { value }) };
|
|
26
|
-
if (
|
|
26
|
+
if (isKnownDid(value) === false) return { errors: helpers.error("did.invalid", { value }) };
|
|
27
27
|
return { value };
|
|
28
28
|
},
|
|
29
29
|
rules: {
|
|
@@ -130,7 +130,14 @@ function DIDExtension(root) {
|
|
|
130
130
|
args: [{
|
|
131
131
|
name: "str",
|
|
132
132
|
ref: true,
|
|
133
|
-
assert: (v) => [
|
|
133
|
+
assert: (v) => [
|
|
134
|
+
"",
|
|
135
|
+
"did:abt:",
|
|
136
|
+
"did:afs:",
|
|
137
|
+
"did:aos:",
|
|
138
|
+
"did:spaces:",
|
|
139
|
+
"did:name:"
|
|
140
|
+
].includes(v),
|
|
134
141
|
message: "must be a string",
|
|
135
142
|
normalize: (v) => v.trim()
|
|
136
143
|
}],
|
package/lib/extension/did.cjs
CHANGED
|
@@ -25,7 +25,7 @@ function DIDExtension(root) {
|
|
|
25
25
|
},
|
|
26
26
|
validate(value, helpers) {
|
|
27
27
|
if (!value || typeof value !== "string") return { errors: helpers.error("did.empty", { value }) };
|
|
28
|
-
if ((0, _arcblock_did.
|
|
28
|
+
if ((0, _arcblock_did.isKnownDid)(value) === false) return { errors: helpers.error("did.invalid", { value }) };
|
|
29
29
|
return { value };
|
|
30
30
|
},
|
|
31
31
|
rules: {
|
|
@@ -132,7 +132,14 @@ function DIDExtension(root) {
|
|
|
132
132
|
args: [{
|
|
133
133
|
name: "str",
|
|
134
134
|
ref: true,
|
|
135
|
-
assert: (v) => [
|
|
135
|
+
assert: (v) => [
|
|
136
|
+
"",
|
|
137
|
+
"did:abt:",
|
|
138
|
+
"did:afs:",
|
|
139
|
+
"did:aos:",
|
|
140
|
+
"did:spaces:",
|
|
141
|
+
"did:name:"
|
|
142
|
+
].includes(v),
|
|
136
143
|
message: "must be a string",
|
|
137
144
|
normalize: (v) => v.trim()
|
|
138
145
|
}],
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "1.29.
|
|
7
|
+
"version": "1.29.19",
|
|
8
8
|
"description": "",
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"main": "./lib/index.cjs",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"clean": "rm -rf lib esm"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@arcblock/did": "1.29.
|
|
45
|
-
"@ocap/mcrypto": "1.29.
|
|
46
|
-
"@ocap/util": "1.29.
|
|
44
|
+
"@arcblock/did": "1.29.19",
|
|
45
|
+
"@ocap/mcrypto": "1.29.19",
|
|
46
|
+
"@ocap/util": "1.29.19",
|
|
47
47
|
"bn.js": "5.2.3",
|
|
48
48
|
"joi": "^17.7.0",
|
|
49
49
|
"lodash": "^4.17.23"
|