Skip to content

Commit 89f891b

Browse files
authored
Update slide js library to fix toBase64 chunking [sc-17164] (#330)
1 parent 3144333 commit 89f891b

File tree

4 files changed

+135
-111
lines changed

4 files changed

+135
-111
lines changed

examples/react-dapp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@uiw/codemirror-extensions-langs": "^4.23.7",
2323
"@uiw/codemirror-theme-basic": "^4.23.7",
2424
"@uiw/react-codemirror": "^4.23.7",
25-
"@slide-computer/signer": "3.11.0",
25+
"@slide-computer/signer": "3.12.0",
2626
"clsx": "^2.1.1",
2727
"ictool": "^1.1.1",
2828
"react-toastify": "^11.0.3",

examples/react-signer/src/service/method/interactive/icrc34-delegation-method.service.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { targetService } from "../../target.service"
77
import { GenericError } from "../../exception-handler.service"
88
import { derivationOriginService } from "../../derivation-origin.service"
99

10+
const ENCODE_CHUNK_SIZE = 100000
11+
1012
export interface DelegationComponentData extends ComponentData {
1113
accounts: Account[]
1214
isPublicAccountsAllowed: boolean
@@ -163,7 +165,17 @@ class Icrc34DelegationMethodService extends InteractiveMethodService {
163165
return globalThis.Buffer.from(bytes).toString("base64")
164166
}
165167
if (typeof globalThis.btoa !== "undefined") {
166-
return btoa(String.fromCharCode(...new Uint8Array(bytes)))
168+
return btoa(
169+
Array.from({ length: Math.ceil(bytes.byteLength / ENCODE_CHUNK_SIZE) })
170+
.map((_, index) =>
171+
String.fromCharCode(
172+
...new Uint8Array(
173+
bytes.slice(index * ENCODE_CHUNK_SIZE, (index + 1) * ENCODE_CHUNK_SIZE)
174+
)
175+
)
176+
)
177+
.join("")
178+
)
167179
}
168180
throw Error("Could not encode base64 string")
169181
}

package-lock.json

Lines changed: 113 additions & 101 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/identitykit/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@
8383
"@headlessui/react": "2.2.0",
8484
"@radix-ui/react-dialog": "^1.1.5",
8585
"@radix-ui/react-tooltip": "^1.1.7",
86-
"@slide-computer/signer": "3.11.0",
87-
"@slide-computer/signer-agent": "3.11.0",
88-
"@slide-computer/signer-extension": "3.11.0",
89-
"@slide-computer/signer-storage": "3.11.0",
90-
"@slide-computer/signer-transport-auth-client": "3.11.0",
91-
"@slide-computer/signer-transport-plug": "3.11.0",
92-
"@slide-computer/signer-transport-stoic": "3.11.0",
93-
"@slide-computer/signer-web": "3.11.0",
86+
"@slide-computer/signer": "3.12.0",
87+
"@slide-computer/signer-agent": "3.12.0",
88+
"@slide-computer/signer-extension": "3.12.0",
89+
"@slide-computer/signer-storage": "3.12.0",
90+
"@slide-computer/signer-transport-auth-client": "3.12.0",
91+
"@slide-computer/signer-transport-plug": "3.12.0",
92+
"@slide-computer/signer-transport-stoic": "3.12.0",
93+
"@slide-computer/signer-web": "3.12.0",
9494
"clsx": "^2.1.1",
9595
"tailwindcss": "^3.4.13",
9696
"tailwindcss-scoped-preflight": "^3.4.10",

0 commit comments

Comments
 (0)