algosdk 3.7.0 → 3.9.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/ed25519-signer.js +18 -0
- package/dist/cjs/ed25519-signer.js.map +1 -1
- package/dist/cjs/encoding/address.js +9 -0
- package/dist/cjs/encoding/address.js.map +1 -1
- package/dist/cjs/falcon-signer.js +16 -0
- package/dist/cjs/falcon-signer.js.map +1 -1
- package/dist/cjs/logicsig.js +86 -6
- package/dist/cjs/logicsig.js.map +1 -1
- package/dist/cjs/main.js +4 -2
- package/dist/cjs/main.js.map +1 -1
- package/dist/cjs/mnemonic/mnemonic.js +2 -0
- package/dist/cjs/mnemonic/mnemonic.js.map +1 -1
- package/dist/cjs/pq-signer.js +25 -0
- package/dist/cjs/pq-signer.js.map +1 -1
- package/dist/cjs/signer.js.map +1 -1
- package/dist/cjs/signing.js +22 -0
- package/dist/cjs/signing.js.map +1 -1
- package/dist/cjs/types/block.js +28 -0
- package/dist/cjs/types/block.js.map +1 -1
- package/dist/esm/ed25519-signer.js +18 -0
- package/dist/esm/ed25519-signer.js.map +1 -1
- package/dist/esm/encoding/address.js +9 -0
- package/dist/esm/encoding/address.js.map +1 -1
- package/dist/esm/falcon-signer.js +16 -0
- package/dist/esm/falcon-signer.js.map +1 -1
- package/dist/esm/logicsig.js +86 -6
- package/dist/esm/logicsig.js.map +1 -1
- package/dist/esm/main.js +1 -0
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/mnemonic/mnemonic.js +2 -0
- package/dist/esm/mnemonic/mnemonic.js.map +1 -1
- package/dist/esm/pq-signer.js +25 -0
- package/dist/esm/pq-signer.js.map +1 -1
- package/dist/esm/signer.js.map +1 -1
- package/dist/esm/signing.js +22 -0
- package/dist/esm/signing.js.map +1 -1
- package/dist/esm/types/block.js +28 -0
- package/dist/esm/types/block.js.map +1 -1
- package/dist/types/ed25519-signer.d.ts +29 -0
- package/dist/types/encoding/address.d.ts +9 -0
- package/dist/types/falcon-signer.d.ts +27 -0
- package/dist/types/logicsig.d.ts +91 -6
- package/dist/types/main.d.ts +1 -0
- package/dist/types/mnemonic/mnemonic.d.ts +2 -0
- package/dist/types/pq-signer.d.ts +37 -0
- package/dist/types/signer.d.ts +68 -5
- package/dist/types/signing.d.ts +22 -0
- package/dist/types/types/block.d.ts +22 -0
- package/package.json +120 -12
- package/src/ed25519-signer.ts +29 -0
- package/src/encoding/address.ts +9 -0
- package/src/falcon-signer.ts +27 -0
- package/src/logicsig.ts +93 -6
- package/src/main.ts +1 -0
- package/src/mnemonic/mnemonic.ts +2 -0
- package/src/pq-signer.ts +37 -0
- package/src/signer.ts +68 -5
- package/src/signing.ts +22 -0
- package/src/types/block.ts +54 -0
|
@@ -1,8 +1,45 @@
|
|
|
1
1
|
import { Address } from './encoding/address.js';
|
|
2
2
|
import { AddressWithDelegatedLsigSigner, AddressWithEmptyTransactionSigner, AddressWithTransactionSigner } from './signer.js';
|
|
3
|
+
/**
|
|
4
|
+
* A post-quantum public key, its scheme identifier, and a function that signs
|
|
5
|
+
* raw bytes with the corresponding secret key.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* `pqSigner` receives the exact bytes to sign, with every domain-separation
|
|
9
|
+
* prefix already applied, so it can be backed by a key that never leaves a
|
|
10
|
+
* wallet, HSM or hardware device.
|
|
11
|
+
*/
|
|
3
12
|
export interface PQSigningKey {
|
|
13
|
+
/** The 2-byte ASCII PQ scheme identifier (e.g. "f1" for Falcon-1024). */
|
|
4
14
|
pqScheme: Uint8Array;
|
|
15
|
+
/** The scheme's canonical public key. */
|
|
5
16
|
pqPublicKey: Uint8Array;
|
|
17
|
+
/** Signs the given bytes verbatim with the corresponding secret key. */
|
|
6
18
|
pqSigner: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
|
|
7
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Build the full set of signers for a post-quantum key from a function that
|
|
22
|
+
* signs raw bytes with it.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* The account address is derived from the scheme and public key via
|
|
26
|
+
* {@link addressFromPQKey}, so it does not have to be supplied. Every signature
|
|
27
|
+
* produced carries the scheme, canonical salt and public key alongside the
|
|
28
|
+
* signature bytes, which is what lets the network recover the authorizing
|
|
29
|
+
* address from the signature alone.
|
|
30
|
+
*
|
|
31
|
+
* PQ schemes cannot participate in multisig, so `delegatedLsigSigner` throws if
|
|
32
|
+
* given an `msig` argument, and no `mxBytesSigner` or `programDataSigner` is
|
|
33
|
+
* returned — signing arbitrary bytes and program data are ed25519-only
|
|
34
|
+
* operations.
|
|
35
|
+
*
|
|
36
|
+
* @param signingKey - The scheme, public key and raw signing function to build the signers from
|
|
37
|
+
* @param sendingAddress - The address transactions are sent from. Defaults to
|
|
38
|
+
* the derived PQ address; supply it when the PQ key is the auth address of a
|
|
39
|
+
* rekeyed account, in which case the produced transactions carry the derived
|
|
40
|
+
* address in their `sgnr` field.
|
|
41
|
+
* @returns An address bundled with transaction, empty transaction and delegated
|
|
42
|
+
* LogicSig signers
|
|
43
|
+
* @throws If `pqScheme` is not exactly 2 bytes
|
|
44
|
+
*/
|
|
8
45
|
export declare function addressWithSignersFromRawPQSigner(signingKey: PQSigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner & AddressWithEmptyTransactionSigner;
|
package/dist/types/signer.d.ts
CHANGED
|
@@ -21,9 +21,24 @@ export interface Addressable {
|
|
|
21
21
|
* corresponds to the signed transaction from txnGroup[indexesToSign[i]]
|
|
22
22
|
*/
|
|
23
23
|
export type TransactionSigner = (txnGroup: Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
24
|
+
/**
|
|
25
|
+
* An address paired with a signer able to sign transactions on its behalf.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* `address` is the address transactions are sent from, which is not necessarily
|
|
29
|
+
* the address that authorizes them: for a rekeyed account the two differ, and
|
|
30
|
+
* `txnSigner` sets the transaction's `sgnr` field accordingly.
|
|
31
|
+
*/
|
|
24
32
|
export interface AddressWithTransactionSigner extends Addressable {
|
|
25
33
|
txnSigner: TransactionSigner;
|
|
26
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* An address paired with a signer that produces placeholder signatures for it.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Useful for post-quantum accounts, whose real signatures are large and slow to
|
|
40
|
+
* produce, when only a simulation of the group is needed.
|
|
41
|
+
*/
|
|
27
42
|
export interface AddressWithEmptyTransactionSigner extends Addressable {
|
|
28
43
|
/**
|
|
29
44
|
* A TransactionSigner that produces unsigned (or placeholder-signed)
|
|
@@ -32,11 +47,26 @@ export interface AddressWithEmptyTransactionSigner extends Addressable {
|
|
|
32
47
|
*/
|
|
33
48
|
emptyTxnSigner: TransactionSigner;
|
|
34
49
|
}
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
50
|
+
/**
|
|
51
|
+
* This type represents a function which can sign a LogicSig for delegation.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Exactly one of `sig`, `lmsig` and `pqsig` is returned, according to the kind
|
|
55
|
+
* of key the signer holds and whether `msig` was supplied:
|
|
56
|
+
*
|
|
57
|
+
* - `sig` - an ed25519 signature from a single delegating account
|
|
58
|
+
* - `lmsig` - a multisig containing this signer's subsignature, returned when
|
|
59
|
+
* `msig` is supplied
|
|
60
|
+
* - `pqsig` - a post-quantum signature from a single delegating account
|
|
61
|
+
*
|
|
62
|
+
* @param lsig - The logic signature that is being signed for delegation
|
|
63
|
+
* @param msig - Optional multisig account that should be set when a public key is signing as a subsigner of a multisig
|
|
64
|
+
* @returns A promise which resolves to the signature and the address that
|
|
65
|
+
* produced it. When `msig` is omitted this is the delegating account; when
|
|
66
|
+
* `msig` is supplied it is the individual subsigner rather than the multisig.
|
|
67
|
+
* Either way it is an authorizing address, which is not necessarily the
|
|
68
|
+
* address the signer sends transactions from.
|
|
69
|
+
*/
|
|
40
70
|
export type DelegatedLsigSigner = (lsig: LogicSig, msig?: MultisigMetadata) => Promise<{
|
|
41
71
|
address: Address;
|
|
42
72
|
} & ({
|
|
@@ -46,14 +76,47 @@ export type DelegatedLsigSigner = (lsig: LogicSig, msig?: MultisigMetadata) => P
|
|
|
46
76
|
} | {
|
|
47
77
|
pqsig: EncodedPQSig;
|
|
48
78
|
})>;
|
|
79
|
+
/**
|
|
80
|
+
* An address paired with a signer able to delegate a LogicSig to it.
|
|
81
|
+
*/
|
|
49
82
|
export interface AddressWithDelegatedLsigSigner extends Addressable {
|
|
50
83
|
delegatedLsigSigner: DelegatedLsigSigner;
|
|
51
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* This type represents a function which can sign arbitrary bytes, for use with
|
|
87
|
+
* {@link verifyBytes}.
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* The implementation is responsible for prepending the "MX" domain-separation
|
|
91
|
+
* prefix ({@link SIGN_BYTES_PREFIX}) before signing, so `bytesToSign` is the
|
|
92
|
+
* caller's bytes alone.
|
|
93
|
+
*
|
|
94
|
+
* @param bytesToSign - The bytes to sign, without any domain-separation prefix
|
|
95
|
+
* @returns A promise which resolves to the raw signature
|
|
96
|
+
*/
|
|
52
97
|
export type MxBytesSigner = (bytesToSign: Uint8Array) => Promise<Uint8Array>;
|
|
98
|
+
/**
|
|
99
|
+
* An address paired with a signer able to sign arbitrary bytes on its behalf.
|
|
100
|
+
*/
|
|
53
101
|
export interface AddressWithMxBytesSigner extends Addressable {
|
|
54
102
|
mxBytesSigner: MxBytesSigner;
|
|
55
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* This type represents a function which can sign data for use with the
|
|
106
|
+
* `ed25519verify` opcode from within a LogicSig's program.
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
* The implementation is responsible for prepending the "ProgData" prefix
|
|
110
|
+
* ({@link SIGN_PROGRAM_DATA_PREFIX}) and the LogicSig's address before signing.
|
|
111
|
+
*
|
|
112
|
+
* @param data - The data to sign, without any prefix
|
|
113
|
+
* @param lsig - The LogicSig whose program will verify the signature
|
|
114
|
+
* @returns A promise which resolves to the raw signature
|
|
115
|
+
*/
|
|
56
116
|
export type ProgramDataSigner = (data: Uint8Array, lsig: LogicSig) => Promise<Uint8Array>;
|
|
117
|
+
/**
|
|
118
|
+
* An address paired with a signer able to sign program data on its behalf.
|
|
119
|
+
*/
|
|
57
120
|
export interface AddressWithProgramDataSigner extends Addressable {
|
|
58
121
|
programDataSigner: ProgramDataSigner;
|
|
59
122
|
}
|
package/dist/types/signing.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import { SignedTransaction } from './signedTransaction.js';
|
|
|
3
3
|
import { Transaction } from './transaction.js';
|
|
4
4
|
import { LogicSig, LogicSigAccount } from './logicsig.js';
|
|
5
5
|
import type { TransactionSigner } from './signer.js';
|
|
6
|
+
/**
|
|
7
|
+
* The domain-separation prefix prepended to arbitrary bytes before signing them
|
|
8
|
+
* with {@link signBytes}, so that such a signature can never be mistaken for a
|
|
9
|
+
* signature over a transaction or a program.
|
|
10
|
+
*/
|
|
6
11
|
export declare const SIGN_BYTES_PREFIX: Uint8Array;
|
|
7
12
|
/**
|
|
8
13
|
* @deprecated Use signTransactionWithSigner
|
|
@@ -25,6 +30,23 @@ export declare function signTransaction(txn: Transaction, sk: Uint8Array): {
|
|
|
25
30
|
txID: string;
|
|
26
31
|
blob: Uint8Array;
|
|
27
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* signTransactionWithSigner signs a single transaction with the given signer.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* This is the replacement for the deprecated {@link signTransaction}, which can
|
|
38
|
+
* only sign with a raw ed25519 secret key. Because a `TransactionSigner` signs
|
|
39
|
+
* a group, the transaction is passed as a one-element group and the single
|
|
40
|
+
* result is returned.
|
|
41
|
+
*
|
|
42
|
+
* The decoded `stxn` is returned alongside the blob so callers can read what
|
|
43
|
+
* the signer produced — its `sig`, `pqsig` or `msig` field, and the `sgnr` field
|
|
44
|
+
* naming the key that signed when it is not the transaction sender.
|
|
45
|
+
*
|
|
46
|
+
* @param txn - the transaction to sign
|
|
47
|
+
* @param signer - the signer to sign with
|
|
48
|
+
* @returns an object with blob, txID and stxn properties
|
|
49
|
+
*/
|
|
28
50
|
export declare function signTransactionWithSigner(txn: Transaction, signer: TransactionSigner): Promise<ReturnType<typeof signTransaction> & {
|
|
29
51
|
stxn: SignedTransaction;
|
|
30
52
|
}>;
|
|
@@ -49,9 +49,14 @@ export declare class TxnCommitments implements Encodable {
|
|
|
49
49
|
* Root of transaction vector commitment merkle tree using SHA256 hash function
|
|
50
50
|
*/
|
|
51
51
|
sha256Commitment: Uint8Array;
|
|
52
|
+
/**
|
|
53
|
+
* Root of transaction vector commitment merkle tree using SHA512 hash function
|
|
54
|
+
*/
|
|
55
|
+
sha512Commitment: Uint8Array;
|
|
52
56
|
constructor(params: {
|
|
53
57
|
nativeSha512_256Commitment: Uint8Array;
|
|
54
58
|
sha256Commitment: Uint8Array;
|
|
59
|
+
sha512Commitment?: Uint8Array;
|
|
55
60
|
});
|
|
56
61
|
getEncodingSchema(): Schema;
|
|
57
62
|
toEncodingData(): Map<string, unknown>;
|
|
@@ -196,6 +201,10 @@ export declare class BlockHeader implements Encodable {
|
|
|
196
201
|
* Previous block hash
|
|
197
202
|
*/
|
|
198
203
|
branch: Uint8Array;
|
|
204
|
+
/**
|
|
205
|
+
* Previous block hash, using SHA-512
|
|
206
|
+
*/
|
|
207
|
+
branch512: Uint8Array;
|
|
199
208
|
/**
|
|
200
209
|
* Sortition seed
|
|
201
210
|
*/
|
|
@@ -249,9 +258,20 @@ export declare class BlockHeader implements Encodable {
|
|
|
249
258
|
*/
|
|
250
259
|
stateproofTracking: Map<number, StateProofTrackingData>;
|
|
251
260
|
participationUpdates: ParticipationUpdates;
|
|
261
|
+
/**
|
|
262
|
+
* Load is the degree to which a block is full. Currently, it is based on the number of bytes in
|
|
263
|
+
* the final block, compared to the maximum allowed. It is expressed as a fixed-point integer with
|
|
264
|
+
* 6 digits of precision. So, 1,000,000 is a completely full block.
|
|
265
|
+
*/
|
|
266
|
+
load: bigint;
|
|
267
|
+
/**
|
|
268
|
+
* CongestionTax is the fee required, beyond the MinFee, for "normal" transactions in this block.
|
|
269
|
+
*/
|
|
270
|
+
congestionTax: bigint;
|
|
252
271
|
constructor(params: {
|
|
253
272
|
round: bigint;
|
|
254
273
|
branch: Uint8Array;
|
|
274
|
+
branch512?: Uint8Array;
|
|
255
275
|
seed: Uint8Array;
|
|
256
276
|
txnCommitments: TxnCommitments;
|
|
257
277
|
timestamp: bigint;
|
|
@@ -267,6 +287,8 @@ export declare class BlockHeader implements Encodable {
|
|
|
267
287
|
txnCounter: bigint;
|
|
268
288
|
stateproofTracking: Map<number, StateProofTrackingData>;
|
|
269
289
|
participationUpdates: ParticipationUpdates;
|
|
290
|
+
load?: bigint;
|
|
291
|
+
congestionTax?: bigint;
|
|
270
292
|
});
|
|
271
293
|
getEncodingSchema(): Schema;
|
|
272
294
|
toEncodingData(): Map<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "algosdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0-beta.1",
|
|
4
4
|
"description": "The official JavaScript SDK for Algorand",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -45,7 +45,10 @@
|
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
|
48
|
-
"url": "git://github.com/algorand/js-algorand-sdk.git"
|
|
48
|
+
"url": "git+https://github.com/algorand/js-algorand-sdk.git"
|
|
49
|
+
},
|
|
50
|
+
"overrides": {
|
|
51
|
+
"basic-ftp": ">=6.2.1"
|
|
49
52
|
},
|
|
50
53
|
"dependencies": {
|
|
51
54
|
"algorand-msgpack": "^1.1.0",
|
|
@@ -58,31 +61,38 @@
|
|
|
58
61
|
"vlq": "^2.0.4"
|
|
59
62
|
},
|
|
60
63
|
"devDependencies": {
|
|
64
|
+
"@algorandfoundation/falcon-wasm": "1.0.0",
|
|
65
|
+
"@commitlint/cli": "^19.8.1",
|
|
66
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
67
|
+
"@semantic-release/exec": "^7.1.0",
|
|
68
|
+
"@semantic-release/git": "^10.0.1",
|
|
61
69
|
"@types/json-bigint": "^1.0.0",
|
|
62
|
-
"@types/mocha": "^
|
|
70
|
+
"@types/mocha": "^10.0.10",
|
|
63
71
|
"@types/node": "^20.11.5",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
65
|
-
"@typescript-eslint/parser": "^
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^8.70.1",
|
|
73
|
+
"@typescript-eslint/parser": "^8.70.1",
|
|
66
74
|
"assert": "^2.0.0",
|
|
67
|
-
"
|
|
75
|
+
"better-npm-audit": "^3.11.0",
|
|
76
|
+
"chromedriver": "^154.0.0",
|
|
68
77
|
"concurrently": "^6.2.0",
|
|
78
|
+
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
69
79
|
"cucumber": "^5.1.0",
|
|
70
80
|
"es-abstract": "^1.18.3",
|
|
71
|
-
"eslint": "8.
|
|
81
|
+
"eslint": "^8.57.1",
|
|
72
82
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
73
83
|
"eslint-config-prettier": "^9.1.0",
|
|
74
84
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
75
85
|
"eslint-plugin-import": "^2.25.2",
|
|
76
|
-
"eslint-plugin-tsdoc": "^0.
|
|
77
|
-
"express": "^4.
|
|
78
|
-
"@algorandfoundation/falcon-wasm": "1.0.0",
|
|
86
|
+
"eslint-plugin-tsdoc": "^0.5.3",
|
|
87
|
+
"express": "^4.22.3",
|
|
79
88
|
"geckodriver": "^4.3.0",
|
|
80
89
|
"husky": "^4.3.8",
|
|
81
90
|
"lint-staged": "^10.5.4",
|
|
82
|
-
"mocha": "^
|
|
91
|
+
"mocha": "^12.0.2",
|
|
83
92
|
"mock-http-server": "^1.4.3",
|
|
84
93
|
"prettier": "^3.2.1",
|
|
85
94
|
"selenium-webdriver": "^4.10.0",
|
|
95
|
+
"semantic-release": "^25.0.9",
|
|
86
96
|
"source-map-loader": "^2.0.2",
|
|
87
97
|
"ts-loader": "^9.3.1",
|
|
88
98
|
"tsx": "^4.7.0",
|
|
@@ -103,11 +113,109 @@
|
|
|
103
113
|
"lint": "eslint .",
|
|
104
114
|
"lint:fix": "eslint --fix .",
|
|
105
115
|
"format": "prettier --write .",
|
|
116
|
+
"format:check": "prettier --check .",
|
|
117
|
+
"check-types": "tsc --noEmit",
|
|
118
|
+
"audit": "better-npm-audit audit",
|
|
119
|
+
"commit-lint": "commitlint --edit -o",
|
|
120
|
+
"semantic-release": "semantic-release",
|
|
106
121
|
"example": "ts-node"
|
|
107
122
|
},
|
|
123
|
+
"release": {
|
|
124
|
+
"branches": [
|
|
125
|
+
{
|
|
126
|
+
"name": "main",
|
|
127
|
+
"prerelease": "beta",
|
|
128
|
+
"channel": "beta"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "release"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"plugins": [
|
|
135
|
+
[
|
|
136
|
+
"@semantic-release/commit-analyzer",
|
|
137
|
+
{
|
|
138
|
+
"preset": "conventionalcommits",
|
|
139
|
+
"releaseRules": [
|
|
140
|
+
{
|
|
141
|
+
"type": "build",
|
|
142
|
+
"release": "patch"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"type": "chore",
|
|
146
|
+
"release": "patch"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"type": "refactor",
|
|
150
|
+
"release": "patch"
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
[
|
|
156
|
+
"@semantic-release/release-notes-generator",
|
|
157
|
+
{
|
|
158
|
+
"preset": "conventionalcommits",
|
|
159
|
+
"presetConfig": {
|
|
160
|
+
"types": [
|
|
161
|
+
{
|
|
162
|
+
"type": "feat",
|
|
163
|
+
"scope": "nye",
|
|
164
|
+
"section": "Not Yet Enabled"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"type": "feat",
|
|
168
|
+
"section": "Features"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"type": "fix",
|
|
172
|
+
"section": "Bug Fixes"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"type": "build",
|
|
176
|
+
"section": "Dependencies and Other Build Updates",
|
|
177
|
+
"hidden": false
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"type": "refactor",
|
|
181
|
+
"section": "Code Refactoring"
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"@semantic-release/npm",
|
|
188
|
+
[
|
|
189
|
+
"@semantic-release/exec",
|
|
190
|
+
{
|
|
191
|
+
"prepareCmd": "node scripts/ci/update-readme-sri.js ${nextRelease.version}"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
[
|
|
195
|
+
"@semantic-release/git",
|
|
196
|
+
{
|
|
197
|
+
"assets": [
|
|
198
|
+
"README.md"
|
|
199
|
+
],
|
|
200
|
+
"message": "chore(release): update README to v${nextRelease.version} [skip ci]"
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
"@semantic-release/github",
|
|
205
|
+
{
|
|
206
|
+
"assets": [
|
|
207
|
+
{
|
|
208
|
+
"path": "dist/browser/algosdk.min.js",
|
|
209
|
+
"label": "Minified browser bundle (algosdk.min.js)"
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
]
|
|
215
|
+
},
|
|
108
216
|
"author": "Algorand, llc",
|
|
109
217
|
"license": "MIT",
|
|
110
218
|
"engines": {
|
|
111
|
-
"node": ">=
|
|
219
|
+
"node": ">=22.0"
|
|
112
220
|
}
|
|
113
221
|
}
|
package/src/ed25519-signer.ts
CHANGED
|
@@ -25,11 +25,40 @@ import {
|
|
|
25
25
|
} from './types/transactions/encoded.js';
|
|
26
26
|
import { arrayEqual, concatArrays } from './utils/utils.js';
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* An ed25519 public key paired with a function that signs raw bytes with the
|
|
30
|
+
* corresponding secret key.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* `ed25519Signer` receives the exact bytes to sign, with every
|
|
34
|
+
* domain-separation prefix already applied, so it can be backed by a key that
|
|
35
|
+
* never leaves a wallet, HSM or hardware device.
|
|
36
|
+
*/
|
|
28
37
|
export interface Ed25519SigningKey {
|
|
38
|
+
/** The 32-byte ed25519 public key. */
|
|
29
39
|
ed25519PublicKey: Uint8Array;
|
|
40
|
+
/** Signs the given bytes verbatim with the corresponding secret key. */
|
|
30
41
|
ed25519Signer: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
|
|
31
42
|
}
|
|
32
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Build the full set of signers for an ed25519 key from a function that signs
|
|
46
|
+
* raw bytes with it.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* Each returned signer applies the domain separation its use requires
|
|
50
|
+
* ("Program", "MsigProgram", "ProgData", or the transaction prefix) before
|
|
51
|
+
* calling `ed25519Signer`, so a caller only has to supply the raw signing
|
|
52
|
+
* operation once.
|
|
53
|
+
*
|
|
54
|
+
* @param ed25519SigningKey - The public key and raw signing function to build the signers from
|
|
55
|
+
* @param sendingAddress - The address transactions are sent from. Defaults to
|
|
56
|
+
* the address of `ed25519PublicKey`; supply it when that key is the auth
|
|
57
|
+
* address of a rekeyed account, in which case the produced transactions carry
|
|
58
|
+
* the key's address in their `sgnr` field.
|
|
59
|
+
* @returns An address bundled with transaction, delegated LogicSig, arbitrary
|
|
60
|
+
* bytes and program data signers
|
|
61
|
+
*/
|
|
33
62
|
export function addressWithSignersFromRawEd25519Signer(
|
|
34
63
|
ed25519SigningKey: Ed25519SigningKey,
|
|
35
64
|
sendingAddress: Address = new Address(ed25519SigningKey.ed25519PublicKey)
|
package/src/encoding/address.ts
CHANGED
|
@@ -204,9 +204,16 @@ export function getApplicationAddress(appID: number | bigint): Address {
|
|
|
204
204
|
* Derive a post-quantum (PQ) account address together with the canonical salt
|
|
205
205
|
* used to derive it.
|
|
206
206
|
*
|
|
207
|
+
* @remarks
|
|
208
|
+
* The salt is found by rejection sampling: it is the lowest value whose
|
|
209
|
+
* preimage hashes to something that could not also be an Ed25519 public key, so
|
|
210
|
+
* that a PQ account can never collide with an Ed25519 one.
|
|
211
|
+
*
|
|
207
212
|
* @param schemeBytes - The 2-byte ASCII PQ scheme identifier (e.g. "f1" for Falcon-1024).
|
|
208
213
|
* @param key - The scheme's canonical public key.
|
|
209
214
|
* @returns The derived Address and the canonical 1-byte salt.
|
|
215
|
+
* @throws If `schemeBytes` is not exactly {@link PQ_SCHEME_SIZE} bytes, or in
|
|
216
|
+
* the ~2^-256 case where no salt in range yields a valid address.
|
|
210
217
|
*/
|
|
211
218
|
export function addressFromPQKey(
|
|
212
219
|
schemeBytes: Uint8Array,
|
|
@@ -248,6 +255,8 @@ export function addressFromPQKey(
|
|
|
248
255
|
*
|
|
249
256
|
* @param pqsig - The post-quantum signature to derive the address from.
|
|
250
257
|
* @returns The address of the account the signature authorizes.
|
|
258
|
+
* @throws If the signature's scheme is malformed, or if its salt is not the
|
|
259
|
+
* canonical one for its scheme and public key.
|
|
251
260
|
*/
|
|
252
261
|
export function addressFromPQSig(pqsig: EncodedPQSig): Address {
|
|
253
262
|
const { address, salt } = addressFromPQKey(pqsig.sch, pqsig.pk);
|
package/src/falcon-signer.ts
CHANGED
|
@@ -11,11 +11,38 @@ import { addressWithSignersFromRawPQSigner } from './pq-signer.js';
|
|
|
11
11
|
*/
|
|
12
12
|
export const FALCON_1024_SCHEME = new TextEncoder().encode('f1');
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* A Falcon-1024 public key paired with a function that signs raw bytes with the
|
|
16
|
+
* corresponding secret key.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* `falcon1024Signer` receives the exact bytes to sign, with every
|
|
20
|
+
* domain-separation prefix already applied, so it can be backed by a key that
|
|
21
|
+
* never leaves a wallet, HSM or hardware device.
|
|
22
|
+
*/
|
|
14
23
|
export interface Falcon1024SigningKey {
|
|
24
|
+
/** The Falcon-1024 public key. */
|
|
15
25
|
falcon1024PublicKey: Uint8Array;
|
|
26
|
+
/** Signs the given bytes verbatim with the corresponding secret key. */
|
|
16
27
|
falcon1024Signer: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
|
|
17
28
|
}
|
|
18
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Build the full set of signers for a Falcon-1024 key from a function that
|
|
32
|
+
* signs raw bytes with it.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* A thin wrapper around {@link addressWithSignersFromRawPQSigner} that supplies
|
|
36
|
+
* the {@link FALCON_1024_SCHEME} identifier, so see that function for the
|
|
37
|
+
* details and limitations of post-quantum signing.
|
|
38
|
+
*
|
|
39
|
+
* @param falconSigningKey - The public key and raw signing function to build the signers from
|
|
40
|
+
* @param sendingAddress - The address transactions are sent from. Defaults to
|
|
41
|
+
* the derived Falcon-1024 address; supply it when this key is the auth
|
|
42
|
+
* address of a rekeyed account.
|
|
43
|
+
* @returns An address bundled with transaction, empty transaction and delegated
|
|
44
|
+
* LogicSig signers
|
|
45
|
+
*/
|
|
19
46
|
export function addressWithSignersFromRawFalcon1024Signer(
|
|
20
47
|
falconSigningKey: Falcon1024SigningKey,
|
|
21
48
|
sendingAddress?: Address
|