Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

as-chain

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

as-chain - npm Package Compare versions

Comparing version 0.0.74 to 0.0.75

61

assembly/crypto.ts

@@ -76,5 +76,5 @@ import { check } from "./system";

export class ECCPublicKey implements Packer {
data: Array<u8> | null;
constructor(data: u8[] | null = null) {
constructor(
public data: u8[] | null = null
) {
if (data) {

@@ -125,2 +125,51 @@ check(data.length == 33, "bad data size");

export class ECCUncompressedPublicKey implements Packer {
constructor(
public data: u8[] | null = null
) {
if (data) {
check(data.length == 65, "bad data size");
}
this.data = data;
}
pack(): u8[] {
return this.data!;
}
unpack(data: u8[]): usize {
let dec = new Decoder(data);
this.data = dec.unpackBytes(65);
return 65;
}
getSize(): usize {
return 65;
}
toString(): string {
return Utils.bytesToHex(this.data!);
}
@inline @operator('==')
static eq(a: ECCUncompressedPublicKey, b: ECCUncompressedPublicKey): bool {
return Utils.bytesCmp(a.data!, b.data!) == 0;
}
@inline @operator('!=')
static neq(a: ECCUncompressedPublicKey, b: ECCUncompressedPublicKey): bool {
return Utils.bytesCmp(a.data!, b.data!) != 0;
}
@inline @operator('>')
static gt(a: ECCUncompressedPublicKey, b: ECCUncompressedPublicKey): bool {
return Utils.bytesCmp(a.data!, b.data!) > 0;
}
@inline @operator('<')
static lt(a: ECCUncompressedPublicKey, b: ECCUncompressedPublicKey): bool {
return Utils.bytesCmp(a.data!, b.data!) < 0;
}
}
export enum UserPresence {

@@ -371,6 +420,6 @@ USER_PRESENCE_NONE = 0,

export function k1Recover(sig: Signature, digest: Checksum256): PublicKey | null {
export function k1Recover(sig: Signature, digest: Checksum256): ECCPublicKey | null {
let rawSig = sig.pack();
let rawDigest = digest.pack();
let rawPub = new Array<u8>(34);
let rawPub = new Array<u8>(65);
let ret = env.recover_key(rawSig.dataStart, rawDigest.dataStart, rawDigest.length, rawPub.dataStart, rawPub.length);

@@ -380,3 +429,3 @@ if (ret == -1) {

}
let pub = new PublicKey();
let pub = new ECCUncompressedPublicKey();
pub.unpack(rawPub);

@@ -383,0 +432,0 @@ return pub;

@@ -108,2 +108,3 @@ export { U128, U256, I128 } from "./bignum";

ECCPublicKey,
ECCUncompressedPublicKey,
UserPresence,

@@ -110,0 +111,0 @@ WebAuthNPublicKey,

2

package.json
{
"name": "as-chain",
"version": "0.0.74",
"version": "0.0.75",
"description": "chain module for assemblyscript",

@@ -5,0 +5,0 @@ "main": "js/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc