@xyo-network/account
Advanced tools
Comparing version 3.6.3 to 3.6.4
@@ -24,3 +24,3 @@ import { Address, Hash } from '@xylabs/hex'; | ||
static create(opts?: AccountConfig): Promise<AccountInstance>; | ||
static fromPrivateKey(key: ArrayBufferLike | string): Promise<AccountInstance>; | ||
static fromPrivateKey(key: ArrayBufferLike | bigint | string): Promise<AccountInstance>; | ||
static isAddress(address: Address): boolean; | ||
@@ -27,0 +27,0 @@ static random(): Promise<AccountInstance>; |
@@ -9,3 +9,3 @@ import type { PrivateKeyInstance, PublicKeyInstance } from '@xyo-network/key-model'; | ||
get public(): PublicKeyInstance; | ||
static create(value: ArrayBufferLike): Promise<PrivateKey>; | ||
static create(value: ArrayBufferLike | bigint): Promise<PrivateKey>; | ||
static isPrivateKey(value: unknown): boolean; | ||
@@ -12,0 +12,0 @@ sign(hash: ArrayBufferLike): Promise<ArrayBufferLike>; |
@@ -10,3 +10,3 @@ import type { AddressValueInstance, PublicKeyInstance } from '@xyo-network/key-model'; | ||
static create(bytes: ArrayBufferLike): Promise<PublicKey>; | ||
static fromPrivate(bytes: ArrayBufferLike): Promise<PublicKeyInstance>; | ||
static fromPrivate(bytes: ArrayBufferLike | bigint): Promise<PublicKeyInstance>; | ||
static isPublicKey(value: unknown): boolean; | ||
@@ -13,0 +13,0 @@ verify(msg: ArrayBuffer, signature: ArrayBuffer): Promise<boolean>; |
{ | ||
"name": "@xyo-network/account", | ||
"version": "3.6.3", | ||
"version": "3.6.4", | ||
"description": "Primary SDK for using XYO Protocol 2.0", | ||
@@ -34,14 +34,14 @@ "homepage": "https://xyo.network", | ||
"@scure/bip39": "^1.5.0", | ||
"@xylabs/arraybuffer": "^4.4.26", | ||
"@xylabs/assert": "^4.4.26", | ||
"@xylabs/hex": "^4.4.26", | ||
"@xylabs/object": "^4.4.26", | ||
"@xylabs/static-implements": "^4.4.26", | ||
"@xyo-network/account-model": "^3.6.3", | ||
"@xyo-network/data": "^3.6.3", | ||
"@xyo-network/key-model": "^3.6.3", | ||
"@xyo-network/previous-hash-store": "^3.6.3", | ||
"@xyo-network/previous-hash-store-model": "^3.6.3", | ||
"@xyo-network/wallet-model": "^3.6.3", | ||
"@xyo-network/wasm": "^3.6.3", | ||
"@xylabs/arraybuffer": "^4.4.27", | ||
"@xylabs/assert": "^4.4.27", | ||
"@xylabs/hex": "^4.4.27", | ||
"@xylabs/object": "^4.4.27", | ||
"@xylabs/static-implements": "^4.4.27", | ||
"@xyo-network/account-model": "^3.6.4", | ||
"@xyo-network/data": "^3.6.4", | ||
"@xyo-network/key-model": "^3.6.4", | ||
"@xyo-network/previous-hash-store": "^3.6.4", | ||
"@xyo-network/previous-hash-store-model": "^3.6.4", | ||
"@xyo-network/wallet-model": "^3.6.4", | ||
"@xyo-network/wasm": "^3.6.4", | ||
"async-mutex": "^0.5.0", | ||
@@ -53,4 +53,4 @@ "ethers": "6.13.4" | ||
"@xylabs/tsconfig": "^4.2.6", | ||
"@xylabs/vitest-extended": "^4.4.26", | ||
"@xylabs/vitest-matchers": "^4.4.26", | ||
"@xylabs/vitest-extended": "^4.4.27", | ||
"@xylabs/vitest-matchers": "^4.4.27", | ||
"typescript": "^5.7.2", | ||
@@ -57,0 +57,0 @@ "vitest": "^2.1.8" |
@@ -104,4 +104,4 @@ import { toArrayBuffer, toUint8Array } from '@xylabs/arraybuffer' | ||
static async fromPrivateKey(key: ArrayBufferLike | string): Promise<AccountInstance> { | ||
const privateKey = typeof key === 'string' ? toUint8Array(key.padStart(64, '0')).buffer : key | ||
static async fromPrivateKey(key: ArrayBufferLike | bigint | string): Promise<AccountInstance> { | ||
const privateKey = toUint8Array(key, 32)?.buffer | ||
return await Account.create({ privateKey }) | ||
@@ -108,0 +108,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { toArrayBuffer } from '@xylabs/arraybuffer' | ||
import { assertEx } from '@xylabs/assert' | ||
@@ -27,4 +28,4 @@ import { staticImplements } from '@xylabs/static-implements' | ||
static async create(value: ArrayBufferLike) { | ||
return new PrivateKey(this.privateConstructorKey, value, await PublicKey.fromPrivate(value)) | ||
static async create(value: ArrayBufferLike | bigint) { | ||
return new PrivateKey(this.privateConstructorKey, toArrayBuffer(value), await PublicKey.fromPrivate(value)) | ||
} | ||
@@ -31,0 +32,0 @@ |
@@ -0,1 +1,2 @@ | ||
import { toArrayBuffer } from '@xylabs/arraybuffer' | ||
import { assertEx } from '@xylabs/assert' | ||
@@ -33,4 +34,4 @@ import { staticImplements } from '@xylabs/static-implements' | ||
static async fromPrivate(bytes: ArrayBufferLike): Promise<PublicKeyInstance> { | ||
const publicKey = await Elliptic.publicKeyFromPrivateKey(bytes) | ||
static async fromPrivate(bytes: ArrayBufferLike | bigint): Promise<PublicKeyInstance> { | ||
const publicKey = await Elliptic.publicKeyFromPrivateKey(toArrayBuffer(bytes)) | ||
return new PublicKey(this.privateConstructorKey, publicKey) | ||
@@ -37,0 +38,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
97825
1151
Updated@xylabs/arraybuffer@^4.4.27
Updated@xylabs/assert@^4.4.27
Updated@xylabs/hex@^4.4.27
Updated@xylabs/object@^4.4.27
Updated@xyo-network/data@^3.6.4
Updated@xyo-network/wasm@^3.6.4