@dialectlabs/blockchain-sdk-aptos
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,2 +5,6 @@ # CHANGELOG | ||
## [1.0.1] - 2022-10-11 | ||
- fix: unpadded public key hex support | ||
## [1.0.0] - 2022-10-05 | ||
@@ -7,0 +11,0 @@ |
@@ -7,2 +7,3 @@ "use strict"; | ||
const aptos_account_utils_1 = require("../../utils/aptos-account-utils"); | ||
const aptos_public_key_utils_1 = require("../../utils/aptos-public-key-utils"); | ||
const sdk_1 = require("@dialectlabs/sdk"); | ||
@@ -21,3 +22,3 @@ const aptos_1 = require("aptos"); | ||
const address = (0, aptos_account_utils_1.getAptosAccountAddress)(aptos_1.HexString.fromUint8Array(this.getPublicKey(token))).toString(); | ||
return token.body.sub === address; | ||
return BigInt(token.body.sub) === BigInt(address); | ||
} | ||
@@ -29,3 +30,4 @@ getPublicKey(token) { | ||
} | ||
return aptos_1.HexString.ensure(signerPublicKey).toUint8Array(); | ||
const hexPubKey = aptos_1.HexString.ensure(signerPublicKey); | ||
return (0, aptos_public_key_utils_1.getPublicKeyWithPadding)(hexPubKey).toUint8Array(); | ||
} | ||
@@ -32,0 +34,0 @@ } |
@@ -9,2 +9,3 @@ "use strict"; | ||
const aptos_1 = require("aptos"); | ||
const aptos_public_key_utils_1 = require("../../utils/aptos-public-key-utils"); | ||
class AptosEd25519TokenValidator extends sdk_1.TokenValidator { | ||
@@ -21,3 +22,3 @@ canValidate(tokenHeader) { | ||
const address = (0, aptos_account_utils_1.getAptosAccountAddress)(aptos_1.HexString.fromUint8Array(this.getPublicKey(token))).toString(); | ||
return token.body.sub === address; | ||
return BigInt(token.body.sub) === BigInt(address); | ||
} | ||
@@ -29,3 +30,4 @@ getPublicKey(token) { | ||
} | ||
return aptos_1.HexString.ensure(signerPublicKey).toUint8Array(); | ||
const hexPubKey = aptos_1.HexString.ensure(signerPublicKey); | ||
return (0, aptos_public_key_utils_1.getPublicKeyWithPadding)(hexPubKey).toUint8Array(); | ||
} | ||
@@ -32,0 +34,0 @@ } |
@@ -37,2 +37,4 @@ "use strict"; | ||
type: constants_1.DIALECT_BLOCKCHAIN_SDK_TYPE_APTOS, | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
info: { | ||
@@ -39,0 +41,0 @@ supportsOnChainMessaging: false, |
import { sign } from 'tweetnacl'; | ||
import { APTOS_ED25519_PAYLOAD_TOKEN_SIGNER_ALG } from './aptos-ed25519-payload-token-signer'; | ||
import { getAptosAccountAddress } from '../../utils/aptos-account-utils'; | ||
import { getPublicKeyWithPadding } from '../../utils/aptos-public-key-utils'; | ||
import { AuthenticationError, TokenValidator, } from '@dialectlabs/sdk'; | ||
@@ -17,3 +18,3 @@ import { HexString } from 'aptos'; | ||
const address = getAptosAccountAddress(HexString.fromUint8Array(this.getPublicKey(token))).toString(); | ||
return token.body.sub === address; | ||
return BigInt(token.body.sub) === BigInt(address); | ||
} | ||
@@ -25,5 +26,6 @@ getPublicKey(token) { | ||
} | ||
return HexString.ensure(signerPublicKey).toUint8Array(); | ||
const hexPubKey = HexString.ensure(signerPublicKey); | ||
return getPublicKeyWithPadding(hexPubKey).toUint8Array(); | ||
} | ||
} | ||
//# sourceMappingURL=aptos-ed25519-payload-token-validator.js.map |
@@ -6,2 +6,3 @@ import { sign } from 'tweetnacl'; | ||
import { HexString } from 'aptos'; | ||
import { getPublicKeyWithPadding } from '../../utils/aptos-public-key-utils'; | ||
export class AptosEd25519TokenValidator extends TokenValidator { | ||
@@ -18,3 +19,3 @@ canValidate(tokenHeader) { | ||
const address = getAptosAccountAddress(HexString.fromUint8Array(this.getPublicKey(token))).toString(); | ||
return token.body.sub === address; | ||
return BigInt(token.body.sub) === BigInt(address); | ||
} | ||
@@ -26,5 +27,6 @@ getPublicKey(token) { | ||
} | ||
return HexString.ensure(signerPublicKey).toUint8Array(); | ||
const hexPubKey = HexString.ensure(signerPublicKey); | ||
return getPublicKeyWithPadding(hexPubKey).toUint8Array(); | ||
} | ||
} | ||
//# sourceMappingURL=aptos-ed25519-token-validator.js.map |
@@ -34,2 +34,4 @@ import { EncryptionKeysProvider, IllegalArgumentError } from '@dialectlabs/sdk'; | ||
type: DIALECT_BLOCKCHAIN_SDK_TYPE_APTOS, | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
info: { | ||
@@ -36,0 +38,0 @@ supportsOnChainMessaging: false, |
{ | ||
"name": "@dialectlabs/blockchain-sdk-aptos", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"repository": "git@github.com:dialectlabs/sdk.git", | ||
@@ -16,3 +16,4 @@ "author": "dialectlabs", | ||
"clean": "rm -rf lib", | ||
"build": "npm run clean && npm run build:cjs; npm run build:esm", | ||
"build": "yarn clean && yarn build:cjs; yarn build:esm", | ||
"lint": "eslint \"{src,test}/**/*.ts\" --fix", | ||
"build:cjs": "tsc --project tsconfig.cjs.json", | ||
@@ -19,0 +20,0 @@ "build:cjs:watch": "concurrently \"tsc --project tsconfig.cjs.json --watch\"", |
@@ -5,2 +5,3 @@ import { sign } from 'tweetnacl'; | ||
import { getAptosAccountAddress } from '../../utils/aptos-account-utils'; | ||
import { getPublicKeyWithPadding } from '../../utils/aptos-public-key-utils'; | ||
import { | ||
@@ -33,3 +34,3 @@ AuthenticationError, | ||
).toString(); | ||
return token.body.sub === address; | ||
return BigInt(token.body.sub) === BigInt(address); | ||
} | ||
@@ -44,4 +45,5 @@ | ||
} | ||
return HexString.ensure(signerPublicKey).toUint8Array(); | ||
const hexPubKey = HexString.ensure(signerPublicKey); | ||
return getPublicKeyWithPadding(hexPubKey).toUint8Array(); | ||
} | ||
} |
@@ -12,2 +12,3 @@ import { sign } from 'tweetnacl'; | ||
import { HexString } from 'aptos'; | ||
import { getPublicKeyWithPadding } from '../../utils/aptos-public-key-utils'; | ||
@@ -33,3 +34,3 @@ export class AptosEd25519TokenValidator extends TokenValidator { | ||
).toString(); | ||
return token.body.sub === address; | ||
return BigInt(token.body.sub) === BigInt(address); | ||
} | ||
@@ -44,4 +45,5 @@ | ||
} | ||
return HexString.ensure(signerPublicKey).toUint8Array(); | ||
const hexPubKey = HexString.ensure(signerPublicKey); | ||
return getPublicKeyWithPadding(hexPubKey).toUint8Array(); | ||
} | ||
} |
@@ -64,2 +64,4 @@ import type { | ||
type: DIALECT_BLOCKCHAIN_SDK_TYPE_APTOS, | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
info: { | ||
@@ -66,0 +68,0 @@ supportsOnChainMessaging: false, |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
191455
143
2436
1