diff options
author | Fabio Berger <me@fabioberger.com> | 2017-05-25 18:06:38 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-05-25 18:06:38 +0800 |
commit | fa559377c80a75ba4169cab0825e5808154ae72b (patch) | |
tree | c8de187221945b99b63fb8b21553274f4a6ef647 /src/ts/schemas | |
parent | 0b8ddc1ee18c6d52fbc72177e8c5e180f9106708 (diff) | |
download | dexon-sol-tools-fa559377c80a75ba4169cab0825e5808154ae72b.tar dexon-sol-tools-fa559377c80a75ba4169cab0825e5808154ae72b.tar.gz dexon-sol-tools-fa559377c80a75ba4169cab0825e5808154ae72b.tar.bz2 dexon-sol-tools-fa559377c80a75ba4169cab0825e5808154ae72b.tar.lz dexon-sol-tools-fa559377c80a75ba4169cab0825e5808154ae72b.tar.xz dexon-sol-tools-fa559377c80a75ba4169cab0825e5808154ae72b.tar.zst dexon-sol-tools-fa559377c80a75ba4169cab0825e5808154ae72b.zip |
Improve ECSignature schema to check signature parameters and that v is 27 or 28
Diffstat (limited to 'src/ts/schemas')
-rw-r--r-- | src/ts/schemas/ec_signature_schema.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ts/schemas/ec_signature_schema.ts b/src/ts/schemas/ec_signature_schema.ts index e4249afc2..94e58e53c 100644 --- a/src/ts/schemas/ec_signature_schema.ts +++ b/src/ts/schemas/ec_signature_schema.ts @@ -1,9 +1,19 @@ +export const ECSignatureParameter = { + id: '/ECSignatureParameter', + type: 'string', + pattern: '^0[xX][0-9A-Fa-f]{64}$', +}; + export const ECSignatureSchema = { id: '/ECSignature', properties: { - v: {type: 'number'}, - r: {type: 'string'}, - s: {type: 'string'}, + v: { + type: 'number', + minimum: 27, + maximum: 28, + }, + r: {$ref: '/ECSignatureParameter'}, + s: {$ref: '/ECSignatureParameter'}, }, required: ['v', 'r', 's'], type: 'object', |