@ocap/wallet
Advanced tools
Comparing version 1.13.6 to 1.13.7
@@ -50,2 +50,3 @@ /** | ||
}, | ||
sign(data, hashBeforeSign = true) { | ||
@@ -64,2 +65,3 @@ if (!keyPair.sk) { | ||
}, | ||
verify(data, signature, hashBeforeVerify = true) { | ||
@@ -73,5 +75,37 @@ if (!keyPair.pk) { | ||
}, | ||
ethHash(data) { | ||
if (typeof signer.ethHash !== 'function') { | ||
throw new Error('ethHash is not supported by signer'); | ||
} | ||
return signer.ethHash(data); | ||
}, | ||
ethSign(data, hashBeforeSign = true) { | ||
if (!keyPair.sk) { | ||
throw new Error('Cannot sign data without a secretKey'); | ||
} | ||
if (typeof signer.ethHash !== 'function') { | ||
throw new Error('ethSign is not supported by signer'); | ||
} | ||
if (hashBeforeSign) { | ||
return signer.ethSign(signer.ethHash(data), keyPair.sk); | ||
} | ||
return signer.ethSign(data, keyPair.sk); | ||
}, | ||
ethVerify(data, signature, hashBeforeVerify = true) { | ||
if (typeof signer.ethHash !== 'function') { | ||
throw new Error('ethVerify is not supported by signer'); | ||
} | ||
const hash = hashBeforeVerify ? signer.ethHash(data) : data; | ||
return signer.ethRecover(hash, signature) === this.toAddress(); | ||
}, | ||
toAddress() { | ||
return keyPair.pk ? DIDFromPublicKey(keyPair.pk, type) : keyPair.address; | ||
}, | ||
toJSON() { | ||
@@ -78,0 +112,0 @@ return { |
{ | ||
"name": "@ocap/wallet", | ||
"version": "1.13.6", | ||
"version": "1.13.7", | ||
"description": "Utility function to create and use an forge compatible crypto wallet", | ||
@@ -48,6 +48,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@arcblock/did": "1.13.6", | ||
"@ocap/mcrypto": "1.13.6" | ||
"@arcblock/did": "1.13.7", | ||
"@ocap/mcrypto": "1.13.7" | ||
}, | ||
"gitHead": "f01e775678b528d79f5a135c235e4532afe167d6" | ||
"gitHead": "9276a321adad6531a58367cae309529ac3a375a3" | ||
} |
17490
417
+ Added@arcblock/did@1.13.7(transitive)
+ Added@ocap/mcrypto@1.13.7(transitive)
+ Added@ocap/util@1.13.7(transitive)
+ Addedaccepts@1.3.8(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedarray-flatten@1.1.1(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasync-limiter@1.0.1(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbody-parser@1.20.3(transitive)
+ Addedbuffer-to-arraybuffer@0.0.5(transitive)
+ Addedbytes@3.1.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcontent-disposition@0.5.4(transitive)
+ Addedcontent-type@1.0.5(transitive)
+ Addedcookie@0.7.1(transitive)
+ Addedcookie-signature@1.0.6(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addedcors@2.8.5(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddecode-uri-component@0.2.2(transitive)
+ Addeddecompress-response@3.3.0(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddepd@2.0.0(transitive)
+ Addeddestroy@1.2.0(transitive)
+ Addeddom-walk@0.1.2(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedee-first@1.1.1(transitive)
+ Addedencodeurl@1.0.22.0.0(transitive)
+ Addedescape-html@1.0.3(transitive)
+ Addedetag@1.8.1(transitive)
+ Addedeth-lib@0.1.29(transitive)
+ Addedexpress@4.21.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfinalhandler@1.3.1(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedforwarded@0.2.0(transitive)
+ Addedfresh@0.5.2(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedglobal@4.4.0(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhttp-errors@2.0.0(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedipaddr.js@1.9.1(transitive)
+ Addedis-function@1.0.2(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedmedia-typer@0.3.0(transitive)
+ Addedmerge-descriptors@1.0.3(transitive)
+ Addedmethods@1.1.2(transitive)
+ Addedmime@1.6.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedmimic-response@1.0.1(transitive)
+ Addedmin-document@2.19.0(transitive)
+ Addedms@2.0.0(transitive)
+ Addednano-json-stream-parser@0.1.2(transitive)
+ Addednegotiator@0.6.3(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedon-finished@2.4.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedparse-headers@2.0.5(transitive)
+ Addedparseurl@1.3.3(transitive)
+ Addedpath-to-regexp@0.1.12(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedproxy-addr@2.0.7(transitive)
+ Addedpsl@1.15.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.13.06.5.3(transitive)
+ Addedquery-string@5.1.1(transitive)
+ Addedrange-parser@1.2.1(transitive)
+ Addedraw-body@2.5.2(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsend@0.19.0(transitive)
+ Addedserve-static@1.16.2(transitive)
+ Addedservify@0.1.12(transitive)
+ Addedsetprototypeof@1.2.0(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedsimple-concat@1.0.1(transitive)
+ Addedsimple-get@2.8.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstatuses@2.0.1(transitive)
+ Addedstrict-uri-encode@1.1.0(transitive)
+ Addedtimed-out@4.0.1(transitive)
+ Addedtoidentifier@1.0.1(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addedtype-is@1.6.18(transitive)
+ Addedultron@1.1.1(transitive)
+ Addedunpipe@1.0.0(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedurl-set-query@1.0.0(transitive)
+ Addedutils-merge@1.0.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedvary@1.1.2(transitive)
+ Addedverror@1.10.0(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedws@3.3.3(transitive)
+ Addedxhr@2.6.0(transitive)
+ Addedxhr-request@1.1.0(transitive)
+ Addedxhr-request-promise@0.1.3(transitive)
+ Addedxtend@4.0.2(transitive)
- Removed@arcblock/did@1.13.6(transitive)
- Removed@ocap/mcrypto@1.13.6(transitive)
- Removed@ocap/util@1.13.6(transitive)
Updated@arcblock/did@1.13.7
Updated@ocap/mcrypto@1.13.7