Skip to content

Commit 2d56dae

Browse files
committed
feat(sdk-core): add derivePasskeyPrfKey function
- fetch keychain webauthn devices and build PRF eval map - trigger WebAuthn assertion via provider - derive hex wallet passphrase from PRF output Ticket: WCN-192
1 parent 94da3fc commit 2d56dae

10 files changed

Lines changed: 446 additions & 373 deletions

File tree

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ COPY --from=builder /tmp/bitgo/modules/express /var/bitgo-express/
4343
#COPY_START
4444
COPY --from=builder /tmp/bitgo/modules/abstract-lightning /var/modules/abstract-lightning/
4545
COPY --from=builder /tmp/bitgo/modules/sdk-core /var/modules/sdk-core/
46+
COPY --from=builder /tmp/bitgo/modules/passkey-crypto /var/modules/passkey-crypto/
47+
COPY --from=builder /tmp/bitgo/modules/sjcl /var/modules/sjcl/
4648
COPY --from=builder /tmp/bitgo/modules/sdk-lib-mpc /var/modules/sdk-lib-mpc/
4749
COPY --from=builder /tmp/bitgo/modules/sdk-opensslbytes /var/modules/sdk-opensslbytes/
48-
COPY --from=builder /tmp/bitgo/modules/sjcl /var/modules/sjcl/
4950
COPY --from=builder /tmp/bitgo/modules/secp256k1 /var/modules/secp256k1/
5051
COPY --from=builder /tmp/bitgo/modules/statics /var/modules/statics/
5152
COPY --from=builder /tmp/bitgo/modules/utxo-lib /var/modules/utxo-lib/
@@ -145,9 +146,10 @@ COPY --from=builder /tmp/bitgo/modules/sdk-coin-zec /var/modules/sdk-coin-zec/
145146

146147
RUN cd /var/modules/abstract-lightning && yarn link && \
147148
cd /var/modules/sdk-core && yarn link && \
149+
cd /var/modules/passkey-crypto && yarn link && \
150+
cd /var/modules/sjcl && yarn link && \
148151
cd /var/modules/sdk-lib-mpc && yarn link && \
149152
cd /var/modules/sdk-opensslbytes && yarn link && \
150-
cd /var/modules/sjcl && yarn link && \
151153
cd /var/modules/secp256k1 && yarn link && \
152154
cd /var/modules/statics && yarn link && \
153155
cd /var/modules/utxo-lib && yarn link && \
@@ -250,9 +252,10 @@ cd /var/modules/sdk-coin-zec && yarn link
250252
RUN cd /var/bitgo-express && \
251253
yarn link @bitgo/abstract-lightning && \
252254
yarn link @bitgo/sdk-core && \
255+
yarn link @bitgo/passkey-crypto && \
256+
yarn link @bitgo/sjcl && \
253257
yarn link @bitgo/sdk-lib-mpc && \
254258
yarn link @bitgo/sdk-opensslbytes && \
255-
yarn link @bitgo/sjcl && \
256259
yarn link @bitgo/secp256k1 && \
257260
yarn link @bitgo/statics && \
258261
yarn link @bitgo/utxo-lib && \

modules/abstract-utxo/src/abstractUtxoCoin.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ import {
8181
getMainnetCoinName,
8282
getNetworkFromCoinName,
8383
isMainnetCoin,
84-
isUtxoCoinNameMainnet,
8584
UtxoCoinName,
8685
UtxoCoinNameMainnet,
8786
} from './names';
@@ -435,14 +434,17 @@ export abstract class AbstractUtxoCoin
435434
legacy: this.isMainnet(),
436435
};
437436

437+
protected supportedSdkBackends: { utxolib: boolean; 'wasm-utxo': boolean } = {
438+
utxolib: this.isMainnet(),
439+
'wasm-utxo': true,
440+
};
441+
438442
protected constructor(bitgo: BitGoBase, amountType: 'number' | 'bigint' = 'number') {
439443
super(bitgo);
440444
this.amountType = amountType;
441445
}
442446

443-
get defaultSdkBackend(): SdkBackend {
444-
return isUtxoCoinNameMainnet(this.name) ? 'utxolib' : 'wasm-utxo';
445-
}
447+
defaultSdkBackend: SdkBackend = 'wasm-utxo';
446448

447449
/**
448450
* @deprecated - will be removed when we drop support for utxolib
@@ -627,6 +629,10 @@ export abstract class AbstractUtxoCoin
627629
}
628630

629631
if (utxolib.bitgo.isPsbt(input)) {
632+
if (this.supportedSdkBackends[decodeWith] !== true) {
633+
throw new Error(`SDK support for decodeWith=${decodeWith} is not available on this environment.`);
634+
}
635+
630636
if (!this.supportedTxFormats.psbt) {
631637
throw new ErrorDeprecatedTxFormat('psbt');
632638
}

0 commit comments

Comments
 (0)