8000 Make base64 encoding target independent in `KeyIdMemStore` in wasm bindings by wulfraem · Pull Request #1386 · iotaledger/identity · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make base64 encoding target independent in KeyIdMemStore in wasm bindings #1386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bindings/wasm/lib/key_id_storage.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { encode as base64Encode } from "base64-arraybuffer";
import type { KeyIdStorage, MethodDigest } from "~identity_wasm";

export class KeyIdMemStore implements KeyIdStorage {
Expand Down Expand Up @@ -48,6 +49,5 @@ export class KeyIdMemStore implements KeyIdStorage {
*/
function methodDigestToString(methodDigest: MethodDigest): string {
let arrayBuffer = methodDigest.pack().buffer;
let buffer = Buffer.from(arrayBuffer);
return buffer.toString("base64");
return base64Encode(arrayBuffer);
}
14 changes: 14 additions & 0 deletions bindings/wasm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bindings/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"dependencies": {
"@noble/ed25519": "^1.7.3",
"@types/node-fetch": "^2.6.2",
"base64-arraybuffer": "^1.0.2",
"node-fetch": "^2.6.7"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl KeyIdStorageErrorKind {
Self::KeyIdNotFound => "key id not found in storage",
Self::Unavailable => "key id storage unavailable",
Self::Unauthenticated => "authentication with the key id storage failed",
Self::Unspecified => "key storage operation failed",
Self::Unspecified => "key id storage operation failed",
Self::RetryableIOFailure => "key id storage was unsuccessful because of an I/O failure",
Self::SerializationError => "(de)serialization error",
}
Expand Down
2 changes: 1 addition & 1 deletion identity_storage/src/storage/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum JwkStorageDocumentError {
#[error("storage operation failed: key storage error")]
KeyStorageError(KeyStorageError),
/// Caused by a failure in the key id storage.
#[error("storage operation failed: key id storage error")]
#[error("storage operation failed: key id storage error: {0}")]
KeyIdStorageError(KeyIdStorageError),
/// Caused by an attempt to add a method with a fragment that already exists.
#[error("could not add method: the fragment already exists")]
Expand Down
Loading
0