@solana/webcrypto-ed25519-polyfill 2.0.0-experimental.ee9f3d8 → 2.0.0-experimental.ef09aec

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018 Solana Labs, Inc
1
+ Copyright (c) 2023 Solana Labs, Inc
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -32,4 +32,12 @@ import '@solana/webcrypto-ed25519-polyfill';
32
32
 
33
33
  // Now you can do this, in environments that do not otherwise support Ed25519.
34
34
  const keyPair = await crypto.subtle.generateKey('Ed25519', false, ['sign']);
35
+ const publicKeyBytes = await crypto.subtle.exportKey('raw', keyPair.publicKey);
36
+ const data = new Uint8Array([1, 2, 3]);
37
+ const signature = await crypto.subtle.sign('Ed25519', keyPair.privateKey, data);
38
+ if (await crypto.subtle.verify('Ed25519', keyPair.publicKey, signature, data)) {
39
+ console.log('Data was signed using the private key associated with this public key');
40
+ } else {
41
+ throw new Error('Signature verification error');
42
+ }
35
43
  ```