|
| 1 | +/* |
| 2 | + * |
| 3 | + * Hedera Swift SDK |
| 4 | + * |
| 5 | + * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC |
| 6 | + * |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | + * you may not use this file except in compliance with the License. |
| 9 | + * You may obtain a copy of the License at |
| 10 | + * |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + * |
| 13 | + * Unless required by applicable law or agreed to in writing, software |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | + * See the License for the specific language governing permissions and |
| 17 | + * limitations under the License. |
| 18 | + * |
| 19 | + */ |
| 20 | + |
| 21 | +import Foundation |
| 22 | +import Hedera |
| 23 | + |
| 24 | +@main |
| 25 | +public enum Program { |
| 26 | + public static func main() async throws { |
| 27 | + do { |
| 28 | + let mnemonic = Mnemonic.generate24() |
| 29 | + let privateKey = try mnemonic.toPrivateKey() |
| 30 | + let publicKey = privateKey.getPublicKey() |
| 31 | + |
| 32 | + print("24 word mnemonic: \(mnemonic)") |
| 33 | + print("private key = \(privateKey)") |
| 34 | + print("public key = \(publicKey)") |
| 35 | + } |
| 36 | + |
| 37 | + do { |
| 38 | + let mnemonic = Mnemonic.generate12() |
| 39 | + let privateKey = try mnemonic.toPrivateKey() |
| 40 | + let publicKey = privateKey.getPublicKey() |
| 41 | + |
| 42 | + print("12 word mnemonic: \(mnemonic)") |
| 43 | + print("private key = \(privateKey)") |
| 44 | + print("public key = \(publicKey)") |
| 45 | + } |
| 46 | + } |
| 47 | +} |
0 commit comments