Smart Contract
Signature
A.86185fba578bc773.Signature
1import Crypto
2
3access(all) contract Signature {
4 access(account) fun verify(signature: [UInt8], signedData: [UInt8], account: &Account, keyIndex: Int): Bool {
5 let key = account.keys.get(keyIndex: keyIndex) ?? panic("Keys that cannot be referenced cannot be used")
6 assert(!key.isRevoked, message: "Revoked keys cannot be used")
7
8 let keyList = Crypto.KeyList()
9 keyList.add(
10 key.publicKey,
11 hashAlgorithm: key.hashAlgorithm,
12 weight: key.weight
13 )
14
15 let signatureSet: [Crypto.KeyListSignature] = [
16 Crypto.KeyListSignature(
17 keyIndex: 0,
18 signature: signature
19 )
20 ]
21
22 return keyList.verify(
23 signatureSet: signatureSet,
24 signedData: signedData,
25 domainSeparationTag: "FLOW-V0.0-user"
26 )
27 }
28}
29