user-1: When developing (I'm using Apple Swift), what steps are needed in order to independently create my own pair of private-public keys (with the ability to restore a private key from a mnemonic phrase)?
There's no need to describe each step in detail, I would like to understand just the general idea.

user76567: I’ll omit some details to keep the answer compact but the general idea is this:
An elliptic curve point is a two dimensional point (x, y) where the x and y coordinates follow the curve equation y^2 = x^3 + 7
A private key is just an integer in the range 1.. 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
A public key is an EC point (two coordinates)
G is a special point with coordinates (0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798, 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8)
Steps to create private/public keys

Implement Elliptic curve point addition (addition of two points)
Implement Elliptic curve point multiplication (multiplication between an EC point and an integer)
Generate a random integer in the range above, that’s your private key
Multiply your private key with the point G using step 2, that’s your public key

For generating keys from mnemonics there are two BIPs that describe the process.

BIP-39 describes how to turn a mnemonic phrase into a 512-bit seed
BIP-32 describes how to turn your seed and a derivation path into an EC key


user125452: This is written in swift, it's open source and you can check out the source code to get an idea of what's happening:
https://github.com/BlockchainCommons/GordianSeedTool-iOS
But as I'm coming to understand it myself, I'll attempt to summarize. You need to have a seed (a random number as a starting point) of sufficient entropy, or randomness, that's 2^256 bits long or 10^77, so pretty hard to repeat. Not every random number generator is actually random, for example some kinds of random are repeatable and are great for applications where you need to replicate results. But in this case you want to make it difficult to replicate. Every OS would have it's own set of random number generator syscalls that may or may not be random enough to be cryptographically secure, so you'd have to check the docs on whatever you use to ensure it's secure enough.
https://en.wikipedia.org/wiki/Cryptographically-secure_pseudorandom_number_generator
Generating mnemonic phrases is a little trickier. BIP-39 is the standard for implementing mnemonics in Bitcoin. This methods inserts bits of randomness, and then pulls some of the numbers out and selects the number pulled from an index of a vocabulary wordlist, hence generating the mnemonic phrase. It seems as if this is not quite as secure as a completely random key generated from sufficient entropy, as the possibilities is reduced from 2^256 to 2^132. Still pretty difficult to repeat though. See the following to understand how difficult this is to crack:
https://github.com/BlockchainCommons/SmartCustodyBook/blob/master/manuscript/00-randomness.md
So to generate a private key that can be restored via mnemonic phrase, it must be BIP-39 compatible.
https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
Rather than trying to recreate all this functionality from scratch, which I wouldn't be able to explain succinctly, you could take advantage of libwally, or utilize the BC libraries or peruse them for your own learning/replication.
https://github.com/Sjors/libwally-swift
https://github.com/BlockchainCommons/seedtool-cli
https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/266d7e13a3ba1ce40d29c83a5d63a8d805c06621/src/16_2_genmnemonic.c
https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/45ccb82661b2f4086b9b3bcb062f0c738023aa4b/18_6_Accessing_Bitcoind_with_Swift.md

-1: <p>When developing (I'm using Apple Swift), what steps are needed in order to independently create my own pair of private-public keys (with the ability to restore a private key from a mnemonic phrase)?</p>
<p>There's no need to describe each step in detail, I would like to understand just the general idea.</p>
 76567: <p>I’ll omit some details to keep the answer compact but the general idea is this:</p>
<p>An elliptic curve point is a two dimensional point (x, y) where the x and y coordinates follow the curve equation y^2 = x^3 + 7</p>
<p>A private key is just an integer in the range <code>1</code>.. <code>0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141</code></p>
<p>A public key is an EC point (two coordinates)</p>
<p>G is a special point with coordinates (<code>0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798</code>, <code>0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8</code>)</p>
<p>Steps to create private/public keys</p>
<ol>
<li>Implement <a href="https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication#Point_addition" rel="nofollow noreferrer">Elliptic curve point addition</a> (addition of two points)</li>
<li>Implement <a href="https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication#Point_multiplication" rel="nofollow noreferrer">Elliptic curve point multiplication</a> (multiplication between an EC point and an integer)</li>
<li>Generate a random integer in the range above, that’s your private key</li>
<li>Multiply your private key with the point G using step 2, that’s your public key</li>
</ol>
<p>For generating keys from mnemonics there are two BIPs that describe the process.</p>
<ul>
<li><a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki" rel="nofollow noreferrer">BIP-39</a> describes how to turn a mnemonic phrase into a 512-bit seed</li>
<li><a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" rel="nofollow noreferrer">BIP-32</a> describes how to turn your seed and a derivation path into an EC key</li>
</ul>
 125452: <p>This is written in swift, it's open source and you can check out the source code to get an idea of what's happening:</p>
<p><a href="https://github.com/BlockchainCommons/GordianSeedTool-iOS" rel="nofollow noreferrer">https://github.com/BlockchainCommons/GordianSeedTool-iOS</a></p>
<p>But as I'm coming to understand it myself, I'll attempt to summarize. You need to have a seed (a random number as a starting point) of sufficient entropy, or randomness, that's 2^256 bits long or 10^77, so pretty hard to repeat. Not every random number generator is actually random, for example some kinds of random are repeatable and are great for applications where you need to replicate results. But in this case you want to make it difficult to replicate. Every OS would have it's own set of random number generator syscalls that may or may not be random enough to be cryptographically secure, so you'd have to check the docs on whatever you use to ensure it's secure enough.</p>
<p><a href="https://en.wikipedia.org/wiki/Cryptographically-secure_pseudorandom_number_generator" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Cryptographically-secure_pseudorandom_number_generator</a></p>
<p>Generating mnemonic phrases is a little trickier. BIP-39 is the standard for implementing mnemonics in Bitcoin. This methods inserts bits of randomness, and then pulls some of the numbers out and selects the number pulled from an index of a vocabulary wordlist, hence generating the mnemonic phrase. It seems as if this is not quite as secure as a completely random key generated from sufficient entropy, as the possibilities is reduced from 2^256 to 2^132. Still pretty difficult to repeat though. See the following to understand how difficult this is to crack:</p>
<p><a href="https://github.com/BlockchainCommons/SmartCustodyBook/blob/master/manuscript/00-randomness.md" rel="nofollow noreferrer">https://github.com/BlockchainCommons/SmartCustodyBook/blob/master/manuscript/00-randomness.md</a></p>
<p>So to generate a private key that can be restored via mnemonic phrase, it must be BIP-39 compatible.
<a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki" rel="nofollow noreferrer">https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki</a></p>
<p>Rather than trying to recreate all this functionality from scratch, which I wouldn't be able to explain succinctly, you could take advantage of libwally, or utilize the BC libraries or peruse them for your own learning/replication.</p>
<p><a href="https://github.com/Sjors/libwally-swift" rel="nofollow noreferrer">https://github.com/Sjors/libwally-swift</a></p>
<p><a href="https://github.com/BlockchainCommons/seedtool-cli" rel="nofollow noreferrer">https://github.com/BlockchainCommons/seedtool-cli</a></p>
<p><a href="https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/266d7e13a3ba1ce40d29c83a5d63a8d805c06621/src/16_2_genmnemonic.c" rel="nofollow noreferrer">https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/266d7e13a3ba1ce40d29c83a5d63a8d805c06621/src/16_2_genmnemonic.c</a></p>
<p><a href="https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/45ccb82661b2f4086b9b3bcb062f0c738023aa4b/18_6_Accessing_Bitcoind_with_Swift.md" rel="nofollow noreferrer">https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/45ccb82661b2f4086b9b3bcb062f0c738023aa4b/18_6_Accessing_Bitcoind_with_Swift.md</a></p>
