utils/key library

Functions

generateX25519EphemeralKeyPair() Future<(List<int>, List<int>)>
Generates a X25519 ephemeral key pair. Returns a Future that completes with a tuple containing the private key and the public key.
jwkFromSharedKey(List<int> sharedKey) Map<String, dynamic>
Converts a shared key to a JWK (JSON Web Key) representation. Returns the JWK.
makeSharedKey(List<int> privateKey, List<int> publicKey) Future<List<int>>
Makes a 32-byte shared key from the private key and the public key. Returns a Future that completes with the shared key.
privateKeyfromX25519Jwk(Map<String, dynamic> jwk) List<int>
Converts a X25519 JWK (JSON Web Key) to a X25519 private key. Returns the X25519 private key.
publicKeyfromX25519Jwk(Map<String, dynamic> jwk) List<int>
Converts a X25519 JWK (JSON Web Key) to a X25519 public key. Returns the X25519 public key.
x25519JwkFromEd25519PrivateKey(List<int> privateKey) Future<Map<String, dynamic>>
Converts an Ed25519 private key to a X25519 private key and then to a JWK (JSON Web Key) representation. Returns a Future that completes with the JWK.
x25519JwkFromEd25519PublicKey(List<int> publicKey) Map<String, dynamic>
Converts an Ed25519 public key to a X25519 public key and then to a JWK (JSON Web Key) representation. Returns the JWK.
x25519JwkFromX25519PrivateKey(List<int> privateKey) Future<Map<String, dynamic>>
Converts a X25519 private key to a JWK (JSON Web Key) representation. Returns a Future that completes with the JWK.
x25519JwkFromX25519PublicKey(List<int> publicKey) Map<String, dynamic>
Converts a X25519 public key to a JWK (JSON Web Key) representation. Returns the JWK.